28169 пре 2 година
родитељ
комит
9b31fe2c3f

+ 20 - 8
controllers/dialysis_api_controller.go Прегледај датотеку

448
 
448
 
449
 	//长沙南雅医院,自动生成抗凝剂的临时处方
449
 	//长沙南雅医院,自动生成抗凝剂的临时处方
450
 	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
450
 	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
451
+		if prescribing_number == 0 {
452
+			prescribing_number = 1
453
+		}
451
 		advice := models.DoctorAdvice{
454
 		advice := models.DoctorAdvice{
452
 			UserOrgId:             adminUserInfo.CurrentOrgId,
455
 			UserOrgId:             adminUserInfo.CurrentOrgId,
453
 			PatientId:             patient,
456
 			PatientId:             patient,
455
 			AdviceType:            2,
458
 			AdviceType:            2,
456
 			RecordDate:            recordDate.Unix(),
459
 			RecordDate:            recordDate.Unix(),
457
 			AdviceDate:            recordDate.Unix(),
460
 			AdviceDate:            recordDate.Unix(),
458
-			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
459
-			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
461
+			StartTime:             recordDate.Unix() + 6.5*60*60, // 根据排班班次,给默认时间
462
+			AdviceName:            "",                            // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
460
 			AdviceDesc:            "",
463
 			AdviceDesc:            "",
461
 			ReminderDate:          0,
464
 			ReminderDate:          0,
462
 			SingleDose:            5000,
465
 			SingleDose:            5000,
472
 			CreatedTime:           time.Now().Unix(),
475
 			CreatedTime:           time.Now().Unix(),
473
 			UpdatedTime:           time.Now().Unix(),
476
 			UpdatedTime:           time.Now().Unix(),
474
 			IsPrescription:        1,
477
 			IsPrescription:        1,
478
+			ExecutionState:        2,
479
+			StopState:             2,
480
+			IsSettle:              2,
475
 		}
481
 		}
476
 		// 查询排班信息
482
 		// 查询排班信息
477
 		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
483
 		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
