瀏覽代碼

11月9日库存管理

XMLWAN 2 年之前
父節點
當前提交
5b1e03b3a5

+ 1 - 1
conf/app.conf 查看文件

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3
 runmode = dev
3
 runmode = dev
4
 #dev/prod
4
 #dev/prod
5
 
5
 

+ 5 - 5
controllers/doctors_api_controller.go 查看文件

93
 	project_config, _ := service.GetHisProjectConfig(orgID)
93
 	project_config, _ := service.GetHisProjectConfig(orgID)
94
 
94
 
95
 	if config.IsOpen == 0 || config.IsOpen == 2 {
95
 	if config.IsOpen == 0 || config.IsOpen == 2 {
96
-		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way)
96
+		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, 0)
97
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
97
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
98
 		if err != nil {
98
 		if err != nil {
99
 			c.ErrorLog("获取排班信息失败:%v", err)
99
 			c.ErrorLog("获取排班信息失败:%v", err)
114
 		}
114
 		}
115
 	}
115
 	}
116
 	if config.IsOpen == 1 {
116
 	if config.IsOpen == 1 {
117
-		hisAdvices, err := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way)
117
+		hisAdvices, err := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, 0)
118
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
118
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
119
 		project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
119
 		project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
120
 		for _, item := range project {
120
 		for _, item := range project {
1374
 	partition_type, _ := c.GetInt64("partition_type")
1374
 	partition_type, _ := c.GetInt64("partition_type")
1375
 	patient_id, _ := c.GetInt64("patient_id")
1375
 	patient_id, _ := c.GetInt64("patient_id")
1376
 	excution_way, _ := c.GetInt64("excution_way")
1376
 	excution_way, _ := c.GetInt64("excution_way")
1377
-	//cost_type, _ := c.GetInt64("cost_type")
1377
+	cost_type, _ := c.GetInt64("cost_type")
1378
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
1378
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
1379
 		adviceType = 0
1379
 		adviceType = 0
1380
 	}
1380
 	}
1397
 	project_config, _ := service.GetHisProjectConfig(orgID)
1397
 	project_config, _ := service.GetHisProjectConfig(orgID)
1398
 
1398
 
1399
 	if config.IsOpen == 0 || config.IsOpen == 2 {
1399
 	if config.IsOpen == 0 || config.IsOpen == 2 {
1400
-		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way)
1400
+		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type)
1401
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1401
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1402
 		if err != nil {
1402
 		if err != nil {
1403
 			c.ErrorLog("获取排班信息失败:%v", err)
1403
 			c.ErrorLog("获取排班信息失败:%v", err)
1418
 		}
1418
 		}
1419
 	}
1419
 	}
1420
 	if config.IsOpen == 1 {
1420
 	if config.IsOpen == 1 {
1421
-		hisAdvices, err := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way)
1421
+		hisAdvices, err := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type)
1422
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1422
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1423
 		project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
1423
 		project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
1424
 		for _, item := range project {
1424
 		for _, item := range project {

+ 38 - 6
controllers/his_api_controller.go 查看文件

1930
 							s.PatientId = patient_id
1930
 							s.PatientId = patient_id
1931
 							s.HisPatientId = his_patient_id
1931
 							s.HisPatientId = his_patient_id
1932
 							s.StartTime = pTime
1932
 							s.StartTime = pTime
1933
-
1933
+							s.IsSettle = 2
1934
 							errcode := c.setAdviceWithJSON(&s, advice.(map[string]interface{}))
1934
 							errcode := c.setAdviceWithJSON(&s, advice.(map[string]interface{}))
1935
 							if errcode > 0 {
1935
 							if errcode > 0 {
1936
 								c.ServeFailJSONWithSGJErrorCode(errcode)
1936
 								c.ServeFailJSONWithSGJErrorCode(errcode)
2832
 
2832
 
2833
 		}
2833
 		}
2834
 	}
2834
 	}
2835
-	if drugStockConfig.IsOpen == 1 {
2835
+	if c.GetAdminUserInfo().CurrentOrgId == 10387 {
2836
+
2836
 		if len(advices) > 0 {
2837
 		if len(advices) > 0 {
2837
 			for _, item := range advices {
2838
 			for _, item := range advices {
2838
 				creater := c.GetAdminUserInfo().AdminUser.Id
2839
 				creater := c.GetAdminUserInfo().AdminUser.Id
2839
 				service.DrugAutoAddCancelInfo(item, creater)
2840
 				service.DrugAutoAddCancelInfo(item, creater)
2840
 			}
2841
 			}
2841
 		}
2842
 		}
2843
+
2844
+	} else {
2845
+		if drugStockConfig.IsOpen == 1 {
2846
+			if len(advices) > 0 {
2847
+				for _, item := range advices {
2848
+					creater := c.GetAdminUserInfo().AdminUser.Id
2849
+					service.DrugAutoAddCancelInfo(item, creater)
2850
+				}
2851
+			}
2852
+		}
2842
 	}
2853
 	}
