1、增加导出药房关联医生列表导出
2、检测到有绑定/默认医生时直接报错,强制要求管理员先手动处理;
This commit is contained in:
@@ -781,3 +781,51 @@ func (r *Export) OrderService(c *gin.Context) {
|
||||
|
||||
responses.OkWithData(ossAddress, c)
|
||||
}
|
||||
|
||||
// PharmacyDoctor 药房关联医生
|
||||
func (r *Export) PharmacyDoctor(c *gin.Context) {
|
||||
pharmacyRequest := requests.PharmacyRequest{}
|
||||
req := pharmacyRequest.PharmacyDoctorExportList
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
doctorPharmacyDao := dao.DoctorPharmacyDao{}
|
||||
list, err := doctorPharmacyDao.GetPharmacyDoctorExportListSearch(req)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
exportService := service.ExportService{}
|
||||
ossAddress, err := exportService.PharmacyDoctor(list)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取当前登陆用户id
|
||||
userId := c.GetInt64("UserId")
|
||||
if userId != 0 {
|
||||
// 记录日志
|
||||
logExport := &model.LogExport{
|
||||
AdminUserId: userId,
|
||||
ExportModule: "药房关联医生",
|
||||
ExportFile: utils.RemoveOssDomain(ossAddress),
|
||||
}
|
||||
|
||||
logExportDao := dao.LogExportDao{}
|
||||
_, _ = logExportDao.AddLogExportUnTransaction(logExport)
|
||||
}
|
||||
|
||||
responses.OkWithData(ossAddress, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user