28169 5 meses atrás
pai
commit
e14759dc2c

BIN
XT_New.exe Ver arquivo


+ 4 - 4
controllers/base_api_controller.go Ver arquivo

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10206 //机构id
86
+		subscibe.OrgId = 10644 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 18470 //4
97
 		adminUserInfo.CurrentAppId = 18470 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10206 //机构id小英9675或4
332
+		subscibe.OrgId = 10644 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 18470 //4
343
 		adminUserInfo.CurrentAppId = 18470 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 136 - 2
controllers/dialysis_api_controller.go Ver arquivo

399
 	//	}
399
 	//	}
400
 	//}
400
 	//}
401
 
401
 
402
+	goodList, _ := service.GetMobileGoodList(adminUserInfo.CurrentOrgId)
403
+
404
+	var dialysis_dialyszers_id int64
405
+	var dialysis_strainer_id int64
406
+	var dialysis_irrigation_id int64
407
+	if len(goodList) > 0 {
408
+		for _, item := range goodList {
409
+			if item.SpecificationName == dialysis_dialyszers {
410
+				dialysis_dialyszers_id = item.ID
411
+			}
412
+			if item.SpecificationName == dialysis_irrigation {
413
+				dialysis_irrigation_id = item.ID
414
+			}
415
+			if item.SpecificationName == dialysis_strainer {
416
+				dialysis_strainer_id = item.ID
417
+			}
418
+		}
419
+	}
420
+
402
 	prescription := models.DialysisPrescription{
421
 	prescription := models.DialysisPrescription{
403
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
422
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
404
 		PatientId:                 patient,
423
 		PatientId:                 patient,
506
 		BloodAccessPartId:          blood_access_part_id,
525
 		BloodAccessPartId:          blood_access_part_id,
507
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
526
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
508
 		Dialyzate:                  dialyzate,
527
 		Dialyzate:                  dialyzate,
528
+		DialysisStrainerId:         dialysis_strainer_id,
529
+		DialysisIrrigationId:       dialysis_irrigation_id,
530
+		DialysisDialyszersId:       dialysis_dialyszers_id,
509
 	}
531
 	}
510
 
532
 
511
 	//长沙南雅医院,自动生成抗凝剂的临时处方
533
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1100
 		}
1122
 		}
1101
 	}
1123
 	}
1102
 
1124
 
1125
+	goodList, _ := service.GetMobileGoodList(adminUserInfo.CurrentOrgId)
1126
+
1127
+	var dialysis_dialyszers_id int64
1128
+	var dialysis_strainer_id int64
1129
+	var dialysis_irrigation_id int64
1130
+	if len(goodList) > 0 {
1131
+		for _, item := range goodList {
1132
+			if item.SpecificationName == dialysis_dialyszers {
1133
+				dialysis_dialyszers_id = item.ID
1134
+			}
1135
+			if item.SpecificationName == dialysis_irrigation {
1136
+				dialysis_irrigation_id = item.ID
1137
+			}
1138
+			if item.SpecificationName == dialysis_strainer {
1139
+				dialysis_strainer_id = item.ID
1140
+			}
1141
+		}
1142
+	}
1143
+
1103
 	prescription := models.DialysisPrescription{
1144
 	prescription := models.DialysisPrescription{
1104
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
1145
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
1105
 		PatientId:                 patient,
1146
 		PatientId:                 patient,
1209
 		BloodAccessPartId:          blood_access_part_id,
1250
 		BloodAccessPartId:          blood_access_part_id,
1210
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1251
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1211
 		Dialyzate:                  dialyzate,
1252
 		Dialyzate:                  dialyzate,
1253
+		DialysisDialyszersId:       dialysis_dialyszers_id,
1254
+		DialysisIrrigationId:       dialysis_irrigation_id,
1255
+		DialysisStrainerId:         dialysis_strainer_id,
1212
 	}
1256
 	}
1213
 
1257
 
1214
 	if prescription.Anticoagulant == 0 {
1258
 	if prescription.Anticoagulant == 0 {
1420
 		BloodAccessPartId:          blood_access_part_id,
1464
 		BloodAccessPartId:          blood_access_part_id,
1421
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1465
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1422
 		Dialyzate:                  dialyzate,
1466
 		Dialyzate:                  dialyzate,
1467
+		DialysisDialyszersId:       dialysis_dialyszers_id,
1468
+		DialysisIrrigationId:       dialysis_irrigation_id,
1469
+		DialysisStrainerId:         dialysis_strainer_id,
1423
 	}
1470
 	}
1424
 
1471
 
1425
 	if solution.Anticoagulant == 0 {
1472
 	if solution.Anticoagulant == 0 {
1799
 
1846
 
1800
 			}
1847
 			}
1801
 		}
1848
 		}
1849
+
1850
+		//针对溪康
1851
+		if adminUserInfo.CurrentOrgId == 10721 {
1852
+
1853
+			adviceInfoList, _ := service.GetHisDoctorAdviceList(adminUserInfo.CurrentOrgId, id, recordDate.Unix())
1854
+			if len(adviceInfoList) > 0 {
1855
+				for _, item := range adviceInfoList {
1856
+
1857
+					service.UpdateHisAdviceList(item.ID, creater)
1858
+					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1859
+					redis := service.RedisClient()
1860
+					//清空key 值
1861
+					redis.Set(key, "", time.Second)
1862
+					keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1863
+					redis.Set(keyTwo, "", time.Second)
1864
+					theTime := time.Now()
1865
+					recordDate := theTime.Format("2006-01-02")
1866
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1867
+					redis.Set(keyFour, "", time.Second)
1868
+					defer redis.Close()
1869
+				}
1870
+			}
1871
+
1872
+			adviceList, _ := service.GetMobileDoctorAdviceList(adminUserInfo.CurrentOrgId, id, recordDate.Unix())
1873
+			if len(adviceList) > 0 {
1874
+				for _, item := range adviceList {
1875
+					service.UpdateAdviceList(item.ID, creater)
1876
+					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1877
+					redis := service.RedisClient()
1878
+					//清空key 值
1879
+					redis.Set(key, "", time.Second)
1880
+					keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1881
+					redis.Set(keyTwo, "", time.Second)
1882
+					theTime := time.Now()
1883
+					recordDate := theTime.Format("2006-01-02")
1884
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1885
+					redis.Set(keyFour, "", time.Second)
1886
+					defer redis.Close()
1887
+				}
1888
+			}
1889
+		}
1890
+
1802
 		redis := service.RedisClient()
1891
 		redis := service.RedisClient()
1803
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1892
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1804
 
1893
 
1829
 
1918
 
1830
 		redis := service.RedisClient()
1919
 		redis := service.RedisClient()
1831
 		err := service.UpdateDoubleCheck(&doubleCheck)
1920
 		err := service.UpdateDoubleCheck(&doubleCheck)
