XMLWAN 4 年 前
コミット
6b0cdc7f51
共有1 個のファイルを変更した51 個の追加41 個の削除を含む
  1. 51 41
      controllers/dialysis_parameter_api_controller.go

+ 51 - 41
controllers/dialysis_parameter_api_controller.go ファイルの表示

@@ -36,6 +36,7 @@ func (this *DialysisPrameterApiController) GetDialysisParameters() {
36 36
 	keywords := this.GetString("keyword")
37 37
 	adminUserInfo := this.GetAdminUserInfo()
38 38
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
39
+
39 40
 	fmt.Println("scheduletype", schedulType, start_time, partitionType, keywords, theTime.Unix())
40 41
 	if len(keywords) > 0 {
41 42
 		dialysisSchedule, err, total := service.GetDialysisParametersByKeyword(adminUserInfo.CurrentOrgId, keywords, schedulType, partitionType, page, limit, theTime.Unix())
@@ -57,27 +58,31 @@ func (this *DialysisPrameterApiController) GetDialysisParameters() {
57 58
 		var elist []interface{}
58 59
 		for _, item := range patient {
59 60
 			//查询当前日期的病人是否存在数据
60
-			_, errcode := service.GetToDayDialysisPrescription(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
61
-			if errcode == gorm.ErrRecordNotFound {
62
-				//查询每个病人透析处方的最后一次数据
63
-				prescription, _ := service.GetLastDialysisPrescription(item.PatientId, adminUserInfo.CurrentOrgId)
64
-				vlist = append(vlist, prescription)
65
-			} else if errcode == nil {
66
-				//获取当前日期
67
-				prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
68
-				vlist = append(vlist, prescription)
69
-			}
70
-
71
-			_, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
72
-			if errcodes == gorm.ErrRecordNotFound {
73
-				//查询每个病人透前评估的最后一次数据
74
-				dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, adminUserInfo.CurrentOrgId)
75
-				elist = append(elist, dialysis)
76
-			} else if errcodes == nil {
77
-				dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
78
-				elist = append(elist, dialysis)
79
-			}
80
-
61
+			//_, errcode := service.GetToDayDialysisPrescription(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
62
+			//if errcode == gorm.ErrRecordNotFound {
63
+			//	//查询每个病人透析处方的最后一次数据
64
+			//	prescription, _ := service.GetLastDialysisPrescription(item.PatientId, adminUserInfo.CurrentOrgId)
65
+			//	vlist = append(vlist, prescription)
66
+			//} else if errcode == nil {
67
+			//	//获取当前日期
68
+			//	prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
69
+			//	vlist = append(vlist, prescription)
70
+			//}
71
+
72
+			//_, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
73
+			//if errcodes == gorm.ErrRecordNotFound {
74
+			//	//查询每个病人透前评估的最后一次数据
75
+			//	dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, adminUserInfo.CurrentOrgId)
76
+			//	elist = append(elist, dialysis)
77
+			//} else if errcodes == nil {
78
+			//	dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
79
+			//	elist = append(elist, dialysis)
80
+			//}
81
+
82
+			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
83
+			vlist = append(vlist, prescription)
84
+			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
85
+			elist = append(elist, dialysis)
81 86
 		}
82 87
 
83 88
 		if err == nil {
@@ -209,27 +214,33 @@ func (this *DialysisPrameterApiController) GetCollectList() {
209 214
 	for _, item := range patient {
210 215
 		fmt.Println("---------", item.PatientId)
211 216
 		//查询当前日期的病人是否存在数据
212
-		_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, startime.Unix())
213
-		if errcode == gorm.ErrRecordNotFound {
214
-			//查询每个病人透析处方的最后一次数据
215
-			prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
216
-			vlist = append(vlist, prescription)
217
-		} else if errcode == nil {
218
-			//获取当前日期
219
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
220
-			vlist = append(vlist, prescription)
221
-		}
217
+		//_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, startime.Unix())
218
+		//if errcode == gorm.ErrRecordNotFound {
219
+		//	//查询每个病人透析处方的最后一次数据
220
+		//	prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
221
+		//	vlist = append(vlist, prescription)
222
+		//} else if errcode == nil {
223
+		//	//获取当前日期
224
+		//	prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
225
+		//	vlist = append(vlist, prescription)
226
+		//}
222 227
 
223 228
 		//查询每个病人当前日期是否存在数据
224
-		_, errco := service.GetAotoMaticReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
225
-		fmt.Println("errco--------------------------", errco)
226
-		if errco == gorm.ErrRecordNotFound {
227
-			reduece, _ := service.GetMaticReduece(item.PatientId, orgId)
228
-			clist = append(clist, reduece)
229
-		} else if errco == nil {
230
-			reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
231
-			clist = append(clist, reduece)
232
-		}
229
+		//_, errco := service.GetAotoMaticReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
230
+		//fmt.Println("errco--------------------------", errco)
231
+		//if errco == gorm.ErrRecordNotFound {
232
+		//	reduece, _ := service.GetMaticReduece(item.PatientId, orgId)
233
+		//	clist = append(clist, reduece)
234
+		//} else if errco == nil {
235
+		//	reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
236
+		//	clist = append(clist, reduece)
237
+		//}
238
+
239
+		prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
240
+		vlist = append(vlist, prescription)
241
+
242
+		reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
243
+		clist = append(clist, reduece)
233 244
 	}
234 245
 	//获取透析耗材数据
235 246
 	consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
@@ -252,7 +263,6 @@ func (this *DialysisPrameterApiController) GetCollectList() {
252 263
 
253 264
 		dialysisGoods, _, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
254 265
 		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
255
-
256 266
 			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, orgId, startime.Unix())
257 267
 			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, orgId, startime.Unix())
258 268
 			item.LastAutomaticReduceDetail = goodUser