XMLWAN 2 лет назад
Родитель
Сommit
9b6ddaab5b
1 измененных файлов: 35 добавлений и 3 удалений
  1. 35 3
      controllers/dialysis_api_controller.go

+ 35 - 3
controllers/dialysis_api_controller.go Просмотреть файл

@@ -64,6 +64,8 @@ func DialysisApiRegistRouters() {
64 64
 	beego.Router("/api/queue/update", &DialysisApiController{}, "Get:UpdateQueueCall")
65 65
 
66 66
 	beego.Router("/api/get/getrolelist", &DialysisApiController{}, "Get:GetRoleList")
67
+
68
+	beego.Router("/api/getinitprintdata", &DialysisApiController{}, "Get:GetInitPrintData")
67 69
 }
68 70
 
69 71
 func (c *DialysisApiController) GetQueueCall() {
@@ -3749,6 +3751,8 @@ func (c *DialysisApiController) GetDialysisGoods() {
3749 3751
 
3750 3752
 	patient_id, _ := c.GetInt64("patient_id")
3751 3753
 
3754
+	good_type, _ := c.GetInt64("good_type")
3755
+
3752 3756
 	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
3753 3757
 	if parseDateErr != nil && len(schedualDate) != 0 {
3754 3758
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -3771,10 +3775,14 @@ func (c *DialysisApiController) GetDialysisGoods() {
3771 3775
 	goodTypes, _ := service.FindAllGoodType(adminUser.CurrentOrgId)
3772 3776
 
3773 3777
 	if err == gorm.ErrRecordNotFound {
3778
+		list, _ := service.GetDialysisGood(adminUser.CurrentOrgId, date.Unix())
3779
+		var ids []int64
3780
+		for _, item := range list {
3781
+			ids = append(ids, item.PatientId)
3782
+		}
3774 3783
 
3775
-		dialysisGoods, _, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate)
3784
+		dialysisGoods, _, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate, good_type, ids)
3776 3785
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
3777
-
3778 3786
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3779 3787
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3780 3788
 			item.LastAutomaticReduceDetail = goodUser
@@ -3789,7 +3797,13 @@ func (c *DialysisApiController) GetDialysisGoods() {
3789 3797
 
3790 3798
 	} else if err == nil {
3791 3799
 		//获取当天排班的每个患者的库存使用情况
3792
-		dialysisGoods, err, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate)
3800
+		list, _ := service.GetDialysisGood(adminUser.CurrentOrgId, date.Unix())
3801
+		var ids []int64
3802
+		for _, item := range list {
3803
+			ids = append(ids, item.PatientId)
3804
+		}
3805
+
3806
+		dialysisGoods, err, total := service.PCGetDialysisGoods(adminUser.CurrentOrgId, date.Unix(), schedule_type, partition_id, page, limit, patient_id, keywords, schedualEndDate, good_type, ids)
3793 3807
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
3794 3808
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, adminUser.CurrentOrgId, date.Unix())
3795 3809
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, adminUser.CurrentOrgId, date.Unix())
@@ -3873,3 +3887,21 @@ func (c *DialysisApiController) GetRoleList() {
3873 3887
 		return
3874 3888
 	}
3875 3889
 }
3890
+
3891
+func (c *DialysisApiController) GetInitPrintData() {
3892
+
3893
+	patient_id, _ := c.GetInt64("patient_id")
3894
+	record_date, _ := c.GetInt64("record_date")
3895
+	orgId := c.GetAdminUserInfo().CurrentOrgId
3896
+	list, err := service.GetInitPrintData(patient_id, record_date, orgId)
3897
+	if err == nil {
3898
+		c.ServeSuccessJSON(map[string]interface{}{
3899
+			"list": list,
3900
+		})
3901
+		return
3902
+
3903
+	} else {
3904
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3905
+		return
3906
+	}
3907
+}