1921
+
1922
+		//针对溪康
1923
+		if adminUserInfo.CurrentOrgId == 10721 {
1924
+
1925
+			adviceInfoList, _ := service.GetHisDoctorAdviceList(adminUserInfo.CurrentOrgId, id, recordDate.Unix())
1926
+			if len(adviceInfoList) > 0 {
1927
+				for _, item := range adviceInfoList {
1928
+
1929
+					service.UpdateHisAdviceList(item.ID, creater)
1930
+					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1931
+					redis := service.RedisClient()
1932
+					//清空key 值
1933
+					redis.Set(key, "", time.Second)
1934
+					keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1935
+					redis.Set(keyTwo, "", time.Second)
1936
+					theTime := time.Now()
1937
+					recordDate := theTime.Format("2006-01-02")
1938
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1939
+					redis.Set(keyFour, "", time.Second)
1940
+					defer redis.Close()
1941
+				}
1942
+			}
1943
+
1944
+			adviceList, _ := service.GetMobileDoctorAdviceList(adminUserInfo.CurrentOrgId, id, recordDate.Unix())
1945
+			if len(adviceList) > 0 {
1946
+				for _, item := range adviceList {
1947
+					service.UpdateAdviceList(item.ID, creater)
1948
+					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1949
+					redis := service.RedisClient()
1950
+					//清空key 值
1951
+					redis.Set(key, "", time.Second)
1952
+					keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1953
+					redis.Set(keyTwo, "", time.Second)
1954
+					theTime := time.Now()
1955
+					recordDate := theTime.Format("2006-01-02")
1956
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1957
+					redis.Set(keyFour, "", time.Second)
1958
+					defer redis.Close()
1959
+				}
1960
+			}
1961
+		}
1962
+
1832
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1963
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1833
 
1964
 
1834
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1965
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2575
 			service.CreateDialysisFinish(finish)
2706
 			service.CreateDialysisFinish(finish)
2576
 		}
2707
 		}
2577
 
2708
 
2578
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 {
2709
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 {
2579
 			var dewater_amount float64
2710
 			var dewater_amount float64
2580
 			dewater_amount = 0
2711
 			dewater_amount = 0
2581
 			if dry_weight > 0 {
2712
 			if dry_weight > 0 {
3180
 		}
3311
 		}
3181
 
3312
 
3182
 		//针对孝昌康桥超滤率计算问题
3313
 		//针对孝昌康桥超滤率计算问题
3183
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 {
3314
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10726 {
3184
 			if assessmentBeforeDislysis.ID == 0 {
3315
 			if assessmentBeforeDislysis.ID == 0 {
3185
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3316
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3186
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3317
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
7987
 
8118
 
7988
 	patientBefor, _ := service.GetPatientBefor(patient_id, startdateunix, user_org_id)
8119
 	patientBefor, _ := service.GetPatientBefor(patient_id, startdateunix, user_org_id)
7989
 
8120
 
8121
+	prescription, _ := service.GetDialysisPrescribeOneList(patient_id, startdateunix, user_org_id)
8122
+
7990
 	this.ServeSuccessJSON(map[string]interface{}{
8123
 	this.ServeSuccessJSON(map[string]interface{}{
7991
 		"patientBefor": patientBefor,
8124
 		"patientBefor": patientBefor,
8125
+		"prescription": prescription,
7992
 	})
8126
 	})
7993
 }
8127
 }

+ 9 - 2
controllers/mobile_api_controllers/check_weight_api_controller.go Ver arquivo

502
 					service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
502
 					service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
503
 				}
503
 				}
504
 			} else {
504
 			} else {
505
-				//插入透析处方
506
-				service.AddSigleRecord(&newprescribe)
505
+				//避免插入失败问题
506
+				if adminUserInfo.Org.Id == 10726 || adminUserInfo.Org.Id == 10121 {
507
+					//插入透析处方
508
+					service.AddSigleRecordOne(&newprescribe)
509
+				} else {
510
+					//插入透析处方
511
+					service.AddSigleRecord(&newprescribe)
512
+				}
513
+
507
 			}
514
 			}
508
 
515
 
509
 			//记录日志
516
 			//记录日志

+ 177 - 22
controllers/mobile_api_controllers/dialysis_api_controller.go Ver arquivo

1053
 
1053
 
1054
 		}
1054
 		}
1055
 
1055
 
1056
+		//针对溪康
1057
+		if adminUserInfo.Org.Id == 10721 {
1058
+
1059
+			adviceInfoList, _ := service.GetHisDoctorAdviceList(adminUserInfo.Org.Id, id, recordDate.Unix())
1060
+			if len(adviceInfoList) > 0 {
1061
+				for _, item := range adviceInfoList {
1062
+
1063
+					service.UpdateHisAdviceList(item.ID, creater)
1064
+					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1065
+					redis := service.RedisClient()
1066
+					//清空key 值
1067
+					redis.Set(key, "", time.Second)
1068
+					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1069
+					redis.Set(keyTwo, "", time.Second)
1070
+					theTime := time.Now()
1071
+					recordDate := theTime.Format("2006-01-02")
1072
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1073
+					redis.Set(keyFour, "", time.Second)
1074
+					defer redis.Close()
1075
+				}
1076
+			}
1077
+
1078
+			adviceList, _ := service.GetMobileDoctorAdviceList(adminUserInfo.Org.Id, id, recordDate.Unix())
1079
+			if len(adviceList) > 0 {
1080
+				for _, item := range adviceList {
1081
+					service.UpdateAdviceList(item.ID, creater)
1082
+					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1083
+					redis := service.RedisClient()
1084
+					//清空key 值
1085
+					redis.Set(key, "", time.Second)
1086
+					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1087
+					redis.Set(keyTwo, "", time.Second)
1088
+					theTime := time.Now()
1089
+					recordDate := theTime.Format("2006-01-02")
1090
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1091
+					redis.Set(keyFour, "", time.Second)
1092
+					defer redis.Close()
1093
+				}
1094
+			}
1095
+		}
1096
+
1056
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1097
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1057
 		redis := service.RedisClient()
1098
 		redis := service.RedisClient()
1058
 		//清空key 值
1099
 		//清空key 值
1112
 				}
1153
 				}
1113
 			}
1154
 			}
1114
 		}
1155
 		}
