This commit is contained in:
haomingming
2025-12-31 09:33:14 +08:00
parent 7a51cec28b
commit beb791a4ce
3 changed files with 238 additions and 3 deletions
+48
View File
@@ -499,6 +499,54 @@ func (r *Export) OrderProduct(c *gin.Context) {
responses.OkWithData(ossAddress, c)
}
// OrderPrescription 抄方的处方
func (r *Export) OrderTransferPrescription(c *gin.Context) {
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}
req := orderPrescriptionRequest.OrderPrescriptionExportList
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
}
// 获取数据
orderPrescriptionDao := dao.OrderPrescriptionDao{}
orderPrescriptions, err := orderPrescriptionDao.GetOrderTransferPrescriptionExportListSearch(req)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
// 业务处理
exportService := service.ExportService{}
ossAddress, err := exportService.OrderPrescription(orderPrescriptions)
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)
}
// OrderPrescription 处方
func (r *Export) OrderPrescription(c *gin.Context) {
orderPrescriptionRequest := requests.OrderPrescriptionRequest{}