2854
+
2843
 	c.ServeSuccessJSON(map[string]interface{}{
2855
 	c.ServeSuccessJSON(map[string]interface{}{
2844
 		"msg": "删除成功",
2856
 		"msg": "删除成功",
2845
 	})
2857
 	})
2914
 	defer redis.Close()
2926
 	defer redis.Close()
2915
 
2927
 
2916
 	if err == nil {
2928
 	if err == nil {
2917
-		if drugStockConfig.IsOpen == 1 {
2918
-
2929
+		if c.GetAdminUserInfo().CurrentOrgId == 10387 {
2919
 			//查询是否在处方中出库
2930
 			//查询是否在处方中出库
2920
 			openConfig, _ := service.GetDrugOpenConfigOne(c.GetAdminUserInfo().CurrentOrgId)
2931
 			openConfig, _ := service.GetDrugOpenConfigOne(c.GetAdminUserInfo().CurrentOrgId)
2921
 
2932
 
2925
 				if advice.ExecutionState == 1 {
2936
 				if advice.ExecutionState == 1 {
2926
 					creater := c.GetAdminUserInfo().AdminUser.Id
2937
 					creater := c.GetAdminUserInfo().AdminUser.Id
2927
 					service.DrugAutoAddCancelInfo(&advice, creater)
2938
 					service.DrugAutoAddCancelInfo(&advice, creater)
2928
-
2929
 				}
2939
 				}
2930
-
2931
 			}
2940
 			}
2932
 
2941
 
2933
 			//开启保存处方扣减功能
2942
 			//开启保存处方扣减功能
2934
 			if openConfig.IsOpen == 1 {
2943
 			if openConfig.IsOpen == 1 {
2935
 				creater := c.GetAdminUserInfo().AdminUser.Id
2944
 				creater := c.GetAdminUserInfo().AdminUser.Id
2936
 				service.DrugAutoAddCancelInfo(&advice, creater)
2945
 				service.DrugAutoAddCancelInfo(&advice, creater)
2946
+			}
2947
+		} else {
2948
+			if drugStockConfig.IsOpen == 1 {
2949
+
2950
+				//查询是否在处方中出库
2951
+				openConfig, _ := service.GetDrugOpenConfigOne(c.GetAdminUserInfo().CurrentOrgId)
2952
+
2953
+				if openConfig.IsOpen != 1 {
2954
+
2955
+					//判断该医嘱是否执行了
2956
+					if advice.ExecutionState == 1 {
2957
+						creater := c.GetAdminUserInfo().AdminUser.Id
2958
+						service.DrugAutoAddCancelInfo(&advice, creater)
2959
+
2960
+					}
2961
+
2962
+				}
2937
 
2963
 
2964
+				//开启保存处方扣减功能
2965
+				if openConfig.IsOpen == 1 {
2966
+					creater := c.GetAdminUserInfo().AdminUser.Id
2967
+					service.DrugAutoAddCancelInfo(&advice, creater)
2968
+
2969
+				}
2938
 			}
2970
 			}
2939
 		}
2971
 		}
2940
 
2972
 

+ 3 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go 查看文件

379
 			newprescribe.Remark = dialysisSolution.Remark
379
 			newprescribe.Remark = dialysisSolution.Remark
380
 			if adminUserInfo.Org.Id == 10340 {
380
 			if adminUserInfo.Org.Id == 10340 {
381
 				newprescribe.TargetUltrafiltration = 0
381
 				newprescribe.TargetUltrafiltration = 0
382
+				newprescribe.Sodium = 138
383
+				newprescribe.Bicarbonate = 31.1
384
+				newprescribe.DialysateFlow = 500
382
 			}
385
 			}
383
 			//插入透析处方
386
 			//插入透析处方
384
 			err := service.AddSigleRecord(&newprescribe)
387
 			err := service.AddSigleRecord(&newprescribe)

+ 2 - 5
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

201
 				project, _ = service.GetAllHisProjectPrescription(orgID, date.Unix())
201
 				project, _ = service.GetAllHisProjectPrescription(orgID, date.Unix())
202
 			}
202
 			}
203
 
203
 
204
-			list, _ := service.GetZoneCountList(orgID, date.Unix())
204
+			//list, _ := service.GetZoneCountList(orgID, date.Unix())
205
 