1156
+
1157
+		//针对溪康
1158
+		if adminUserInfo.Org.Id == 10721 {
1159
+
1160
+			adviceInfoList, _ := service.GetHisDoctorAdviceList(adminUserInfo.Org.Id, id, recordDate.Unix())
1161
+			if len(adviceInfoList) > 0 {
1162
+				for _, item := range adviceInfoList {
1163
+
1164
+					service.UpdateHisAdviceList(item.ID, creater)
1165
+					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1166
+					redis := service.RedisClient()
1167
+					//清空key 值
1168
+					redis.Set(key, "", time.Second)
1169
+					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1170
+					redis.Set(keyTwo, "", time.Second)
1171
+					theTime := time.Now()
1172
+					recordDate := theTime.Format("2006-01-02")
1173
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1174
+					redis.Set(keyFour, "", time.Second)
1175
+					defer redis.Close()
1176
+				}
1177
+			}
1178
+
1179
+			adviceList, _ := service.GetMobileDoctorAdviceList(adminUserInfo.Org.Id, id, recordDate.Unix())
1180
+			if len(adviceList) > 0 {
1181
+				for _, item := range adviceList {
1182
+					service.UpdateAdviceList(item.ID, creater)
1183
+					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
1184
+					redis := service.RedisClient()
1185
+					//清空key 值
1186
+					redis.Set(key, "", time.Second)
1187
+					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":advice_list_all"
1188
+					redis.Set(keyTwo, "", time.Second)
1189
+					theTime := time.Now()
1190
+					recordDate := theTime.Format("2006-01-02")
1191
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1192
+					redis.Set(keyFour, "", time.Second)
1193
+					defer redis.Close()
1194
+				}
1195
+			}
1196
+		}
1197
+
1115
 		err := service.UpdateDoubleCheck(&doubleCheck)
1198
 		err := service.UpdateDoubleCheck(&doubleCheck)
1116
 
1199
 
1117
 		//针对长沙南雅
1200
 		//针对长沙南雅
2046
 		service.ModifyScheduleMode(mode_id, id, recordDate.Unix(), adminUserInfo.Org.Id, str)
2129
 		service.ModifyScheduleMode(mode_id, id, recordDate.Unix(), adminUserInfo.Org.Id, str)
2047
 	}
2130
 	}
2048
 
2131
 
2132
+	goodList, _ := service.GetMobileGoodList(adminUserInfo.Org.Id)
2133
+
2134
+	var dialysis_dialyszers_id int64
2135
+	var dialysis_strainer_id int64
2136
+	var dialysis_irrigation_id int64
2137
+	if len(goodList) > 0 {
2138
+		for _, item := range goodList {
2139
+			if item.SpecificationName == dialysis_dialyszers {
2140
+				dialysis_dialyszers_id = item.ID
2141
+			}
2142
+			if item.SpecificationName == dialysis_irrigation {
2143
+				dialysis_irrigation_id = item.ID
2144
+			}
2145
+			if item.SpecificationName == dialysis_strainer {
2146
+				dialysis_strainer_id = item.ID
2147
+			}
2148
+		}
2149
+	}
2150
+
2049
 	//TODO 需要根据角色去判断
2151
 	//TODO 需要根据角色去判断
2050
 
2152
 
2051
 	prescription := models.DialysisPrescription{
2153
 	prescription := models.DialysisPrescription{
2157
 		BloodAccessPartId:          blood_access_part_id,
2259
 		BloodAccessPartId:          blood_access_part_id,
2158
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
2260
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
2159
 		Dialyzate:                  dialyzate,
2261
 		Dialyzate:                  dialyzate,
2262
+		DialysisDialyszersId:       dialysis_dialyszers_id,
2263
+		DialysisIrrigationId:       dialysis_irrigation_id,
2264
+		DialysisStrainerId:         dialysis_strainer_id,
2160
 	}
2265
 	}
2161
 
2266
 
2162
 	//查询最近透析准备表里是否存在 透析器 灌流器
2267
 	//查询最近透析准备表里是否存在 透析器 灌流器
4150
 		}
4255
 		}
4151
 	}
4256
 	}
4152
 
4257
 
4258
+	goodList, _ := service.GetMobileGoodList(adminUserInfo.Org.Id)
4259
+
4260
+	var dialysis_dialyszers_id int64
4261
+	var dialysis_strainer_id int64
4262
+	var dialysis_irrigation_id int64
4263
+	if len(goodList) > 0 {
4264
+		for _, item := range goodList {
4265
+			if item.SpecificationName == dialysis_dialyszers {
4266
+				dialysis_dialyszers_id = item.ID
4267
+			}
4268
+			if item.SpecificationName == dialysis_irrigation {
4269
+				dialysis_irrigation_id = item.ID
4270
+			}
4271
+			if item.SpecificationName == dialysis_strainer {
4272
+				dialysis_strainer_id = item.ID
4273
+			}
4274
+		}
4275
+	}
4276
+
4153
 	prescription := models.DialysisPrescription{
4277
 	prescription := models.DialysisPrescription{
4154
 
4278
 
4155
 		UserOrgId:          adminUserInfo.Org.Id,
4279
 		UserOrgId:          adminUserInfo.Org.Id,
4260
 		BloodAccessPartId:          blood_access_part_id,
4384
 		BloodAccessPartId:          blood_access_part_id,
4261
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4385
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4262
 		Dialyzate:                  dialyzate,
4386
 		Dialyzate:                  dialyzate,
4387
+		DialysisDialyszersId:       dialysis_dialyszers_id,
4388
+		DialysisIrrigationId:       dialysis_irrigation_id,
4389
+		DialysisStrainerId:         dialysis_strainer_id,
4263
 	}
4390
 	}
4264
 
4391
 
4265
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
4392
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
4389
 		BloodAccessPartId:          blood_access_part_id,
4516
 		BloodAccessPartId:          blood_access_part_id,
4390
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4517
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4391
 		Dialyzate:                  dialyzate,
4518
 		Dialyzate:                  dialyzate,
4519
+		DialysisDialyszersId:       dialysis_dialyszers_id,
4520
+		DialysisIrrigationId:       dialysis_irrigation_id,
4521
+		DialysisStrainerId:         dialysis_strainer_id,
4392
 	}
4522
 	}
4393
 
4523
 
4394
 	//针对河间咸的
4524
 	//针对河间咸的
11066
 
11196
 
11067
 	err := service.UpdateScheduleThree(sch, sch_two)
11197
 	err := service.UpdateScheduleThree(sch, sch_two)
11068
 
11198
 