478
 		if schedulePatient.ID > 0 {
484
 		if schedulePatient.ID > 0 {
479
 			if schedulePatient.ScheduleType == 1 {
485
 			if schedulePatient.ScheduleType == 1 {
480
-				advice.StartTime = recordDate.Unix() + 7*60*60
486
+				advice.StartTime = recordDate.Unix() + 6.5*60*60
481
 			}
487
 			}
482
 
488
 
483
 			if schedulePatient.ScheduleType == 2 {
489
 			if schedulePatient.ScheduleType == 2 {
525
 		}
531
 		}
526
 		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
532
 		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
527
 
533
 
528
-		if appRole.UserType == 2 || appRole.UserType == 1 {
534
+		if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 3 {
529
 			advice.AdviceDoctor = appRole.AdminUserId
535
 			advice.AdviceDoctor = appRole.AdminUserId
530
 		}
536
 		}
531
 
537
 
1162
 
1168
 
1163
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1169
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1164
 	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
1170
 	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
1171
+		if prescribing_number == 0 {
1172
+			prescribing_number = 1
1173
+		}
1165
 		advice := models.DoctorAdvice{
1174
 		advice := models.DoctorAdvice{
1166
 			UserOrgId:             adminUserInfo.CurrentOrgId,
1175
 			UserOrgId:             adminUserInfo.CurrentOrgId,
1167
 			PatientId:             patient,
1176
 			PatientId:             patient,
1169
 			AdviceType:            2,
1178
 			AdviceType:            2,
1170
 			RecordDate:            recordDate.Unix(),
1179
 			RecordDate:            recordDate.Unix(),
1171
 			AdviceDate:            recordDate.Unix(),
1180
 			AdviceDate:            recordDate.Unix(),
1172
-			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
1173
-			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
1181
+			StartTime:             recordDate.Unix() + 6.5*60*60, // 根据排班班次,给默认时间
1182
+			AdviceName:            "",                            // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
1174
 			AdviceDesc:            "",
1183
 			AdviceDesc:            "",
1175
 			ReminderDate:          0,
1184
 			ReminderDate:          0,
1176
 			SingleDose:            5000,
1185
 			SingleDose:            5000,
1186
 			CreatedTime:           time.Now().Unix(),
1195
 			CreatedTime:           time.Now().Unix(),
1187
 			UpdatedTime:           time.Now().Unix(),
1196
 			UpdatedTime:           time.Now().Unix(),
1188
 			IsPrescription:        1,
1197
 			IsPrescription:        1,
1198
+			ExecutionState:        2,
1199
+			StopState:             2,
1200
+			IsSettle:              2,
1189
 		}
1201
 		}
1190
 		// 查询排班信息
1202
 		// 查询排班信息
1191
 		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1203
 		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1192
 		if schedulePatient.ID > 0 {
1204
 		if schedulePatient.ID > 0 {
1193
 			if schedulePatient.ScheduleType == 1 {
1205
 			if schedulePatient.ScheduleType == 1 {
1194
-				advice.StartTime = recordDate.Unix() + 7*60*60
1206
+				advice.StartTime = recordDate.Unix() + 6.5*60*60
1195
 			}
1207
 			}
1196
 
1208
 
1197
 			if schedulePatient.ScheduleType == 2 {
1209
 			if schedulePatient.ScheduleType == 2 {
1238
 			break
1250
 			break
1239
 		}
1251
 		}
1240
 		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1252
 		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1241
-		if appRole.UserType == 2 || appRole.UserType == 1 {
1253
+		if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 3 {
1242
 			advice.AdviceDoctor = appRole.AdminUserId
1254
 			advice.AdviceDoctor = appRole.AdminUserId
1243
 		}
1255
 		}
1244
 
1256
 

+ 2 - 2
controllers/dialysis_record_api_controller.go Прегледај датотеку

1385
 		}
1385
 		}
1386
 
1386
 
1387
 		//针对蓬安
1387
 		//针对蓬安
1388
-		if adminUserInfo.CurrentOrgId == 9829 {
1388
+		if adminUserInfo.CurrentOrgId == 9829 || adminUserInfo.CurrentOrgId == 10440 {
1389
 			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1389
 			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1390
 			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1390
 			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1391
 		}
1391
 		}
1472
 
1472
 
1473
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1473
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1474
 
1474
 
1475
-	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 9829 {
1475
+	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 9829 || adminUserInfo.CurrentOrgId == 10440 {
1476
 
1476
 
1477
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1477
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1478
 		if evaluation.SystolicBloodPressure == 0 {
1478
 		if evaluation.SystolicBloodPressure == 0 {

+ 4 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go Прегледај датотеку

269
 
269
 
270
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
270
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
271
 
271
 
272
-	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 {
272
+	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 {
273
 		if adminUserInfo.Org.Id != 10447 {
273
 		if adminUserInfo.Org.Id != 10447 {
274
 			dewater_amount = dewater_amount * 1000
274
 			dewater_amount = dewater_amount * 1000
275
 		}
275
 		}
684
 				if adminUserInfo.Org.Id == 9829 {
684
 				if adminUserInfo.Org.Id == 9829 {
685
 					evaluation.PulseFrequency = 80
685
 					evaluation.PulseFrequency = 80
686
 				}
686
 				}
687
+				if adminUserInfo.Org.Id == 10440 {
688
+					evaluation.Temperature = 36.5
689
+				}
687
 			}
690
 			}
688
 		} else {
691
 		} else {
689
 			evaluation.UpdatedTime = time.Now().Unix()
692
 			evaluation.UpdatedTime = time.Now().Unix()

+ 63 - 12
controllers/mobile_api_controllers/dialysis_api_controller.go Прегледај датотеку

841
 
841
 
842
 		//针对长沙南雅
842
 		//针对长沙南雅
843
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
843
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
844
+			fmt.Println("-----------------------", adminUserInfo.Org.Id)
845
+			fmt.Println("modifier----------------", modifier)
844
 			//查询未核对的医嘱
846
 			//查询未核对的医嘱
845
 			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
847
 			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
846
 			if len(doctorList) > 0 && modifier > 0 {
848
 			if len(doctorList) > 0 && modifier > 0 {
883
 		doubleCheck.ID = check.ID
885
 		doubleCheck.ID = check.ID
884
 		doubleCheck.EmployeeNumber = employee_number
886
 		doubleCheck.EmployeeNumber = employee_number
885
 		err := service.UpdateDoubleCheck(&doubleCheck)
887
 		err := service.UpdateDoubleCheck(&doubleCheck)
888
+		//针对长沙南雅
889
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
890
+			//查询未核对的医嘱
891
+			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
892
+			if len(doctorList) > 0 && modifier > 0 {
893
+				for _, advice := range doctorList {
894
+					service.UpdateDoctorAdviceList(advice.ID, modifier)
895
+					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
896
+					redis := service.RedisClient()
897
+					//清空key 值
898
+					redis.Set(key, "", time.Second)
899
+					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
900
+					redis.Set(keyTwo, "", time.Second)
901
+					theTime := time.Now()
902
+					recordDate := theTime.Format("2006-01-02")
903
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
904
+					redis.Set(keyFour, "", time.Second)
905
+					defer redis.Close()
906
+				}
907
+			}
908
+
909
+		}
910
+
886
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
911
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
887
 		redis := service.RedisClient()
912
 		redis := service.RedisClient()
888
 		defer redis.Close()
913
 		defer redis.Close()
1658
 		//长沙南雅医院,自动生成抗凝剂的临时处方
1683
 		//长沙南雅医院,自动生成抗凝剂的临时处方
1659
 		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
1684
 		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
1660
 
1685
 
1686
+			if prescribing_number == 0 {
1687
+				prescribing_number = 1
1688
+			}
1661
 			advice := models.DoctorAdvice{
1689
 			advice := models.DoctorAdvice{
1662
 				UserOrgId:             adminUserInfo.Org.Id,
1690
 				UserOrgId:             adminUserInfo.Org.Id,
1663
 				PatientId:             id,
1691
 				PatientId:             id,
1665
 				AdviceType:            2,
1693
 				AdviceType:            2,
1666
 				RecordDate:            recordDate.Unix(),
1694
 				RecordDate:            recordDate.Unix(),
1667
 				AdviceDate:            recordDate.Unix(),
1695
 				AdviceDate:            recordDate.Unix(),
1668
-				StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
1669
-				AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
1696
+				StartTime:             recordDate.Unix() + 6.5*60*60, // 根据排班班次,给默认时间
1697
+				AdviceName:            "",                            // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
1670
 				AdviceDesc:            "",
1698
 				AdviceDesc:            "",
1671
 				ReminderDate:          0,
1699
 				ReminderDate:          0,
1672
 				SingleDose:            5000,
1700
 				SingleDose:            5000,
1682
 				CreatedTime:           time.Now().Unix(),
1710
 				CreatedTime:           time.Now().Unix(),
1683
 				UpdatedTime:           time.Now().Unix(),
1711
 				UpdatedTime:           time.Now().Unix(),
1684
 				IsPrescription:        1,
1712
 				IsPrescription:        1,
1713
+				ExecutionState:        2,
1714
+				StopState:             2,
1715
+				IsSettle:              2,
1685
 			}
1716
 			}
1686
 			// 查询排班信息
1717
 			// 查询排班信息
1687
 			schedulePatient, _ := service.GetScheduleByPatient(id, recordDate.Unix(), adminUserInfo.Org.Id)
1718
 			schedulePatient, _ := service.GetScheduleByPatient(id, recordDate.Unix(), adminUserInfo.Org.Id)
1688
 			if schedulePatient.ID > 0 {
1719
 			if schedulePatient.ID > 0 {
1689
 				if schedulePatient.ScheduleType == 1 {
1720
 				if schedulePatient.ScheduleType == 1 {
1690
-					advice.StartTime = recordDate.Unix() + 7*60*60
1721
+					advice.StartTime = recordDate.Unix() + 6.5*60*60
1691
 				}
1722
 				}
1692
 
1723
 
1693
 				if schedulePatient.ScheduleType == 2 {
1724
 				if schedulePatient.ScheduleType == 2 {
1735
 			}
1766
 			}
1736
 			//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1767
 			//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1737
 
1768
 
1738
-			if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 4 {
1769
+			if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 3 || appRole.UserType == 4 {
1739
 				advice.AdviceDoctor = appRole.AdminUserId
1770
 				advice.AdviceDoctor = appRole.AdminUserId
1740
 			}
1771
 			}
1741
 
1772
 
2062
 
2093
 
2063
 	}
2094
 	}
2064
 
2095
 
2065
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 {
2096
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 {
2066
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
2097
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
2067
 		if evaluation.SystolicBloodPressure == 0 {
2098
 		if evaluation.SystolicBloodPressure == 0 {
2068
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
2099
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
2719
 
2750
 
2720
 			//针对肇庆三鹤血液透析中心
2751
 			//针对肇庆三鹤血液透析中心
2721
 
2752
 
2722
-			if template.TemplateId == 43 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 {
2753
+			if template.TemplateId == 43 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10440 {
2723
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
2754
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
2724
 			}
2755
 			}
2725
 
2756
 
3233
 
3264
 
3234
 	//长沙南雅医院,自动生成抗凝剂的临时处方
3265
 	//长沙南雅医院,自动生成抗凝剂的临时处方
3235
 	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
3266
 	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
3267
+		if prescribing_number == 0 {
3268
+			prescribing_number = 1
3269
+		}
3236
 		advice := models.DoctorAdvice{
3270
 		advice := models.DoctorAdvice{
3237
 			UserOrgId:             adminUserInfo.Org.Id,
3271
 			UserOrgId:             adminUserInfo.Org.Id,
3238
 			PatientId:             id,
3272
 			PatientId:             id,
3240
 			AdviceType:            2,
3274
 			AdviceType:            2,
3241
 			RecordDate:            recordDate.Unix(),
3275
 			RecordDate:            recordDate.Unix(),
3242
 			AdviceDate:            recordDate.Unix(),
3276
 			AdviceDate:            recordDate.Unix(),
3243
-			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
3244
-			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
3277
+			StartTime:             recordDate.Unix() + 6.5*60*60, // 根据排班班次,给默认时间
3278
+			AdviceName:            "",                            // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
3245
 			AdviceDesc:            "",
3279
 			AdviceDesc:            "",
3246
 			ReminderDate:          0,
3280
 			ReminderDate:          0,
3247
 			SingleDose:            5000,
3281
 			SingleDose:            5000,
3257
 			CreatedTime:           time.Now().Unix(),
3291
 			CreatedTime:           time.Now().Unix(),
3258
 			UpdatedTime:           time.Now().Unix(),
3292
 			UpdatedTime:           time.Now().Unix(),
3259
 			IsPrescription:        1,
3293
 			IsPrescription:        1,
3294
+			ExecutionState:        2,
3295
+			StopState:             2,
3296
+			IsSettle:              2,
3260
 		}
3297
 		}
3261
 		// 查询排班信息
3298
 		// 查询排班信息
3262
 		schedulePatient, _ := service.GetScheduleByPatient(id, recordDate.Unix(), adminUserInfo.Org.Id)
3299
 		schedulePatient, _ := service.GetScheduleByPatient(id, recordDate.Unix(), adminUserInfo.Org.Id)
3263
 		if schedulePatient.ID > 0 {
3300
 		if schedulePatient.ID > 0 {
3264
 			if schedulePatient.ScheduleType == 1 {
3301
 			if schedulePatient.ScheduleType == 1 {
3265
-				advice.StartTime = recordDate.Unix() + 7*60*60
3302
+				advice.StartTime = recordDate.Unix() + 6.5*60*60
3266
 			}
3303
 			}
3267
 
3304
 
3268
 			if schedulePatient.ScheduleType == 2 {
3305
 			if schedulePatient.ScheduleType == 2 {
3309
 			break
3346
 			break
3310
 		}
3347
 		}
3311
 		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
3348
 		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
3312
-		if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 4 {
3349
+		if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 3 || appRole.UserType == 4 {
3313
 			advice.AdviceDoctor = appRole.AdminUserId
3350
 			advice.AdviceDoctor = appRole.AdminUserId
3314
 		}
3351
 		}
3315
 
3352
 
3547
 				record.UltrafiltrationRate = ultrafiltration_rate
3584
 				record.UltrafiltrationRate = ultrafiltration_rate
3548
 			}
3585
 			}
3549
 
3586
 
3550
-			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 9829 {
3587
+			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 9829 || adminInfo.Org.Id == 10440 {
3551
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3588
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3552
 				record.UltrafiltrationRate = ultrafiltration_rate
3589
 				record.UltrafiltrationRate = ultrafiltration_rate
3553
 			}
3590
 			}
3792
 	}
3829
 	}
3793
 
3830
 
3794
 	//修改床位号需要重新消毒
3831
 	//修改床位号需要重新消毒
3795
-	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 {
3832
+	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 3877 {
3796
 		service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3833
 		service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3834
+
3835
+		//查询第一条监测
3836
+		firstMonitor, _ := service.GetFirstMonitor(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3837
+
3838
+		service.UpdateFirstMonitor(firstMonitor.ID, catheter_operation)
3839
+
3840
+		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(tempDialysisRecord.PatientId, 10) + ":" + strconv.FormatInt(tempDialysisRecord.DialysisDate, 10) + ":monitor_records"
3841
+		redis := service.RedisClient()
3842
+		//清空key 值
3843
+		redis.Set(key, "", time.Second)
3844
+		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(tempDialysisRecord.DialysisDate, 10) + ":monitor_record_list_all"
3845
+		redis.Set(keyOne, "", time.Second)
3846
+		defer redis.Close()
3847
+
3797
 	}
3848
 	}
3798
 
3849
 
3799
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
3850
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)

+ 14 - 0
service/mobile_dialysis_service.go Прегледај датотеку

5257
 
5257
 
5258
 	return record, err
5258
 	return record, err
5259
 }
5259
 }
5260
+
5261
+func GetFirstMonitor(patient_id int64, monit_date int64) (models.MonitoringRecord, error) {
5262
+
5263
+	record := models.MonitoringRecord{}
5264
+	err := XTReadDB().Where("patient_id = ? and monitoring_date = ? and status=1", patient_id, monit_date).First(&record).Error
5265
+	return record, err
5266
+}
5267
+
5268
+func UpdateFirstMonitor(id int64, catheter_operation string) (models.MonitoringRecord, error) {
5269
+
5270
+	record := models.MonitoringRecord{}
5271
+	err := XTWriteDB().Model(&record).Where("id = ? and status= 1", id).Updates(map[string]interface{}{"dispose": catheter_operation}).Error
5272
+	return record, err
5273
+}