205
 
206
 			this.ServeSuccessJSON(map[string]interface{}{
206
 			this.ServeSuccessJSON(map[string]interface{}{
207
 				"scheduals": scheduals,
207
 				"scheduals": scheduals,
208
 				"project":   project,
208
 				"project":   project,
209
-				"list":      list,
210
 			})
209
 			})
211
 		}
210
 		}
212
 
211
 
225
 		if configs.ID > 0 && configs.IsOpen == 1 {
224
 		if configs.ID > 0 && configs.IsOpen == 1 {
226
 			project, _ = service.GetAllHisProjectPrescription(orgID, date.Unix())
225
 			project, _ = service.GetAllHisProjectPrescription(orgID, date.Unix())
227
 		}
226
 		}
228
-		list, _ := service.GetZoneCountList(orgID, date.Unix())
227
+
229
 		this.ServeSuccessJSON(map[string]interface{}{
228
 		this.ServeSuccessJSON(map[string]interface{}{
230
 			"scheduals": dat,
229
 			"scheduals": dat,
231
 			"redis":     "true",
230
 			"redis":     "true",
232
 			"date":      schedualDate,
231
 			"date":      schedualDate,
233
 			"project":   project,
232
 			"project":   project,
234
-			"list":      list,
235
 		})
233
 		})
236
 
234
 
237
 	}
235
 	}
565
 	if is_advice_open.IsAdviceOpen == 1 {
563
 	if is_advice_open.IsAdviceOpen == 1 {
566
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
564
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
567
 	}
565
 	}
568
-	fmt.Println("doctorAdvices23344334344433434334343434wode", doctorAdvices)
569
 
566
 
570
 	lastOrder, _ := service.GetLastDilysisOrder(adminInfo.Org.Id, patientID, date.Unix())
567
 	lastOrder, _ := service.GetLastDilysisOrder(adminInfo.Org.Id, patientID, date.Unix())