11069
-	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
11199
+	order, _ := service.GetOneDialysisOrderOne(sch.UserOrgId, sch.ScheduleDate, sch.PatientId)
11070
 	if order.ID > 0 {
11200
 	if order.ID > 0 {
11071
-		//查询该患者的排班机位
11072
-		pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
11073
-		service.UpdateDialysiOrderByPatientId(id_two, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
11201
+		scheduleObj, _ := service.GetPatientScheduleByPatientId(sch.PatientId, sch.UserOrgId, sch.ScheduleDate)
11202
+		service.UpdateDialysiOrderByPatientId(order.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
11203
+		redis := service.RedisClient()
11204
+		key := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.PatientId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_order"
11205
+		redis.Set(key, "", time.Second)
11206
+		keyOne := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_orders_list_all"
11207
+
11208
+		//清空key 值
11209
+		redis.Set(keyOne, "", time.Second)
11210
+
11211
+	}
11212
+
11213
+	orderOne, _ := service.GetOneDialysisOrderOne(sch_two.UserOrgId, sch_two.ScheduleDate, sch_two.PatientId)
11214
+	if orderOne.ID > 0 {
11215
+		scheduleObj, _ := service.GetPatientScheduleByPatientId(sch_two.PatientId, sch_two.UserOrgId, sch_two.ScheduleDate)
11216
+		service.UpdateDialysiOrderByPatientId(orderOne.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
11074
 		redis := service.RedisClient()
11217
 		redis := service.RedisClient()
11075
 		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
11218
 		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
11076
 		redis.Set(key, "", time.Second)
11219
 		redis.Set(key, "", time.Second)
11077
 		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
11220
 		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
11078
-
11079
 		//清空key 值
11221
 		//清空key 值
11080
 		redis.Set(keyOne, "", time.Second)
11222
 		redis.Set(keyOne, "", time.Second)
11081
-		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
11082
-		//return
11223
+
11083
 	}
11224
 	}
11225
+
11084
 	if err == nil {
11226
 	if err == nil {
11085
 
11227
 
11086
 		//去除当天患者排班中重复数据,保留最后一条数据
11228
 		//去除当天患者排班中重复数据,保留最后一条数据
11123
 	}
11265
 	}
11124
 	sch_two, _ := service.GetScheduleTen(c.GetMobileAdminUserInfo().Org.Id, id_two)
11266
 	sch_two, _ := service.GetScheduleTen(c.GetMobileAdminUserInfo().Org.Id, id_two)
11125
 
11267
 
11126
-	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
11127
-	if order.ID > 0 {
11128
-
11129
-		service.UpdateDialysiOrderByPatientId(id_two, sch_two.ScheduleType, sch_two.PartitionId, sch_two.BedId)
11130
-		redis := service.RedisClient()
11131
-		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
11132
-		redis.Set(key, "", time.Second)
11133
-		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
11134
-
11135
-		//清空key 值
11136
-		redis.Set(keyOne, "", time.Second)
11137
-
11138
-		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
11139
-		//return
11140
-	}
11141
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
11268
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
11142
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
11269
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
11143
 		count, _ := service.GetScheduleCountByDate(c.GetMobileAdminUserInfo().Org.Id, sch_two.ScheduleDate, sch.PatientId)
11270
 		count, _ := service.GetScheduleCountByDate(c.GetMobileAdminUserInfo().Org.Id, sch_two.ScheduleDate, sch.PatientId)
11160
 	//生成新的排班
11287
 	//生成新的排班
11161
 	if err == nil {
11288
 	if err == nil {
11162
 		err2 := service.SaveSch(&new_sch)
11289
 		err2 := service.SaveSch(&new_sch)
11290
+
11291
+		order, _ := service.GetOneDialysisOrderOne(sch.UserOrgId, sch.ScheduleDate, sch.PatientId)
11292
+		if order.ID > 0 {
11293
+			scheduleObj, _ := service.GetPatientScheduleByPatientId(sch.PatientId, sch.UserOrgId, sch.ScheduleDate)
11294
+			service.UpdateDialysiOrderByPatientId(order.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
11295
+			redis := service.RedisClient()
11296
+			key := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.PatientId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_order"
11297
+			redis.Set(key, "", time.Second)
11298
+			keyOne := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_orders_list_all"
11299
+
11300
+			//清空key 值
11301
+			redis.Set(keyOne, "", time.Second)
11302
+
11303
+		}
11304
+
11305
+		orderOne, _ := service.GetOneDialysisOrderOne(sch_two.UserOrgId, sch_two.ScheduleDate, sch_two.PatientId)
11306
+		if orderOne.ID > 0 {
11307
+			scheduleObj, _ := service.GetPatientScheduleByPatientId(sch_two.PatientId, sch_two.UserOrgId, sch_two.ScheduleDate)
11308
+			service.UpdateDialysiOrderByPatientId(orderOne.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
11309
+			redis := service.RedisClient()
11310
+			key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
11311
+			redis.Set(key, "", time.Second)
11312
+			keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
11313
+			//清空key 值
11314
+			redis.Set(keyOne, "", time.Second)
11315
+
11316
+		}
11317
+
11163
 		if err2 == nil {
11318
 		if err2 == nil {
11164
 			//去除当天患者排班中重复数据,保留最后一条数据
11319
 			//去除当天患者排班中重复数据,保留最后一条数据
11165
 			service.UpdateRepeatSchStatus(sch.UserOrgId, sch.ScheduleDate)
11320
 			service.UpdateRepeatSchStatus(sch.UserOrgId, sch.ScheduleDate)

+ 1 - 1
controllers/mobile_api_controllers/patient_api_controller.go Ver arquivo

4207
 	}
4207
 	}
4208
 
4208
 
4209
 	//针对孝昌康桥超滤率计算问题
4209
 	//针对孝昌康桥超滤率计算问题
4210
-	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 {
4210
+	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 {
4211
 		if evaluation.ID == 0 {
4211
 		if evaluation.ID == 0 {
4212
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4212
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4213
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4213
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {

+ 32 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Ver arquivo

1327
 
1327
 
1328
 }
1328
 }
1329
 func (c *StaffScheduleApiController) ChangeScheduleBed() {
1329
 func (c *StaffScheduleApiController) ChangeScheduleBed() {
1330
+
1331
+	fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
1330
 	schedule_type, _ := c.GetInt64("schedule_type")
1332
 	schedule_type, _ := c.GetInt64("schedule_type")
1331
 	schedule_date, _ := c.GetInt64("schedule_date")
1333
 	schedule_date, _ := c.GetInt64("schedule_date")
1332
 	patient_id, _ := c.GetInt64("patient_id")
1334
 	patient_id, _ := c.GetInt64("patient_id")
1444
 			}
1446
 			}
1445
 		}
1447
 		}
1446
 
1448
 
1449
+		orderOne, _ := service.GetOneDialysisOrderOne(org_id, schedule_date, patient_id)
1450
+
1451
+		fmt.Println("orderOne[[[[[[[[[[[[[[[[[[[[[[[", orderOne)
1452
+		if orderOne.ID > 0 {
1453
+			scheduleObj, _ := service.GetPatientScheduleByPatientId(patient_id, org_id, schedule_date)
1454
+			service.UpdateDialysiOrderByPatientId(orderOne.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
1455
+			redis := service.RedisClient()
1456
+			key := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(schedule_date, 10) + ":dialysis_order"
1457
+			redis.Set(key, "", time.Second)
1458
+			keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule_date, 10) + ":dialysis_orders_list_all"
1459
+
1460
+			//清空key 值
1461
+			redis.Set(keyOne, "", time.Second)
1462
+
1463
+		}
1464
+
1447
 		//if org_id == 10206 || org_id == 10344 {
1465
 		//if org_id == 10206 || org_id == 10344 {
1448
 		//	hisAdvice, _ := service.GetHisDoctorAdviceListTwenty(scheduleToday.PatientId, scheduleToday.ScheduleDate, org_id)
1466
 		//	hisAdvice, _ := service.GetHisDoctorAdviceListTwenty(scheduleToday.PatientId, scheduleToday.ScheduleDate, org_id)
1449
 		//	project, _ := service.GetHisPrescriptionProjectList(scheduleToday.PatientId, scheduleToday.ScheduleDate, org_id)
1467
 		//	project, _ := service.GetHisPrescriptionProjectList(scheduleToday.PatientId, scheduleToday.ScheduleDate, org_id)
1494
 		var err error
1512
 		var err error
1495
 		err = service.CreateSchedule(&xtSchedule, id)
1513
 		err = service.CreateSchedule(&xtSchedule, id)
1496
 		service.UpdateRepeatSchStatus(org_id, schedule_date)
1514
 		service.UpdateRepeatSchStatus(org_id, schedule_date)
1515
+
1516
+		order, _ := service.GetOneDialysisOrderOne(org_id, schedule_date, patient_id)
1517
+		if order.ID > 0 {
1518
+			scheduleObj, _ := service.GetPatientScheduleByPatientId(patient_id, org_id, schedule_date)
1519
+			service.UpdateDialysiOrderByPatientId(order.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
1520
+			redis := service.RedisClient()
1521
+			key := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(schedule_date, 10) + ":dialysis_order"
1522
+			redis.Set(key, "", time.Second)
1523
+			keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule_date, 10) + ":dialysis_orders_list_all"
1524
+
1525
+			//清空key 值
1526
+			redis.Set(keyOne, "", time.Second)
1527
+
1528
+		}
1497
 		//记录日志
1529
 		//记录日志
1498
 		byterequest, _ := json.Marshal(schedule)
1530
 		byterequest, _ := json.Marshal(schedule)
1499
 		scheduleLog := models.XtScheduleLog{
1531
 		scheduleLog := models.XtScheduleLog{

+ 35 - 4
controllers/pharmacy_controller.go Ver arquivo

212
 			flist = append(flist, patientlist)
212
 			flist = append(flist, patientlist)
213
 		}
213
 		}
214
 	}
214
 	}
215
+
216
+	listTwo, _ := service.GetTodayAdviceCountTwo(stime, etime, orgid, 1)
217
+
218
+	var vlist []*models.HisDoctorAdviceInfo
219
+	if len(listTwo) > 0 {
220
+		for _, item := range listTwo {
221
+			//查询该患者是否有排班
222
+			scheduleList, _ := service.GetPatientAdviceScheduleByPatient(item.PatientId, item.UserOrgId, item.AdviceDate)
223
+			if len(scheduleList) == 0 {
224
+				vlist = append(vlist, item)
225
+			}
226
+		}
227
+	}
215
 	this.ServeSuccessJSON(map[string]interface{}{
228
 	this.ServeSuccessJSON(map[string]interface{}{
216
-		"list": flist,
229
+		"list":    flist,
230
+		"listTwo": vlist,
217
 	})
231
 	})
218
 
232
 
219
 	//if orgid != 10164 && orgid == 3877 && orgid != 10188 && orgid != 10217 && orgid != 9671 && orgid != 10387 && orgid != 10375 && orgid != 10480 && orgid == 10344 {
233
 	//if orgid != 10164 && orgid == 3877 && orgid != 10188 && orgid != 10217 && orgid != 9671 && orgid != 10387 && orgid != 10375 && orgid != 10480 && orgid == 10344 {
275
 	var patientsId []int64
289
 	var patientsId []int64
276
 
290
 
277
 	patient, _ := service.GetPatientKeyWord(keyword, orgid)
291
 	patient, _ := service.GetPatientKeyWord(keyword, orgid)
278
-	fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", patient)
292
+
279
 	if len(patient) > 0 {
293
 	if len(patient) > 0 {
280
 		for _, item := range patient {
294
 		for _, item := range patient {
281
 			patientsId = append(patientsId, item.ID)
295
 			patientsId = append(patientsId, item.ID)
292
 
306
 
293
 	list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
307
 	list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
294
 
308
 
309
+	listTwo, _ := service.GetTodayAdviceCountTwo(stime, etime, orgid, 0)
310
+
311
+	var vlist []*models.HisDoctorAdviceInfo
312
+	if len(listTwo) > 0 {
313
+		for _, item := range listTwo {
314
+			//查询该患者是否有排班
315
+			scheduleList, _ := service.GetPatientAdviceScheduleByPatient(item.PatientId, item.UserOrgId, item.AdviceDate)
316
+			if len(scheduleList) == 0 {
317
+				vlist = append(vlist, item)
318
+			}
319
+		}
320
+	}
321
+
322
+	patientList, _ := service.GetAllpatient(orgid)
323
+
295
 	var flist []models.TmpPatientOne
324
 	var flist []models.TmpPatientOne
296
 	if len(list) > 0 {
325
 	if len(list) > 0 {
297
 		for _, item := range list {
326
 		for _, item := range list {
301
 	}
330
 	}
302
 	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
331
 	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
303
 	this.ServeSuccessJSON(map[string]interface{}{
332
 	this.ServeSuccessJSON(map[string]interface{}{
304
-		"list":     flist,
305
-		"baseList": baseList,
333
+		"list":        flist,
334
+		"baseList":    baseList,
335
+		"listTwo":     vlist,
336
+		"patientList": patientList,
306
 	})
337
 	})
307
 	return
338
 	return
308
 
339
 

+ 41 - 10
controllers/schedule_api_controller.go Ver arquivo

125
 	//}
125
 	//}
126
 	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
126
 	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
127
 	if order.ID > 0 {
127
 	if order.ID > 0 {
128
+		scheduleObj, _ := service.GetPatientScheduleByPatientId(sch.PatientId, sch.UserOrgId, sch.ScheduleDate)
129
+		service.UpdateDialysiOrderByPatientId(order.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
130
+		redis := service.RedisClient()
131
+		key := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.PatientId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_order"
132
+		redis.Set(key, "", time.Second)
133
+		keyOne := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_orders_list_all"
134
+
135
+		//清空key 值
136
+		redis.Set(keyOne, "", time.Second)
137
+
138
+	}
128
 
139
 
129
-		service.UpdateDialysiOrderByPatientId(id_two, sch_two.ScheduleType, sch_two.PartitionId, sch_two.BedId)
140
+	orderOne, _ := service.GetOneDialysisOrderOne(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
141
+	if orderOne.ID > 0 {
142
+		scheduleObj, _ := service.GetPatientScheduleByPatientId(sch_two.PatientId, sch_two.UserOrgId, sch_two.ScheduleDate)
143
+		service.UpdateDialysiOrderByPatientId(order.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
130
 		redis := service.RedisClient()
144
 		redis := service.RedisClient()
131
 		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
145
 		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
132
 		redis.Set(key, "", time.Second)
146
 		redis.Set(key, "", time.Second)
133
 		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
147
 		keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
134
-
135
 		//清空key 值
148
 		//清空key 值
136
 		redis.Set(keyOne, "", time.Second)
149
 		redis.Set(keyOne, "", time.Second)
137
 
150
 
138
-		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
139
-		//return
140
 	}
151
 	}
141
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
152
 	//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
142
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
153
 	if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
208
 
219
 
209
 	err := service.UpdateScheduleThree(sch, sch_two)
220
 	err := service.UpdateScheduleThree(sch, sch_two)
210
 
221
 
211
-	order, _ := service.GetOneDialysisOrderOne(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
222
+	fmt.Println("id_one======================", sch.PatientId)
223
+	fmt.Println("id_one======================", sch_two.PatientId)
224
+	order, _ := service.GetOneDialysisOrderOne(sch.UserOrgId, sch.ScheduleDate, sch.PatientId)
212
 	if order.ID > 0 {
225
 	if order.ID > 0 {
213
 		//查询该患者的排班机位
226
 		//查询该患者的排班机位
214
 		pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
227
 		pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
215
-		service.UpdateDialysiOrderByPatientId(id_two, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
228
+		service.UpdateDialysiOrderByPatientId(order.ID, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
229
+		redis := service.RedisClient()
230
+		key := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.PatientId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_order"
231
+		redis.Set(key, "", time.Second)
232
+		keyOne := strconv.FormatInt(sch.UserOrgId, 10) + ":" + strconv.FormatInt(sch.ScheduleDate, 10) + ":dialysis_orders_list_all"
233
+
234
+		//清空key 值
235
+		redis.Set(keyOne, "", time.Second)
236
+		//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
237
+		//return
238
+	}
239
+
240
+	orderOne, _ := service.GetOneDialysisOrderOne(sch_two.UserOrgId, sch_two.ScheduleDate, sch_two.PatientId)
241
+	if orderOne.ID > 0 {
242
+		//查询该患者的排班机位
243
+		pSchedule, _ := service.GetPscheduleDate(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
244
+		service.UpdateDialysiOrderByPatientId(orderOne.ID, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
216
 		redis := service.RedisClient()
245
 		redis := service.RedisClient()
217
 		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
246
 		key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
218
 		redis.Set(key, "", time.Second)
247
 		redis.Set(key, "", time.Second)
1736
 	tm := time.Unix(int64(schedule_two.ScheduleDate), 0)
1765
 	tm := time.Unix(int64(schedule_two.ScheduleDate), 0)
1737
 	timeStr := tm.Format(timeTemplate)
1766
 	timeStr := tm.Format(timeTemplate)
1738
 	if timeNow > timeStr {
1767
 	if timeNow > timeStr {
1739
-		fmt.Println("寄哪里地方")
1740
 		utils.ErrorLog(timeNow)
1768
 		utils.ErrorLog(timeNow)
1741
 		utils.ErrorLog(timeStr)
1769
 		utils.ErrorLog(timeStr)
1742
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleBeforeNow)
1770
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCantSetScheduleBeforeNow)
1955
 
1983
 
1956
 	//查询上机床位号 更改床位号
1984
 	//查询上机床位号 更改床位号
1957
 	order, err := service.GetOneDialysisOrderOne(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1985
 	order, err := service.GetOneDialysisOrderOne(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
1958
-	fmt.Println("errw222222222222222222", order.ID)
1986
+
1987
+	scheduleObj, _ := service.GetPatientScheduleByPatientId(patientID, adminUserInfo.CurrentOrgId, schedule_two.ScheduleDate)
1959
 	if order.ID > 0 {
1988
 	if order.ID > 0 {
1960
-		service.UpdateDialysiOrderByPatientId(order.ID, schedule.ScheduleType, schedule.PartitionId, order.BedID)
1989
+		service.UpdateDialysiOrderByPatientId(order.ID, scheduleObj.ScheduleType, scheduleObj.PartitionId, scheduleObj.BedId)
1990
+
1961
 		redis := service.RedisClient()
1991
 		redis := service.RedisClient()
1962
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_order"
1992
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_order"
1963
 		redis.Set(key, "", time.Second)
1993
 		redis.Set(key, "", time.Second)
1964
 		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1994
 		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
1965
-
1966
 		//清空key 值
1995
 		//清空key 值
1967
 		redis.Set(keyOne, "", time.Second)
1996
 		redis.Set(keyOne, "", time.Second)
1997
+		keySix := "scheduals_" + timeNow + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1998
+		redis.Set(keySix, "", time.Second)
1968
 
1999
 
1969
 	}
2000
 	}
1970
 
2001
 

+ 32 - 3
controllers/sign_api_controller.go Ver arquivo

1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1262
 	//}
1262
 	//}
1263
 
1263
 
1264
-	list, _ := service.GetAllDialysisPrescription(29190)
1264
+	//list, _ := service.GetAllDialysisPrescription(29190)
1265
+	//
1266
+	//for _, item := range list {
1267
+	//	service.UpdateSchedulePrescrition(item.PatientId, item.RecordDate, item.UserOrgId, item.ModeId)
1268
+	//}
1265
 
1269
 
1266
-	for _, item := range list {
1267
-		service.UpdateSchedulePrescrition(item.PatientId, item.RecordDate, item.UserOrgId, item.ModeId)
1270
+	//list, _ := service.GetPatientLapseList()
1271
+	//
1272
+	//fmt.Println(list)
1273
+	//if len(list) > 0 {
1274
+	//	for _, items := range list {
1275
+	//		schedulelist, _ := service.GetPatientScheduleListByItem(items.ID)
1276
+	//		if len(schedulelist) < 2 {
1277
+	//			for _, it := range schedulelist {
1278
+	//				orderList, _ := service.GetAllDialysisOrder(it.PatientId, 1731254400, 1731254400)
1279
+	//				for _, item := range orderList {
1280
+	//					schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, item.UserOrgId, item.BedId, item.ZoneId, item.SchedualType)
1281
+	//					prescribeOne, _ := service.GetDialysisPrescribeOne(item.UserOrgId, item.PatientId, item.DialysisDate)
1282
+	//					service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, item.UserOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID, prescribeOne.ModeId)
1283
+	//				}
1284
+	//
1285
+	//			}
1286
+	//		}
1287
+	//	}
1288
+	//}
1289
+
1290
+	adviceList, _ := service.GetHisDoctorAdviceNoCheck(10721)
1291
+
1292
+	if len(adviceList) > 0 {
1293
+		for _, item := range adviceList {
1294
+			checkObj, _ := service.GetDobuleCheckOne(item.UserOrgId, item.AdviceDate, item.PatientId)
1295
+			service.UpdateHisAdvice(item.PatientId, item.AdviceDate, item.UserOrgId, checkObj.Creater, checkObj.CheckDate)
1296
+		}
1268
 	}
1297
 	}
1269
 
1298
 
1270
 	this.ServeSuccessJSON(map[string]interface{}{
1299
 	this.ServeSuccessJSON(map[string]interface{}{

+ 1 - 0
models/his_models.go Ver arquivo

276
 	YbSyncStatus          int64                  `gorm:"column:yb_sync_status" json:"yb_sync_status" form:"yb_sync_status"`
276
 	YbSyncStatus          int64                  `gorm:"column:yb_sync_status" json:"yb_sync_status" form:"yb_sync_status"`
277
 	DrugCode              string                 `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
277
 	DrugCode              string                 `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
278
 	IsUpload              int64                  `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
278
 	IsUpload              int64                  `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
279
+	Patient               Patients               `gorm:"ForeignKey:ID;AssociationForeignKey:PatientId" json:"patient"`
279
 }
280
 }
280
 
281
 
281
 func (HisDoctorAdviceInfo) TableName() string {
282
 func (HisDoctorAdviceInfo) TableName() string {

+ 6 - 0
models/patient_models.go Ver arquivo

386
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
386
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
387
 	AnticoagulantWeichiHour    string        `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
387
 	AnticoagulantWeichiHour    string        `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
388
 	Dialyzate                  string        `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
388
 	Dialyzate                  string        `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
389
+	DialysisDialyszersId       int64         `gorm:"column:dialysis_dialyszers_id" json:"dialysis_dialyszers_id" form:"dialysis_dialyszers_id"`
390
+	DialysisStrainerId         int64         `gorm:"column:dialysis_strainer_id" json:"dialysis_strainer_id" form:"dialysis_strainer_id"`
391
+	DialysisIrrigationId       int64         `gorm:"column:dialysis_irrigation_id" json:"dialysis_irrigation_id" form:"dialysis_irrigation_id"`
389
 }
392
 }
390
 
393
 
391
 func (DialysisPrescription) TableName() string {
394
 func (DialysisPrescription) TableName() string {
626
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
629
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
627
 	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
630
 	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
628
 	Dialyzate                  string  `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
631
 	Dialyzate                  string  `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
632
+	DialysisDialyszersId       int64   `gorm:"column:dialysis_dialyszers_id" json:"dialysis_dialyszers_id" form:"dialysis_dialyszers_id"`
633
+	DialysisStrainerId         int64   `gorm:"column:dialysis_strainer_id" json:"dialysis_strainer_id" form:"dialysis_strainer_id"`
634
+	DialysisIrrigationId       int64   `gorm:"column:dialysis_irrigation_id" json:"dialysis_irrigation_id" form:"dialysis_irrigation_id"`
629
 }
635
 }
630
 
636
 
631
 func (DialysisSolution) TableName() string {
637
 func (DialysisSolution) TableName() string {

+ 16 - 1
service/dialysis_service.go Ver arquivo

223
 	return errors
223
 	return errors
224
 }
224
 }
225
 
225
 
226
+func AddSigleRecordOne(prescription *models.DialysisPrescription) (err error) {
227
+
228
+	errors := XTWriteDB().Model(&models.DialysisPrescription{}).Create(&prescription).Error
229
+	return errors
230
+}
231
+
226
 func UpdateAddSigleRecord(id int64, target_ultrafiltration float64) error {
232
 func UpdateAddSigleRecord(id int64, target_ultrafiltration float64) error {
227
 
233
 
228
 	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"target_ultrafiltration": target_ultrafiltration, "prescription_water": target_ultrafiltration}).Error
234
 	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"target_ultrafiltration": target_ultrafiltration, "prescription_water": target_ultrafiltration}).Error
1094
 	return order, err
1100
 	return order, err
1095
 }
1101
 }
1096
 
1102
 
1103
+func GetPatientScheduleByPatientId(patient_id int64, user_org_id int64, schedule_date int64) (models.XtSchedule, error) {
1104
+
1105
+	schedule := models.XtSchedule{}
1106
+
1107
+	err := XTReadDB().Where("patient_id = ? and user_org_id = ? and schedule_date = ? and status=1", patient_id, user_org_id, schedule_date).Find(&schedule).Error
1108
+
1109
+	return schedule, err
1110
+}
1111
+
1097
 func GetPscheduleDate(schedule_date int64, patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1112
 func GetPscheduleDate(schedule_date int64, patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1098
 
1113
 
1099
 	schedule := models.XtSchedule{}
1114
 	schedule := models.XtSchedule{}
1100
 
1115
 
1101
-	err := XTReadDB().Where("schedule_date = ? and patient_id = ? and user_org_id =? and status =1").Find(&schedule).Error
1116
+	err := XTReadDB().Where("schedule_date = ? and patient_id = ? and user_org_id =? and status =1", schedule_date, patient_id, user_org_id).Find(&schedule).Error
1102
 
1117
 
1103
 	return schedule, err
1118
 	return schedule, err
1104
 }
1119
 }

+ 15 - 0
service/patient_service.go Ver arquivo

3286
 	return check, err
3286
 	return check, err
3287
 }
3287
 }
3288
 
3288
 
3289
+func GetDobuleCheckOne(user_org_id int64, advice_date int64, patient_id int64) (check models.VmDoubleCheck, err error) {
3290
+
3291
+	err = XTReadDB().Where("user_org_id = ? and check_date = ? and status = 1 and patient_id = ?", user_org_id, advice_date, patient_id).Find(&check).Error
3292
+	return check, err
3293
+}
3294
+
3289
 func GetTreatmentSummaryForList(user_org_id int64, advice_date int64) (summary []*models.VMTreatmentSummaryForList, err error) {
3295
 func GetTreatmentSummaryForList(user_org_id int64, advice_date int64) (summary []*models.VMTreatmentSummaryForList, err error) {
3290
 
3296
 
3291
 	err = XTReadDB().Where("user_org_id =? and assessment_date = ? and status =1", user_org_id, advice_date).Find(&summary).Error
3297
 	err = XTReadDB().Where("user_org_id =? and assessment_date = ? and status =1", user_org_id, advice_date).Find(&summary).Error
4340
 
4346
 
4341
 	return beforeDislysis, err
4347
 	return beforeDislysis, err
4342
 }
4348
 }
4349
+
4350
+func GetDialysisPrescribeOneList(patient_id int64, record_date int64, user_org_id int64) (models.DialysisPrescription, error) {
4351
+
4352
+	prescription := models.DialysisPrescription{}
4353
+
4354
+	err := XTReadDB().Where("patient_id = ? and record_date= ? and user_org_id = ? and status=1", patient_id, record_date, user_org_id).Find(&prescription).Error
4355
+
4356
+	return prescription, err
4357
+}

+ 23 - 0
service/pharmacy_service.go Ver arquivo

173
 	return advice, err
173
 	return advice, err
174
 }
174
 }
175
 
175
 
176
+func GetTodayAdviceCountTwo(stime int64, etime int64, orgid int64, is_medicine int64) (advice []*models.HisDoctorAdviceInfo, err error) {
177
+
178
+	db := XTReadDB().Model(&advice).Where("status=1 and is_medicine = ?", is_medicine)
179
+	if stime > 0 {
180
+		db = db.Where("advice_date>=?", stime)
181
+	}
182
+	if etime > 0 {
183
+		db = db.Where("advice_date<=?", stime)
184
+	}
185
+	if orgid > 0 {
186
+		db = db.Where("user_org_id = ?", orgid)
187
+	}
188
+	err = db.Preload("Patient", "user_org_id = ? and status=1", orgid).Group("patient_id").Find(&advice).Error
189
+	return advice, err
190
+}
191
+
192
+func GetPatientAdviceScheduleByPatient(patient_id int64, user_org_id int64, advice_date int64) (list []*models.XtSchedule, err error) {
193
+
194
+	err = XTReadDB().Where("patient_id= ? and user_org_id = ? and schedule_date = ? and status=1", patient_id, user_org_id, advice_date).Find(&list).Error
195
+
196
+	return list, err
197
+}
198
+
176
 func GetPatientByAdviceId(patient_id int64) (models.TmpPatientOne, error) {
199
 func GetPatientByAdviceId(patient_id int64) (models.TmpPatientOne, error) {
177
 
200
 
178
 	patient := models.TmpPatientOne{}
201
 	patient := models.TmpPatientOne{}

+ 24 - 0
service/schedule_service.go Ver arquivo

1520
 	return adviceInfo, err
1520
 	return adviceInfo, err
1521
 }
1521
 }
1522
 
1522
 
1523
+func GetMobileDoctorAdviceList(org_id int64, patient_id int64, dialysis_date int64) (advice []*models.DoctorAdvice, err error) {
1524
+
1525
+	err = XTReadDB().Where("patient_id=? and user_org_id = ? and advice_date= ? and status=1 and advice_type =2", patient_id, org_id, dialysis_date).Find(&advice).Error
1526
+
1527
+	return advice, err
1528
+}
1529
+
1530
+func UpdateHisAdviceList(id int64, creater int64) (models.HisDoctorAdvice, error) {
1531
+
1532
+	doctorAdvice := models.HisDoctorAdvice{}
1533
+	err := XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"checker": creater, "check_state": 1, "check_time": time.Now().Unix()}).Error
1534
+
1535
+	return doctorAdvice, err
1536
+}
1537
+
1538
+func UpdateAdviceList(id int64, creater int64) (models.DoctorAdvice, error) {
1539
+
1540
+	advice := models.DoctorAdvice{}
1541
+
1542
+	err := XTWriteDB().Model(&models.DoctorAdvice{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"checker": creater, "check_state": 1, "check_time": time.Now().Unix()}).Error
1543
+
1544
+	return advice, err
1545
+}
1546
+
1523
 func GetDoctorAdviceListSchedule(org_id int64, patient_id int64) (advices []*models.DoctorAdvice, err error) {
1547
 func GetDoctorAdviceListSchedule(org_id int64, patient_id int64) (advices []*models.DoctorAdvice, err error) {
1524
 
1548
 
1525
 	err = XTReadDB().Where("patient_id=? and user_org_id = ?  and status=1 and parent_id=0 and advice_type =1", patient_id, org_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advices).Error
1549
 	err = XTReadDB().Where("patient_id=? and user_org_id = ?  and status=1 and parent_id=0 and advice_type =1", patient_id, org_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advices).Error

+ 33 - 1
service/sign_service.go Ver arquivo

2123
 
2123
 
2124
 	return list, err
2124
 	return list, err
2125
 }
2125
 }
2126
+
2127
+func GetPatientLapseList() (list []*models.XtPatients, err error) {
2128
+
2129
+	err = XTReadDB().Where("(lapseto =2 or lapseto =3) and status=1 and user_org_id !=10503 and user_org_id !=10447").Find(&list).Error
2130
+
2131
+	return list, err
2132
+}
2133
+
2134
+func GetHisDoctorAdviceNoCheck(user_org_id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2135
+
2136
+	err = XTReadDB().Where("user_org_id = ? and status=1 and checker = 0", user_org_id).Find(&advice).Error
2137
+
2138
+	return advice, err
2139
+}
2140
+
2141
+func UpdateHisAdvice(patient_id int64, advice_date int64, user_org_id int64, creater int64, check_date int64) (models.HisDoctorAdviceInfo, error) {
2142
+
2143
+	adviceInfo := models.HisDoctorAdviceInfo{}
2144
+
2145
+	err := XTWriteDB().Model(&adviceInfo).Where("patient_id = ? and advice_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"checker": creater, "check_state": 1, "check_time": check_date}).Error
2146
+
2147
+	return adviceInfo, err
2148
+}
2149
+
2150
+func GetPatientScheduleListByItem(patient_id int64) (list []*models.XtSchedule, err error) {
2151
+
2152
+	err = XTReadDB().Where("patient_id = ? and status=1", patient_id).Find(&list).Error
2153
+
2154
+	return list, err
2155
+
2156
+}
2157
+
2126
 func UpdateSchedulePrescrition(patient_id int64, record_date int64, user_org_id int64, mode_id int64) (models.XtSchedule, error) {
2158
 func UpdateSchedulePrescrition(patient_id int64, record_date int64, user_org_id int64, mode_id int64) (models.XtSchedule, error) {
2127
 
2159
 
2128
 	schedule := models.XtSchedule{}
2160
 	schedule := models.XtSchedule{}
2134
 
2166
 
2135
 func GetAllDialysisOrder(patient_id int64, start_time int64, end_time int64) (list []*models.XtDialysisOrder, err error) {
2167
 func GetAllDialysisOrder(patient_id int64, start_time int64, end_time int64) (list []*models.XtDialysisOrder, err error) {
2136
 
2168
 
2137
-	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1541001600 and dialysis_date<=?", patient_id, end_time).Find(&list).Error
2169
+	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1199116800 and dialysis_date<=?", patient_id, end_time).Find(&list).Error
2138
 
2170
 
2139
 	return list, err
2171
 	return list, err
2140
 }
2172
 }

+ 7 - 0
service/stock_service.go Ver arquivo

7333
 	return good, err
7333
 	return good, err
7334
 }
7334
 }
7335
 
7335
 
7336
+func GetMobileGoodList(org_id int64) (list []*models.GoodInformationThirty, err error) {
7337
+
7338
+	err = XTReadDB().Where("org_id = ? and status =1", org_id).Find(&list).Error
7339
+
7340
+	return list, err
7341
+}
7342
+
7336
 func GetAllMobileProjectList(orgid int64) (project []*models.HisProject, err error) {
7343
 func GetAllMobileProjectList(orgid int64) (project []*models.HisProject, err error) {
7337
 
7344
 
7338
 	err = XTReadDB().Where("user_org_id =? and status =1", orgid).Find(&project).Error
7345
 	err = XTReadDB().Where("user_org_id =? and status =1", orgid).Find(&project).Error