571
 	returnData := map[string]interface{}{
568
 	returnData := map[string]interface{}{

+ 37 - 3
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

1772
 		newprescribe.ID = dialysisPrescription.ID
1772
 		newprescribe.ID = dialysisPrescription.ID
1773
 
1773
 
1774
 		if dialysisPrescription.ID == 0 {
1774
 		if dialysisPrescription.ID == 0 {
1775
+			if adminUserInfo.Org.Id == 10340 {
1776
+				newprescribe.Sodium = 138
1777
+				newprescribe.Bicarbonate = 31.1
1778
+				newprescribe.DialysateFlow = 500
1779
+			}
1775
 			err := service.AddSigleRecord(&newprescribe)
1780
 			err := service.AddSigleRecord(&newprescribe)
1776
 			//获取key,清空redis
1781
 			//获取key,清空redis
1777
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1782
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1797
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
1802
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
1798
 			}
1803
 			}
1799
 		} else {
1804
 		} else {
1805
+			if adminUserInfo.Org.Id == 10340 {
1806
+				newprescribe.Sodium = 138
1807
+				newprescribe.Bicarbonate = 31.1
1808
+				newprescribe.DialysateFlow = 500
1809
+			}
1800
 			err := service.UpDateDialysisPrescription(&newprescribe)
1810
 			err := service.UpDateDialysisPrescription(&newprescribe)
1801
 			//获取key,清空redis
1811
 			//获取key,清空redis
1802
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1812
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1879
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
1889
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
1880
 			newprescribe.ID = dialysisPrescription.ID
1890
 			newprescribe.ID = dialysisPrescription.ID
1881
 			if dialysisPrescription.ID == 0 {
1891
 			if dialysisPrescription.ID == 0 {
1892
+				if adminUserInfo.Org.Id == 10340 {
1893
+					newprescribe.Sodium = 138
1894
+					newprescribe.Bicarbonate = 31.1
1895
+					newprescribe.DialysateFlow = 500
1896
+				}
1882
 				err := service.AddSigleRecord(&newprescribe)
1897
 				err := service.AddSigleRecord(&newprescribe)
1883
 				//获取key,清空redis
1898
 				//获取key,清空redis
1884
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1899
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1900
 
1915
 
1901
 				keySeven := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":dialysis_prescribe_by_mode"
1916
 				keySeven := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":dialysis_prescribe_by_mode"
1902
 				redis.Set(keySeven, "", time.Second)
1917
 				redis.Set(keySeven, "", time.Second)
1903
-				fmt.Println("处方2222222222")
1918
+
1904
 				if err != nil {
1919
 				if err != nil {
1905
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
1920
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
1906
 				}
1921
 				}
1987
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2002
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
1988
 			newprescribe.ID = dialysisPrescription.ID
2003
 			newprescribe.ID = dialysisPrescription.ID
1989
 			if dialysisPrescription.ID == 0 {
2004
 			if dialysisPrescription.ID == 0 {
2005
+				if adminUserInfo.Org.Id == 10340 {
2006
+					newprescribe.Sodium = 138
2007
+					newprescribe.Bicarbonate = 31.1
2008
+					newprescribe.DialysateFlow = 500
2009
+				}
1990
 				err := service.AddSigleRecord(&newprescribe)
2010
 				err := service.AddSigleRecord(&newprescribe)
1991
 
2011
 
1992
-				fmt.Println("处方2222222222")
1993
 				//获取key,清空redis
2012
 				//获取key,清空redis
1994
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2013
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1995
 				redis := service.RedisClient()
2014
 				redis := service.RedisClient()
2014
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2033
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2015
 				}
2034
 				}
2016
 			} else {
2035
 			} else {
2036
+				if adminUserInfo.Org.Id == 10340 {
2037
+					newprescribe.Sodium = 138
2038
+					newprescribe.Bicarbonate = 31.1
2039
+					newprescribe.DialysateFlow = 500
2040
+				}
2017
 				err := service.UpDateDialysisPrescription(&newprescribe)
2041
 				err := service.UpDateDialysisPrescription(&newprescribe)
2018
 				//获取key,清空redis
2042
 				//获取key,清空redis
2019
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2043
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2058
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2082
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2059
 			newprescribe.ID = dialysisPrescription.ID
2083
 			newprescribe.ID = dialysisPrescription.ID
2060
 			if dialysisPrescription.ID == 0 {
2084
 			if dialysisPrescription.ID == 0 {
2085
+				if adminUserInfo.Org.Id == 10340 {
2086
+					newprescribe.Sodium = 138
2087
+					newprescribe.Bicarbonate = 31.1
2088
+					newprescribe.DialysateFlow = 500
2089
+				}
2061
 				err := service.AddSigleRecord(&newprescribe)
2090
 				err := service.AddSigleRecord(&newprescribe)
2062
-				fmt.Println("处方44444444444")
2091
+
2063
 				//获取key,清空redis
2092
 				//获取key,清空redis
2064
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2093
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2065
 				redis := service.RedisClient()
2094
 				redis := service.RedisClient()
2084
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2113
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2085
 				}
2114
 				}
2086
 			} else {
2115
 			} else {
2116
+				if adminUserInfo.Org.Id == 10340 {
2117
+					newprescribe.Sodium = 138
2118
+					newprescribe.Bicarbonate = 31.1
2119
+					newprescribe.DialysateFlow = 500
2120
+				}
2087
 				err := service.UpDateDialysisPrescription(&newprescribe)
2121
 				err := service.UpDateDialysisPrescription(&newprescribe)
2088
 				//获取key,清空redis
2122
 				//获取key,清空redis
2089
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2123
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"

+ 5 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go 查看文件

249
 
249
 
250
 	id := this.GetMobileAdminUserInfo().Org.Id
250
 	id := this.GetMobileAdminUserInfo().Org.Id
251
 	zone, err := service.GetAllMobileZone(id)
251
 	zone, err := service.GetAllMobileZone(id)
252
+
252
 	if err != nil {
253
 	if err != nil {
253
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
254
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
254
 		return
255
 		return
283
 		//获取当天排班的病人情况
284
 		//获取当天排班的病人情况
284
 		schedule, err := service.GetPatientSchedule(startTime, zoneid, classtype, orgid)
285
 		schedule, err := service.GetPatientSchedule(startTime, zoneid, classtype, orgid)
285
 
286
 
287
+		zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
286
 		if err != nil {
288
 		if err != nil {
287
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
289
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
288
 			return
290
 			return
289
 		}
291
 		}
290
 		this.ServeSuccessJSON(map[string]interface{}{
292
 		this.ServeSuccessJSON(map[string]interface{}{
291
 			"schedule": schedule,
293
 			"schedule": schedule,
294
+			"zonelist": zonelist,
292
 		})
295
 		})
293
 	}
296
 	}
294
 	if is_open == 1 {
297
 	if is_open == 1 {
295
 		//获取空床位的排班数据
298
 		//获取空床位的排班数据
296
 		list, err := service.GetPatientScheduleByBed(startTime, zoneid, orgid, classtype)
299
 		list, err := service.GetPatientScheduleByBed(startTime, zoneid, orgid, classtype)
297
 		stockType, _ := service.GetStockType(orgid)
300
 		stockType, _ := service.GetStockType(orgid)
301
+		zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
298
 		if err != nil {
302
 		if err != nil {
299
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
303
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
300
 			return
304
 			return
302
 		this.ServeSuccessJSON(map[string]interface{}{
306
 		this.ServeSuccessJSON(map[string]interface{}{
303
 			"schedule":  list,
307
 			"schedule":  list,
304
 			"stockType": stockType,
308
 			"stockType": stockType,
309
+			"zonelist":  zonelist,
305
 		})
310
 		})
306
 	}
311
 	}
307
 }
312
 }

+ 1 - 0
models/patient_models.go 查看文件

472
 	PatientId              int64 `gorm:"column:patient_id" json:"patient_id"`
472
 	PatientId              int64 `gorm:"column:patient_id" json:"patient_id"`
473
 	AssessmentDate         int64 `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
473
 	AssessmentDate         int64 `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
474
 	BloodAccessPartOperaId int64 `gorm:"column:blood_access_part_opera_id" json:"blood_access_part_opera_id" form:"blood_access_part_opera_id"`
474
 	BloodAccessPartOperaId int64 `gorm:"column:blood_access_part_opera_id" json:"blood_access_part_opera_id" form:"blood_access_part_opera_id"`
475
+	CreatedTime            int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
475
 }
476
 }
476
 
477
 
477
 func (DialysisAssesmentBefor) TableName() string {
478
 func (DialysisAssesmentBefor) TableName() string {

+ 15 - 1
models/schedule_models.go 查看文件

500
 }
500
 }
501
 
501
 
502
 func (ScheduleTwenty) TableName() string {
502
 func (ScheduleTwenty) TableName() string {
503
-	return "ScheduleTwenty"
503
+	return "xt_schedule"
504
+}
505
+
506
+type ScheduleTwentyOne struct {
507
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
508
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
509
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
510
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
511
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
512
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
513
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
514
+}
515
+
516
+func (ScheduleTwentyOne) TableName() string {
517
+	return "xt_schedule"
504
 }
518
 }

+ 17 - 0
service/doctor_schedule_service.go 查看文件

741
 	err := XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and status = 1", patientid, recordate).Updates(map[string]interface{}{"dialysis_dialyszers": prescription.DialysisDialyszers, "mode_id": mode_id, "dialysis_irrigation": prescription.DialysisIrrigation}).Error
741
 	err := XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and status = 1", patientid, recordate).Updates(map[string]interface{}{"dialysis_dialyszers": prescription.DialysisDialyszers, "mode_id": mode_id, "dialysis_irrigation": prescription.DialysisIrrigation}).Error
742
 	return err
742
 	return err
743
 }
743
 }
744
+
745
+func GetPatientScheduleListByZone(schedule_date int64, class_tye int64, orgid int64) (schedule []*models.ScheduleTwentyOne, err error) {
746
+
747
+	db := XTReadDB().Model(&schedule).Where("status = 1")
748
+
749
+	if schedule_date > 0 {
750
+		db = db.Where("schedule_date = ?", schedule_date)
751
+	}
752
+	if class_tye > 0 {
753
+		db = db.Where("schedule_type = ?", class_tye)
754
+	}
755
+	if orgid > 0 {
756
+		db = db.Where("user_org_id = ?", orgid)
757
+	}
758
+	err = db.Select("partition_id,Count(id) as id,user_org_id").Group("partition_id").Scan(&schedule).Error
759
+	return schedule, err
760
+}

文件差異過大導致無法顯示
+ 717 - 223
service/mobile_dialysis_service.go


+ 1 - 2
service/patient_service.go 查看文件

557
 	redis := RedisClient()
557
 	redis := RedisClient()
558
 	defer redis.Close()
558
 	defer redis.Close()
559
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(id, 10) + ":patient_info"
559
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(id, 10) + ":patient_info"
560
-
561
 	patient_info_str, _ := redis.Get(key).Result()
560
 	patient_info_str, _ := redis.Get(key).Result()
562
-	fmt.Println("patient_info_stre223322323232323323223", patient_info_str)
561
+
563
 	if len(patient_info_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
562
 	if len(patient_info_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
564
 		err = readDb.Model(&models.Patients{}).Preload("Contagions", "status = 1").Preload("Diseases", "status = 1").Where("id = ? and user_org_id=? and status=1", id, orgID).First(&patient).Error
563
 		err = readDb.Model(&models.Patients{}).Preload("Contagions", "status = 1").Preload("Diseases", "status = 1").Where("id = ? and user_org_id=? and status=1", id, orgID).First(&patient).Error
565
 		if err != nil {
564
 		if err != nil {