Procházet zdrojové kódy

Merge branch '20220812' of http://git.shengws.com/csx/XT_New into 20220812

test_user před 2 roky
rodič
revize
bc71d6c2f6

+ 4 - 4
controllers/data_api_controller.go Zobrazit soubor

@@ -61,7 +61,7 @@ func DataApiRegistRouters() {
61 61
 
62 62
 }
63 63
 
64
-//GetPatientsList 取配置信息列表
64
+// GetPatientsList 取配置信息列表
65 65
 func (c *DataApiController) GetConfigList() {
66 66
 	adminUserInfo := c.GetAdminUserInfo()
67 67
 	configList, _ := service.GetConfigList(adminUserInfo.CurrentOrgId)
@@ -72,7 +72,7 @@ func (c *DataApiController) GetConfigList() {
72 72
 
73 73
 }
74 74
 
75
-//CreateConfig  创建配置信息
75
+// CreateConfig  创建配置信息
76 76
 func (c *DataApiController) CreateConfig() {
77 77
 	adminUserInfo := c.GetAdminUserInfo()
78 78
 
@@ -318,7 +318,7 @@ func (c *DataApiController) DeleteChildConfig() {
318 318
 	return
319 319
 }
320 320
 
321
-//CreateChildConfig  创建子配置信息
321
+// CreateChildConfig  创建子配置信息
322 322
 func (c *DataApiController) CreateChildConfig() {
323 323
 	adminUserInfo := c.GetAdminUserInfo()
324 324
 
@@ -400,7 +400,7 @@ func configFormData(dataconfig *models.Dataconfig, data []byte) (code int) {
400 400
 	}
401 401
 	dataconfig.Module = module
402 402
 
403
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" {
403
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" {
404 404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405 405
 			utils.ErrorLog("title")
406 406
 			code = enums.ErrorCodeParamWrong

+ 291 - 6
controllers/dialysis_api_controller.go Zobrazit soubor

@@ -109,6 +109,8 @@ func DialysisApiRegistRouters() {
109 109
 	beego.Router("/api/schedule/excutiondoctoradvicebyid", &DialysisApiController{}, "Get:ExcutionDoctorAdviceById")
110 110
 
111 111
 	beego.Router("/api/patient/getdialysisadvicetoday", &DialysisApiController{}, "Get:GetDialysisAdviceToday")
112
+
113
+	beego.Router("/api/schedule/getmobileschedulelist", &DialysisApiController{}, "Get:GetMobileScheduleList")
112 114
 }
113 115
 
114 116
 func (c *DialysisApiController) GetQueueCall() {
@@ -324,6 +326,11 @@ func (c *DialysisApiController) PostPrescription() {
324 326
 	add_amount, _ := c.GetFloat("add_amount")
325 327
 	reduce_amount, _ := c.GetFloat("reduce_amount")
326 328
 	dialysis_remark := c.GetString("dialysis_remark")
329
+	prescribing_number, _ := c.GetFloat("prescribing_number")
330
+	treatment_remark := c.GetString("treatment_remark")
331
+	prescription_sodium := c.GetString("prescription_sodium")
332
+	start_sodium := c.GetString("start_sodium")
333
+	sodium_curve := c.GetString("sodium_curve")
327 334
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
328 335
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
329 336
 
@@ -432,6 +439,119 @@ func (c *DialysisApiController) PostPrescription() {
432 439
 		AddAmount:                  add_amount,
433 440
 		ReduceAmount:               reduce_amount,
434 441
 		DialysisRemark:             dialysis_remark,
442
+		PrescribingNumber:          prescribing_number,
443
+		TreatmentRemark:            treatment_remark,
444
+		PrescriptionSodium:         prescription_sodium,
445
+		StartSodium:                start_sodium,
446
+		SodiumCurve:                sodium_curve,
447
+	}
448
+
449
+	//长沙南雅医院,自动生成抗凝剂的临时处方
450
+	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
451
+		advice := models.DoctorAdvice{
452
+			UserOrgId:             adminUserInfo.CurrentOrgId,
453
+			PatientId:             patient,
454
+			GroupNo:               0,
455
+			AdviceType:            2,
456
+			RecordDate:            recordDate.Unix(),
457
+			AdviceDate:            recordDate.Unix(),
458
+			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
459
+			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
460
+			AdviceDesc:            "",
461
+			ReminderDate:          0,
462
+			SingleDose:            5000,
463
+			SingleDoseUnit:        "iu",
464
+			DrugSpec:              0,
465
+			DrugSpecUnit:          "",
466
+			PrescribingNumber:     prescribing_number, // 前端传过来的开药数量
467
+			PrescribingNumberUnit: "支",
468
+			DeliveryWay:           "静脉注射",
469
+			ExecutionFrequency:    "上机前",
470
+			AdviceDoctor:          0,
471
+			Status:                1,
472
+			CreatedTime:           time.Now().Unix(),
473
+			UpdatedTime:           time.Now().Unix(),
474
+			IsPrescription:        1,
475
+		}
476
+		// 查询排班信息
477
+		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
478
+		if schedulePatient.ID > 0 {
479
+			if schedulePatient.ScheduleType == 1 {
480
+				advice.StartTime = recordDate.Unix() + 7*60*60
481
+			}
482
+
483
+			if schedulePatient.ScheduleType == 2 {
484
+				advice.StartTime = recordDate.Unix() + 11*60*60
485
+			}
486
+		}
487
+		// 抗凝剂名称
488
+		switch anticoagulant {
489
+		case 1:
490
+			advice.AdviceName = "无肝素"
491
+			break
492
+		case 2:
493
+			advice.AdviceName = "普通肝素"
494
+			break
495
+		case 3:
496
+			advice.AdviceName = "低分子肝素"
497
+			break
498
+		case 4:
499
+			advice.AdviceName = "阿加曲班"
500
+			break
501
+		case 5:
502
+			advice.AdviceName = "枸橼酸钠"
503
+			break
504
+		case 6:
505
+			advice.AdviceName = "低分子肝素钙"
506
+			break
507
+		case 7:
508
+			advice.AdviceName = "低分子肝素钠"
509
+			break
510
+		case 8:
511
+			advice.AdviceName = "依诺肝素"
512
+			break
513
+		case 9:
514
+			advice.AdviceName = "达肝素"
515
+			break
516
+		case 10:
517
+			advice.AdviceName = "体外抗凝"
518
+			break
519
+		case 11:
520
+			advice.AdviceName = "那曲肝素"
521
+			break
522
+		case 12:
523
+			advice.AdviceName = "无抗凝剂"
524
+			break
525
+		}
526
+		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
527
+
528
+		if appRole.UserType == 2 || appRole.UserType == 1 {
529
+			advice.AdviceDoctor = appRole.AdminUserId
530
+		}
531
+
532
+		// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
533
+		advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
534
+		if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7) {
535
+			advice.AdviceName = "低分子肝素钠注射液"
536
+			// 修改患者临时医嘱里的抗凝剂医嘱
537
+			advice.ID = advicePrescription.ID
538
+			service.UpdateDoctorAdvice(&advice)
539
+		} else {
540
+			if anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7 {
541
+				advice.AdviceName = "低分子肝素钠注射液"
542
+				// 新增患者临时医嘱里的抗凝剂医嘱
543
+				service.CreateDoctorAdvice(&advice)
544
+			}
545
+
546
+		}
547
+
548
+		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
549
+		redis := service.RedisClient()
550
+		//清空key 值
551
+		redis.Set(key, "", time.Second)
552
+		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":advice_list_all"
553
+		redis.Set(keyOne, "", time.Second)
554
+
435 555
 	}
436 556
 
437 557
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -536,6 +656,23 @@ func (c *DialysisApiController) PostPrescription() {
536 656
 
537 657
 		updateErr := service.UpDateDialysisPrescription(&prescription)
538 658
 
659
+		//修改处方
660
+		if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
661
+			// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
662
+			advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
663
+			if advicePrescription.ID > 0 {
664
+
665
+				service.UpdateDoctorAdvieById(advicePrescription.ID, prescribing_number)
666
+
667
+				key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
668
+				redis := service.RedisClient()
669
+				defer redis.Close()
670
+				//清空key 值
671
+				redis.Set(key, "", time.Second)
672
+				keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":advice_list_all"
673
+				redis.Set(keyOne, "", time.Second)
674
+			}
675
+		}
539 676
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
540 677
 		redis := service.RedisClient()
541 678
 		defer redis.Close()
@@ -680,6 +817,11 @@ func (c *DialysisApiController) PostSoulution() {
680 817
 	add_amount, _ := c.GetFloat("add_amount")
681 818
 	reduce_amount, _ := c.GetFloat("reduce_amount")
682 819
 	dialysis_remark := c.GetString("dialysis_remark")
820
+	prescribing_number, _ := c.GetFloat("prescribing_number")
821
+	treatment_remark := c.GetString("treatment_remark")
822
+	prescription_sodium := c.GetString("prescription_sodium")
823
+	start_sodium := c.GetString("start_sodium")
824
+	sodium_curve := c.GetString("sodium_curve")
683 825
 	var prescription_doctor int64
684 826
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
685 827
 
@@ -808,6 +950,11 @@ func (c *DialysisApiController) PostSoulution() {
808 950
 		AddAmount:                  add_amount,
809 951
 		ReduceAmount:               reduce_amount,
810 952
 		DialysisRemark:             dialysis_remark,
953
+		PrescribingNumber:          prescribing_number,
954
+		StartSodium:                start_sodium,
955
+		PrescriptionSodium:         prescription_sodium,
956
+		SodiumCurve:                sodium_curve,
957
+		TreatmentRemark:            treatment_remark,
811 958
 	}
812 959
 
813 960
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -979,6 +1126,11 @@ func (c *DialysisApiController) PostSoulution() {
979 1126
 		PreImpulse:                 preImpules,
980 1127
 		SolutionStatus:             1,
981 1128
 		DialysisRemark:             dialysis_remark,
1129
+		PrescribingNumber:          prescribing_number,
1130
+		StartSodium:                start_sodium,
1131
+		PrescriptionSodium:         prescription_sodium,
1132
+		SodiumCurve:                sodium_curve,
1133
+		TreatmentRemark:            treatment_remark,
982 1134
 	}
983 1135
 
984 1136
 	//针对河间咸得
@@ -1008,6 +1160,114 @@ func (c *DialysisApiController) PostSoulution() {
1008 1160
 	//更新状态
1009 1161
 	service.UpdateDialysisSolutionStatusTwo(dialysisSolution.ID, dialysisSolution.ModeId, dialysisSolution.UserOrgId, dialysisSolution.PatientId)
1010 1162
 
1163
+	//长沙南雅医院,自动生成抗凝剂的临时处方
1164
+	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
1165
+		advice := models.DoctorAdvice{
1166
+			UserOrgId:             adminUserInfo.CurrentOrgId,
1167
+			PatientId:             patient,
1168
+			GroupNo:               0,
1169
+			AdviceType:            2,
1170
+			RecordDate:            recordDate.Unix(),
1171
+			AdviceDate:            recordDate.Unix(),
1172
+			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
1173
+			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
1174
+			AdviceDesc:            "",
1175
+			ReminderDate:          0,
1176
+			SingleDose:            5000,
1177
+			SingleDoseUnit:        "iu",
1178
+			DrugSpec:              0,
1179
+			DrugSpecUnit:          "",
1180
+			PrescribingNumber:     prescribing_number, // 前端传过来的开药数量
1181
+			PrescribingNumberUnit: "支",
1182
+			DeliveryWay:           "静脉注射",
1183
+			ExecutionFrequency:    "上机前",
1184
+			AdviceDoctor:          0,
1185
+			Status:                1,
1186
+			CreatedTime:           time.Now().Unix(),
1187
+			UpdatedTime:           time.Now().Unix(),
1188
+			IsPrescription:        1,
1189
+		}
1190
+		// 查询排班信息
1191
+		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1192
+		if schedulePatient.ID > 0 {
1193
+			if schedulePatient.ScheduleType == 1 {
1194
+				advice.StartTime = recordDate.Unix() + 7*60*60
1195
+			}
1196
+
1197
+			if schedulePatient.ScheduleType == 2 {
1198
+				advice.StartTime = recordDate.Unix() + 11*60*60
1199
+			}
1200
+		}
1201
+		// 抗凝剂名称
1202
+		switch anticoagulant {
1203
+		case 1:
1204
+			advice.AdviceName = "无肝素"
1205
+			break
1206
+		case 2:
1207
+			advice.AdviceName = "普通肝素"
1208
+			break
1209
+		case 3:
1210
+			advice.AdviceName = "低分子肝素"
1211
+			break
1212
+		case 4:
1213
+			advice.AdviceName = "阿加曲班"
1214
+			break
1215
+		case 5:
1216
+			advice.AdviceName = "枸橼酸钠"
1217
+			break
1218
+		case 6:
1219
+			advice.AdviceName = "低分子肝素钙"
1220
+			break
1221
+		case 7:
1222
+			advice.AdviceName = "低分子肝素钠"
1223
+			break
1224
+		case 8:
1225
+			advice.AdviceName = "依诺肝素"
1226
+			break
1227
+		case 9:
1228
+			advice.AdviceName = "达肝素"
1229
+			break
1230
+		case 10:
1231
+			advice.AdviceName = "体外抗凝"
1232
+			break
1233
+		case 11:
1234
+			advice.AdviceName = "那曲肝素"
1235
+			break
1236
+		case 12:
1237
+			advice.AdviceName = "无抗凝剂"
1238
+			break
1239
+		}
1240
+		//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 {
1242
+			advice.AdviceDoctor = appRole.AdminUserId
1243
+		}
1244
+
1245
+		// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
1246
+		advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
1247
+
1248
+		if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7) {
1249
+			advice.AdviceName = "低分子肝素钠注射液"
1250
+			// 修改患者临时医嘱里的抗凝剂医嘱
1251
+			advice.ID = advicePrescription.ID
1252
+			service.UpdateDoctorAdvice(&advice)
1253
+		} else {
1254
+			// 新增患者临时医嘱里的抗凝剂医嘱
1255
+			if anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7 {
1256
+				advice.AdviceName = "低分子肝素钠注射液"
1257
+				service.CreateDoctorAdvice(&advice)
1258
+			}
1259
+
1260
+		}
1261
+
1262
+		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
1263
+		redis := service.RedisClient()
1264
+		//清空key 值
1265
+		redis.Set(key, "", time.Second)
1266
+		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":advice_list_all"
1267
+		redis.Set(keyOne, "", time.Second)
1268
+
1269
+	}
1270
+
1011 1271
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
1012 1272
 	redis := service.RedisClient()
1013 1273
 
@@ -3120,7 +3380,6 @@ func (c *DialysisApiController) GetDialysisOrder() {
3120 3380
 
3121 3381
 }
3122 3382
 
3123
-//
3124 3383
 func (c *DialysisApiController) GetLongAdvice() {
3125 3384
 	patient_id, _ := c.GetInt64("patient_id")
3126 3385
 	adminUserInfo := c.GetAdminUserInfo()
@@ -3862,7 +4121,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
3862 4121
 			}
3863 4122
 
3864 4123
 			//长沙南雅
3865
-			if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 || adminInfo.CurrentOrgId == 10432 || adminInfo.CurrentOrgId == 10441 || adminInfo.CurrentOrgId == 10445 {
4124
+			if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 || adminInfo.CurrentOrgId == 10432 || adminInfo.CurrentOrgId == 10441 || adminInfo.CurrentOrgId == 10445 || adminInfo.CurrentOrgId == 9829 {
3866 4125
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3867 4126
 
3868 4127
 				record.UltrafiltrationRate = ultrafiltration_rate
@@ -4349,7 +4608,7 @@ func (c *DialysisApiController) GetInitPrintDataOne() {
4349 4608
 	}
4350 4609
 }
4351 4610
 
4352
-//新接口
4611
+// 新接口
4353 4612
 func (this *DialysisApiController) GetPatientDialysisSolutionGroupList() {
4354 4613
 
4355 4614
 	keyword := this.GetString("keywords")
@@ -5505,11 +5764,14 @@ func (this *DialysisApiController) GetDialysisAdviceToday() {
5505 5764
 
5506 5765
 	drug, _ := service.GetAllBaseDrugListTwenty(orgId)
5507 5766
 	_, config := service.FindXTHisRecordByOrgId(orgId)
5767
+	appId := this.GetAdminUserInfo().CurrentAppId
5768
+	doctorList, _ := service.GetAllAdminUsers(orgId, appId)
5508 5769
 	if err == nil {
5509 5770
 		this.ServeSuccessJSON(map[string]interface{}{
5510
-			"list":   list,
5511
-			"drug":   drug,
5512
-			"config": config,
5771
+			"list":       list,
5772
+			"drug":       drug,
5773
+			"config":     config,
5774
+			"doctorList": doctorList,
5513 5775
 		})
5514 5776
 		return
5515 5777
 
@@ -5518,3 +5780,26 @@ func (this *DialysisApiController) GetDialysisAdviceToday() {
5518 5780
 		return
5519 5781
 	}
5520 5782
 }
5783
+
5784
+func (this *DialysisApiController) GetMobileScheduleList() {
5785
+
5786
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5787
+	schedule, _ := service.GetMobileScheduleList(orgId)
5788
+
5789
+	if len(schedule) > 0 {
5790
+		for _, its := range schedule {
5791
+			prescription, _ := service.GetPrescriptionList(its.PatientId, its.ScheduleDate, its.UserOrgId)
5792
+			its.DialysisPrescription = prescription
5793
+			monitor, _ := service.GetLastMonitorRecordList(its.PatientId, its.ScheduleDate, its.UserOrgId)
5794
+			its.MonitoringRecord = monitor
5795
+			after, _ := service.GetLastAfter(its.PatientId, its.ScheduleDate, its.UserOrgId)
5796
+			its.XtAssessmentAfterDislysis = after
5797
+		}
5798
+	}
5799
+
5800
+	this.ServeSuccessJSON(map[string]interface{}{
5801
+		"schedule": schedule,
5802
+	})
5803
+	return
5804
+
5805
+}

+ 17 - 1
controllers/dialysis_record_api_controller.go Zobrazit soubor

@@ -805,6 +805,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
805 805
 	nuclein_date := this.GetString("nuclein_date")
806 806
 	schedule_remark := this.GetString("schedule_remark")
807 807
 	order_remark := this.GetString("order_remark")
808
+	catheter_operation := this.GetString("catheter_operation")
808 809
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
809 810
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
810 811
 		return
@@ -1020,6 +1021,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1020 1021
 		NucleinDate:            theNucleinDate,
1021 1022
 		ScheduleRemark:         schedule_remark,
1022 1023
 		OrderRemark:            order_remark,
1024
+		CatheterOperation:      catheter_operation,
1023 1025
 	}
1024 1026
 
1025 1027
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
@@ -1181,6 +1183,12 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1181 1183
 				record.BreathingRate = "20"
1182 1184
 			}
1183 1185
 
1186
+			//针对蓬安济民
1187
+			if adminUserInfo.CurrentOrgId == 9829 {
1188
+				record.Temperature = 36.5
1189
+				record.PulseFrequency = 80
1190
+			}
1191
+
1184 1192
 			//针对兰溪人民医院的需求
1185 1193
 			if adminUserInfo.CurrentOrgId == 10432 {
1186 1194
 				befor, _ := service.GetAssessmentBefor(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
@@ -1375,6 +1383,12 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1375 1383
 		if adminUserInfo.CurrentOrgId == 10447 || adminUserInfo.CurrentOrgId == 9675 {
1376 1384
 			tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
1377 1385
 		}
1386
+
1387
+		//针对蓬安
1388
+		if adminUserInfo.CurrentOrgId == 9829 {
1389
+			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1390
+			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1391
+		}
1378 1392
 	}
1379 1393
 
1380 1394
 	if adminUserInfo.CurrentOrgId == 9583 {
@@ -1458,7 +1472,7 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1458 1472
 
1459 1473
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1460 1474
 
1461
-	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 {
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 {
1462 1476
 
1463 1477
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1464 1478
 		if evaluation.SystolicBloodPressure == 0 {
@@ -1592,6 +1606,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1592 1606
 	nuclein_date := this.GetString("nuclein_date")
1593 1607
 	schedule_remark := this.GetString("schedule_remark")
1594 1608
 	order_remark := this.GetString("order_remark")
1609
+	catheter_operation := this.GetString("catheter_operation")
1595 1610
 	if record_id == 0 {
1596 1611
 		this.ErrorLog("id:%v", record_id)
1597 1612
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1757,6 +1772,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1757 1772
 		NucleinDate:            theNucleinDate,
1758 1773
 		ScheduleRemark:         schedule_remark,
1759 1774
 		OrderRemark:            order_remark,
1775
+		CatheterOperation:      catheter_operation,
1760 1776
 	}
1761 1777
 
1762 1778
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)

+ 1 - 2
controllers/his_api_controller.go Zobrazit soubor

@@ -2382,8 +2382,7 @@ func (c *HisApiController) CreateHisPrescription() {
2382 2382
 						for _, item := range flowGood {
2383 2383
 							out_count += item.Count
2384 2384
 						}
2385
-						fmt.Println("wenqiang---------------------------", out_count)
2386
-						fmt.Println("xiama---------------------------", parseIntCount)
2385
+
2387 2386
 						//如果历史数和当前数据不想等才进行退库出库
2388 2387
 						if out_count != parseIntCount {
2389 2388
 							service.ConsumablePrescriptionDelivery(adminInfo.CurrentOrgId, item.PatientId, item.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount)

+ 15 - 2
controllers/mobile_api_controllers/check_weight_api_controller.go Zobrazit soubor

@@ -269,7 +269,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
269 269
 
270 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 {
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 {
273 273
 		if adminUserInfo.Org.Id != 10447 {
274 274
 			dewater_amount = dewater_amount * 1000
275 275
 		}
@@ -379,7 +379,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
379 379
 			newprescribe.DewaterAmount = dewater_amount
380 380
 			newprescribe.TargetUltrafiltration = dewater_amount
381 381
 			newprescribe.Status = 1
382
-			newprescribe.Remark = dialysisSolution.Remark
382
+			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
383
+				newprescribe.Remark = dialysisSolution.Remark
384
+			}
385
+
383 386
 			if adminUserInfo.Org.Id == 10340 {
384 387
 				newprescribe.TargetUltrafiltration = 0
385 388
 				newprescribe.Sodium = 138
@@ -677,6 +680,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
677 680
 				if adminUserInfo.Org.Id == 10445 {
678 681
 					evaluation.VenousCatheterization = lastPredialysisEvaluation.VenousCatheterization
679 682
 				}
683
+
684
+				if adminUserInfo.Org.Id == 9829 {
685
+					evaluation.PulseFrequency = 80
686
+				}
680 687
 			}
681 688
 		} else {
682 689
 			evaluation.UpdatedTime = time.Now().Unix()
@@ -751,6 +758,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
751 758
 			afterevaluation.ActualDisplacement = prescribe.DisplaceLiquiValue
752 759
 		}
753 760
 
761
+		//蓬安济民
762
+
763
+		if adminUserInfo.Org.Id == 9829 {
764
+			afterevaluation.PulseFrequency = 80
765
+		}
766
+
754 767
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
755 768
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis"
756 769
 		redis := service.RedisClient()

+ 444 - 22
controllers/mobile_api_controllers/dialysis_api_controller.go Zobrazit soubor

@@ -1,23 +1,22 @@
1 1
 package mobile_api_controllers
2 2
 
3 3
 import (
4
-	"encoding/json"
5
-	"errors"
6
-	"fmt"
7
-	"github.com/jinzhu/gorm"
8
-	"reflect"
9
-	"strconv"
10
-	"strings"
11
-	"time"
12
-
13 4
 	"XT_New/enums"
14 5
 	"XT_New/models"
15 6
 	"XT_New/service"
16 7
 	"XT_New/utils"
8
+	"encoding/json"
9
+	"errors"
10
+	"fmt"
17 11
 	"github.com/astaxie/beego"
12
+	"github.com/jinzhu/gorm"
18 13
 	"math"
19 14
 	"net/http"
20 15
 	"net/url"
16
+	"reflect"
17
+	"strconv"
18
+	"strings"
19
+	"time"
21 20
 )
22 21
 
23 22
 // type DialysisTestAPIController struct {
@@ -87,10 +86,9 @@ func (this *DialysisAPIController) Scheduals() {
87 86
 	defer redis.Close()
88 87
 
89 88
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90
-
89
+	redis.Set(key, "", time.Second)
91 90
 	scheduals_json_str, _ := redis.Get(key).Result()
92 91
 
93
-	redis.Set(key, "", time.Second)
94 92
 	patients, _ := service.GetAllPatientListSix(orgID)
95 93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
96 94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
@@ -840,6 +838,30 @@ func (c *DialysisAPIController) PostDoubleCheck() {
840 838
 		doubleCheck.Modifier = modifier
841 839
 
842 840
 		err := service.AddSigleDoubleCheck(&doubleCheck)
841
+
842
+		//针对长沙南雅
843
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
844
+			//查询未核对的医嘱
845
+			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
846
+			if len(doctorList) > 0 && modifier > 0 {
847
+				for _, advice := range doctorList {
848
+					service.UpdateDoctorAdviceList(advice.ID, modifier)
849
+					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
850
+					redis := service.RedisClient()
851
+					//清空key 值
852
+					redis.Set(key, "", time.Second)
853
+					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
854
+					redis.Set(keyTwo, "", time.Second)
855
+					theTime := time.Now()
856
+					recordDate := theTime.Format("2006-01-02")
857
+					keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
858
+					redis.Set(keyFour, "", time.Second)
859
+					defer redis.Close()
860
+				}
861
+			}
862
+
863
+		}
864
+
843 865
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
844 866
 		redis := service.RedisClient()
845 867
 
@@ -1389,6 +1411,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1389 1411
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1390 1412
 
1391 1413
 	is_water := c.GetString("is_water")
1414
+
1392 1415
 	var is_war int64
1393 1416
 	if is_water == "是" {
1394 1417
 		is_war = 1
@@ -1407,6 +1430,13 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1407 1430
 	add_amount, _ := c.GetFloat("add_amount")
1408 1431
 	reduce_amount, _ := c.GetFloat("reduce_amount")
1409 1432
 	dialysis_remark := c.GetString("dialysis_remark")
1433
+
1434
+	prescribing_number, _ := c.GetFloat("prescribing_number")
1435
+	prescription_sodium := c.GetString("prescription_sodium")
1436
+	start_sodium := c.GetString("start_sodium")
1437
+	sodium_curve := c.GetString("sodium_curve")
1438
+	treatment_remark := c.GetString("treatment_remark")
1439
+
1410 1440
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1411 1441
 
1412 1442
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
@@ -1532,6 +1562,11 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1532 1562
 		AddAmount:                  add_amount,
1533 1563
 		ReduceAmount:               reduce_amount,
1534 1564
 		DialysisRemark:             dialysis_remark,
1565
+		PrescribingNumber:          prescribing_number,
1566
+		StartSodium:                start_sodium,
1567
+		SodiumCurve:                sodium_curve,
1568
+		TreatmentRemark:            treatment_remark,
1569
+		PrescriptionSodium:         prescription_sodium,
1535 1570
 	}
1536 1571
 
1537 1572
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1620,6 +1655,116 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1620 1655
 
1621 1656
 		err := service.AddSigleRecord(&prescription)
1622 1657
 
1658
+		//长沙南雅医院,自动生成抗凝剂的临时处方
1659
+		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
1660
+
1661
+			advice := models.DoctorAdvice{
1662
+				UserOrgId:             adminUserInfo.Org.Id,
1663
+				PatientId:             id,
1664
+				GroupNo:               0,
1665
+				AdviceType:            2,
1666
+				RecordDate:            recordDate.Unix(),
1667
+				AdviceDate:            recordDate.Unix(),
1668
+				StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
1669
+				AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
1670
+				AdviceDesc:            "",
1671
+				ReminderDate:          0,
1672
+				SingleDose:            5000,
1673
+				SingleDoseUnit:        "iu",
1674
+				DrugSpec:              0,
1675
+				DrugSpecUnit:          "",
1676
+				PrescribingNumber:     prescribing_number, // 前端传过来的开药数量
1677
+				PrescribingNumberUnit: "支",
1678
+				DeliveryWay:           "静脉注射",
1679
+				ExecutionFrequency:    "上机前",
1680
+				AdviceDoctor:          0,
1681
+				Status:                1,
1682
+				CreatedTime:           time.Now().Unix(),
1683
+				UpdatedTime:           time.Now().Unix(),
1684
+				IsPrescription:        1,
1685
+			}
1686
+			// 查询排班信息
1687
+			schedulePatient, _ := service.GetScheduleByPatient(id, recordDate.Unix(), adminUserInfo.Org.Id)
1688
+			if schedulePatient.ID > 0 {
1689
+				if schedulePatient.ScheduleType == 1 {
1690
+					advice.StartTime = recordDate.Unix() + 7*60*60
1691
+				}
1692
+
1693
+				if schedulePatient.ScheduleType == 2 {
1694
+					advice.StartTime = recordDate.Unix() + 11*60*60
1695
+				}
1696
+			}
1697
+			// 抗凝剂名称
1698
+			switch anticoagulant {
1699
+			case 1:
1700
+				advice.AdviceName = "无肝素"
1701
+				break
1702
+			case 2:
1703
+				advice.AdviceName = "普通肝素"
1704
+				break
1705
+			case 3:
1706
+				advice.AdviceName = "低分子肝素"
1707
+				break
1708
+			case 4:
1709
+				advice.AdviceName = "阿加曲班"
1710
+				break
1711
+			case 5:
1712
+				advice.AdviceName = "枸橼酸钠"
1713
+				break
1714
+			case 6:
1715
+				advice.AdviceName = "低分子肝素钙"
1716
+				break
1717
+			case 7:
1718
+				advice.AdviceName = "低分子肝素钠"
1719
+				break
1720
+			case 8:
1721
+				advice.AdviceName = "依诺肝素"
1722
+				break
1723
+			case 9:
1724
+				advice.AdviceName = "达肝素"
1725
+				break
1726
+			case 10:
1727
+				advice.AdviceName = "体外抗凝"
1728
+				break
1729
+			case 11:
1730
+				advice.AdviceName = "那曲肝素"
1731
+				break
1732
+			case 12:
1733
+				advice.AdviceName = "无抗凝剂"
1734
+				break
1735
+			}
1736
+			//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1737
+
1738
+			if appRole.UserType == 2 || appRole.UserType == 1 || appRole.UserType == 4 {
1739
+				advice.AdviceDoctor = appRole.AdminUserId
1740
+			}
1741
+
1742
+			// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
1743
+			advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.Org.Id, id, recordDate.Unix())
1744
+			if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7) {
1745
+				advice.AdviceName = "低分子肝素钠注射液"
1746
+				// 修改患者临时医嘱里的抗凝剂医嘱
1747
+				advice.ID = advicePrescription.ID
1748
+				service.UpdateDoctorAdvice(&advice)
1749
+			} else {
1750
+				if anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7 {
1751
+					advice.AdviceName = "低分子肝素钠注射液"
1752
+					// 新增患者临时医嘱里的抗凝剂医嘱
1753
+					service.CreateDoctorAdvice(&advice)
1754
+				}
1755
+
1756
+			}
1757
+
1758
+			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
1759
+			redis := service.RedisClient()
1760
+			defer redis.Close()
1761
+			//清空key 值
1762
+			redis.Set(key, "", time.Second)
1763
+			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":advice_list_all"
1764
+			redis.Set(keyOne, "", time.Second)
1765
+
1766
+		}
1767
+
1623 1768
 		//获取key,清空redis
1624 1769
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1625 1770
 		redis := service.RedisClient()
@@ -1710,6 +1855,25 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1710 1855
 		prescription.ID = dialysisPrescription.ID
1711 1856
 
1712 1857
 		err := service.UpDateDialysisPrescription(&prescription)
1858
+
1859
+		//修改处方
1860
+		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
1861
+			// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
1862
+			advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.Org.Id, id, recordDate.Unix())
1863
+			if advicePrescription.ID > 0 {
1864
+
1865
+				service.UpdateDoctorAdvieById(advicePrescription.ID, prescribing_number)
1866
+
1867
+				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
1868
+				redis := service.RedisClient()
1869
+				defer redis.Close()
1870
+				//清空key 值
1871
+				redis.Set(key, "", time.Second)
1872
+				keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":advice_list_all"
1873
+				redis.Set(keyOne, "", time.Second)
1874
+			}
1875
+		}
1876
+
1713 1877
 		//获取key,清空redis
1714 1878
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
1715 1879
 		redis := service.RedisClient()
@@ -1898,7 +2062,7 @@ func (c *DialysisAPIController) Finish() {
1898 2062
 
1899 2063
 	}
1900 2064
 
1901
-	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 {
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 {
1902 2066
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
1903 2067
 		if evaluation.SystolicBloodPressure == 0 {
1904 2068
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -1995,6 +2159,16 @@ func (c *DialysisAPIController) Finish() {
1995 2159
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1996 2160
 	}
1997 2161
 
2162
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 9829 {
2163
+		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2164
+		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
2165
+	}
2166
+
2167
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10432 {
2168
+		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2169
+		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
2170
+	}
2171
+
1998 2172
 	if lastAssessmentAfterDislysis != nil {
1999 2173
 		tempassessmentAfterDislysis.BloodPressureType = lastAssessmentAfterDislysis.BloodPressureType
2000 2174
 
@@ -2081,6 +2255,7 @@ func (c *DialysisAPIController) Finish() {
2081 2255
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderNoEND)
2082 2256
 		return
2083 2257
 	}
2258
+
2084 2259
 	if dialysisOrder.Stage == 1 {
2085 2260
 		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
2086 2261
 
@@ -2095,6 +2270,80 @@ func (c *DialysisAPIController) Finish() {
2095 2270
 		//结束时候透析次数加1
2096 2271
 		service.UpdateSolutionByPatientId(id)
2097 2272
 
2273
+		//下机完自动消毒,针对长沙南雅
2274
+		if dialysisOrder.Stage == 1 {
2275
+			if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
2276
+				//根据床位号获取设备型号
2277
+				unitType, _ := service.GetUnitType(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2278
+				//查询使用消毒最后一条消毒记录
2279
+				_, err := service.GetLaseDeviceInfomation(dialysisOrder.UserOrgId, dialysisOrder.BedID, dialysisOrder.DialysisDate, dialysisOrder.SchedualType)
2280
+				fmt.Println("err", err)
2281
+				if err == gorm.ErrRecordNotFound {
2282
+					//查找排班
2283
+					scheduleByPatient, _ := service.GetScheduleByPatient(dialysisOrder.PatientId, dialysisOrder.DialysisDate, dialysisOrder.UserOrgId)
2284
+					//查询改设备是否有消毒计划
2285
+					plan, errcode := service.GetDisInfectionTime(dialysisOrder.UserOrgId, unitType.UnitType, dialysisOrder.SchedualType, scheduleByPatient.ScheduleWeek)
2286
+
2287
+					//根据床位号获取设备id
2288
+					addmacher, _ := service.GetEquimentIDTwo(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2289
+
2290
+					//查询病人信息
2291
+					patients, _ := service.GetPatientInfoMation(dialysisOrder.PatientId)
2292
+					var con = ""
2293
+					if patients.IsInfectious == 0 {
2294
+						con = ""
2295
+					}
2296
+					if patients.IsInfectious == 1 {
2297
+						con = "无"
2298
+					}
2299
+					if patients.IsInfectious == 2 {
2300
+						con = "有"
2301
+					}
2302
+
2303
+					if errcode == nil {
2304
+						var end_time int64
2305
+						end_time = endDate.Unix() + plan.DisinfecTime*60
2306
+						//新增消毒
2307
+						information := models.DeviceInformation{
2308
+							Date:                  dialysisOrder.DialysisDate,
2309
+							Zone:                  dialysisOrder.ZoneId,
2310
+							Class:                 dialysisOrder.SchedualType,
2311
+							BedNumber:             dialysisOrder.BedID,
2312
+							PatientId:             dialysisOrder.PatientId,
2313
+							DialysisMode:          scheduleByPatient.ModeId,
2314
+							LongTime:              strconv.FormatInt(plan.DisinfecTime, 10),
2315
+							Disinfection:          1,
2316
+							DialysisConcentration: 1,
2317
+							DisinfectionStatus:    1,
2318
+							Move:                  1,
2319
+							UserOrgId:             dialysisOrder.UserOrgId,
2320
+							DisinfectType:         plan.Way,
2321
+							DisinfectantType:      plan.MachineDisinfectant,
2322
+							FluidPath:             plan.DisinfectanWay, //液路消毒方式
2323
+							Disinfectant:          plan.Disinfectant,
2324
+							Ctime:                 time.Now().Unix(),
2325
+							Status:                1,
2326
+							SignName:              nurseID,
2327
+							EquimentId:            addmacher.ID,
2328
+							DisinfectionResidue:   2,
2329
+							Bed:                   addmacher.BedNumber,
2330
+							StartTime:             dialysisOrder.StartTime,
2331
+							EndTime:               dialysisOrder.EndTime,
2332
+							Contagion:             con,
2333
+							WeightLoss:            0,
2334
+							Hyperfiltratio:        0,
2335
+							DialysisHour:          "",
2336
+							MachineRun:            1,
2337
+							DisinfecStartime:      endDate.Unix(),
2338
+							DisinfecEndtime:       end_time,
2339
+						}
2340
+						err := service.CreateInformationTwo(&information)
2341
+						fmt.Println("报错", err)
2342
+					}
2343
+				}
2344
+			}
2345
+		}
2346
+
2098 2347
 		dialysisOrder.Stage = 2
2099 2348
 		dialysisOrder.FinishNurse = nurseID
2100 2349
 		dialysisOrder.FinishCreator = adminUserInfo.AdminUser.Id
@@ -2121,6 +2370,7 @@ func (c *DialysisAPIController) Finish() {
2121 2370
 		}
2122 2371
 
2123 2372
 	}
2373
+
2124 2374
 }
2125 2375
 
2126 2376
 func (c *DialysisAPIController) GetAllZone() {
@@ -2183,6 +2433,8 @@ func (this *DialysisAPIController) StartDialysis() {
2183 2433
 	nuclein_date_str := this.GetString("nuclein_date_str")
2184 2434
 	schedule_remark := this.GetString("schedule_remark")
2185 2435
 	order_remark := this.GetString("order_remark")
2436
+	catheter_operation := this.GetString("catheter_operation")
2437
+
2186 2438
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
2187 2439
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2188 2440
 		return
@@ -2384,6 +2636,7 @@ func (this *DialysisAPIController) StartDialysis() {
2384 2636
 		NucleinDate:            theNucleinDate,
2385 2637
 		ScheduleRemark:         schedule_remark,
2386 2638
 		OrderRemark:            order_remark,
2639
+		CatheterOperation:      catheter_operation,
2387 2640
 	}
2388 2641
 	//查询该床位是否有人用了
2389 2642
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
@@ -2507,7 +2760,6 @@ func (this *DialysisAPIController) StartDialysis() {
2507 2760
 		if errcode == nil {
2508 2761
 			record.SystolicBloodPressure = befor.SystolicBloodPressure
2509 2762
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
2510
-
2511 2763
 			record.BreathingRate = befor.BreathingRate
2512 2764
 			record.PulseFrequency = befor.PulseFrequency
2513 2765
 			record.Temperature = befor.Temperature
@@ -2516,7 +2768,7 @@ func (this *DialysisAPIController) StartDialysis() {
2516 2768
 
2517 2769
 	// 如果当天有插入数据,则不再往透析纪录里插入数据
2518 2770
 	if newdialysisRecord.ID > 0 {
2519
-		if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 9675 {
2771
+		if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 {
2520 2772
 			record.Temperature = 36.5
2521 2773
 			record.ArterialPressure = -100
2522 2774
 			record.DialysateTemperature = 36.5
@@ -2524,6 +2776,7 @@ func (this *DialysisAPIController) StartDialysis() {
2524 2776
 			record.BreathingRate = "20"
2525 2777
 			record.VenousPressure = 80
2526 2778
 			record.TransmembranePressure = 60
2779
+			record.Dispose = catheter_operation
2527 2780
 		}
2528 2781
 		//针对新化博翔
2529 2782
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10447 {
@@ -2548,6 +2801,11 @@ func (this *DialysisAPIController) StartDialysis() {
2548 2801
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
2549 2802
 			record.BreathingRate = befor.BreathingRate
2550 2803
 		}
2804
+
2805
+		if adminUserInfo.Org.Id == 9829 {
2806
+			record.PulseFrequency = 80
2807
+			record.Temperature = 36.5
2808
+		}
2551 2809
 		err := service.CreateMonitor(&record)
2552 2810
 
2553 2811
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
@@ -2699,6 +2957,12 @@ func (c *DialysisAPIController) PostSolution() {
2699 2957
 	is_water := c.GetString("is_water")
2700 2958
 	add_amount, _ := c.GetFloat("add_amount")
2701 2959
 	reduce_amount, _ := c.GetFloat("reduce_amount")
2960
+
2961
+	prescribing_number, _ := c.GetFloat("prescribing_number")
2962
+	treatment_remark := c.GetString("treatment_remark")
2963
+	prescription_sodium := c.GetString("prescription_sodium")
2964
+	start_sodium := c.GetString("start_sodium")
2965
+	sodium_curve := c.GetString("sodium_curve")
2702 2966
 	var is_war int64
2703 2967
 	if is_water == "是" {
2704 2968
 		is_war = 1
@@ -2836,6 +3100,11 @@ func (c *DialysisAPIController) PostSolution() {
2836 3100
 		AddAmount:                  add_amount,
2837 3101
 		ReduceAmount:               reduce_amount,
2838 3102
 		DialysisRemark:             dialysis_remark,
3103
+		PrescribingNumber:          prescribing_number,
3104
+		PrescriptionSodium:         prescription_sodium,
3105
+		StartSodium:                start_sodium,
3106
+		SodiumCurve:                sodium_curve,
3107
+		TreatmentRemark:            treatment_remark,
2839 3108
 	}
2840 3109
 
2841 3110
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -2935,6 +3204,11 @@ func (c *DialysisAPIController) PostSolution() {
2935 3204
 		PreImpulse:                 impulse,
2936 3205
 		SolutionStatus:             1,
2937 3206
 		DialysisRemark:             dialysis_remark,
3207
+		PrescribingNumber:          prescribing_number,
3208
+		PrescriptionSodium:         prescription_sodium,
3209
+		StartSodium:                start_sodium,
3210
+		SodiumCurve:                sodium_curve,
3211
+		TreatmentRemark:            treatment_remark,
2938 3212
 	}
2939 3213
 
2940 3214
 	//针对河间咸的
@@ -2957,6 +3231,115 @@ func (c *DialysisAPIController) PostSolution() {
2957 3231
 	//更新状态
2958 3232
 	service.UpdateDialysisSolutionStatusTwo(dialysisSolution.ID, dialysisSolution.ModeId, dialysisSolution.UserOrgId, dialysisSolution.PatientId)
2959 3233
 
3234
+	//长沙南雅医院,自动生成抗凝剂的临时处方
3235
+	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
3236
+		advice := models.DoctorAdvice{
3237
+			UserOrgId:             adminUserInfo.Org.Id,
3238
+			PatientId:             id,
3239
+			GroupNo:               0,
3240
+			AdviceType:            2,
3241
+			RecordDate:            recordDate.Unix(),
3242
+			AdviceDate:            recordDate.Unix(),
3243
+			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
3244
+			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
3245
+			AdviceDesc:            "",
3246
+			ReminderDate:          0,
3247
+			SingleDose:            5000,
3248
+			SingleDoseUnit:        "iu",
3249
+			DrugSpec:              0,
3250
+			DrugSpecUnit:          "",
3251
+			PrescribingNumber:     prescribing_number, // 前端传过来的开药数量
3252
+			PrescribingNumberUnit: "支",
3253
+			DeliveryWay:           "静脉注射",
3254
+			ExecutionFrequency:    "上机前",
3255
+			AdviceDoctor:          0,
3256
+			Status:                1,
3257
+			CreatedTime:           time.Now().Unix(),
3258
+			UpdatedTime:           time.Now().Unix(),
3259
+			IsPrescription:        1,
3260
+		}
3261
+		// 查询排班信息
3262
+		schedulePatient, _ := service.GetScheduleByPatient(id, recordDate.Unix(), adminUserInfo.Org.Id)
3263
+		if schedulePatient.ID > 0 {
3264
+			if schedulePatient.ScheduleType == 1 {
3265
+				advice.StartTime = recordDate.Unix() + 7*60*60
3266
+			}
3267
+
3268
+			if schedulePatient.ScheduleType == 2 {
3269
+				advice.StartTime = recordDate.Unix() + 11*60*60
3270
+			}
3271
+		}
3272
+		// 抗凝剂名称
3273
+		switch anticoagulant {
3274
+		case 1:
3275
+			advice.AdviceName = "无肝素"
3276
+			break
3277
+		case 2:
3278
+			advice.AdviceName = "普通肝素"
3279
+			break
3280
+		case 3:
3281
+			advice.AdviceName = "低分子肝素"
3282
+			break
3283
+		case 4:
3284
+			advice.AdviceName = "阿加曲班"
3285
+			break
3286
+		case 5:
3287
+			advice.AdviceName = "枸橼酸钠"
3288
+			break
3289
+		case 6:
3290
+			advice.AdviceName = "低分子肝素钙"
3291
+			break
3292
+		case 7:
3293
+			advice.AdviceName = "低分子肝素钠"
3294
+			break
3295
+		case 8:
3296
+			advice.AdviceName = "依诺肝素"
3297
+			break
3298
+		case 9:
3299
+			advice.AdviceName = "达肝素"
3300
+			break
3301
+		case 10:
3302
+			advice.AdviceName = "体外抗凝"
3303
+			break
3304
+		case 11:
3305
+			advice.AdviceName = "那曲肝素"
3306
+			break
3307
+		case 12:
3308
+			advice.AdviceName = "无抗凝剂"
3309
+			break
3310
+		}
3311
+		//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 {
3313
+			advice.AdviceDoctor = appRole.AdminUserId
3314
+		}
3315
+
3316
+		// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
3317
+		advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.Org.Id, id, recordDate.Unix())
3318
+
3319
+		if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7) {
3320
+
3321
+			advice.AdviceName = "低分子肝素钠注射液"
3322
+			// 修改患者临时医嘱里的抗凝剂医嘱
3323
+			advice.ID = advicePrescription.ID
3324
+			service.UpdateDoctorAdvice(&advice)
3325
+		} else {
3326
+			if anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7 {
3327
+				advice.AdviceName = "低分子肝素钠注射液"
3328
+				service.CreateDoctorAdvice(&advice)
3329
+			}
3330
+
3331
+		}
3332
+
3333
+		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
3334
+		redis := service.RedisClient()
3335
+		defer redis.Close()
3336
+		//清空key 值
3337
+		redis.Set(key, "", time.Second)
3338
+		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":advice_list_all"
3339
+		redis.Set(keyOne, "", time.Second)
3340
+
3341
+	}
3342
+
2960 3343
 	//获取key,清空redis
2961 3344
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2962 3345
 	redis := service.RedisClient()
@@ -3164,7 +3547,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3164 3547
 				record.UltrafiltrationRate = ultrafiltration_rate
3165 3548
 			}
3166 3549
 
3167
-			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 {
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 {
3168 3551
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3169 3552
 				record.UltrafiltrationRate = ultrafiltration_rate
3170 3553
 			}
@@ -3203,6 +3586,10 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3203 3586
 		}
3204 3587
 
3205 3588
 	}
3589
+	//长沙南雅累计血容量自动计算
3590
+	if adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 9671 {
3591
+		record.AccumulatedBloodVolume = (record.BloodFlowVolume - 25) * (math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * 60) / 1000
3592
+	}
3206 3593
 
3207 3594
 	if template.TemplateId == 47 || template.TemplateId == 54 {
3208 3595
 		record.DisplacementQuantity = record.DisplacementQuantity + record.DisplacementQuantity
@@ -3236,6 +3623,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
3236 3623
 	nuclein_date_str := this.GetString("nuclein_date_str")
3237 3624
 	order_remark := this.GetString("order_remark")
3238 3625
 	schedule_remark := this.GetString("schedule_remark")
3626
+	catheter_operation := this.GetString("catheter_operation")
3239 3627
 	if record_id == 0 {
3240 3628
 		this.ErrorLog("id:%v", record_id)
3241 3629
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -3400,13 +3788,12 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
3400 3788
 		NucleinDate:            theNucleinDate,
3401 3789
 		OrderRemark:            order_remark,
3402 3790
 		ScheduleRemark:         schedule_remark,
3791
+		CatheterOperation:      catheter_operation,
3403 3792
 	}
3404 3793
 
3794
+	//修改床位号需要重新消毒
3405 3795
 	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 {
3406
-
3407
-		if tempDialysisRecord.BedID != bedID {
3408
-			service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3409
-		}
3796
+		service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3410 3797
 	}
3411 3798
 
3412 3799
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
@@ -4790,6 +5177,10 @@ func (c *DialysisAPIController) CreateStockOutInfo() {
4790 5177
 				for _, item := range consumables {
4791 5178
 					//出库
4792 5179
 					err := service.ConsumablesGoodDelivery(item.UserOrgId, patient_id, record_time, item, &warehouseOut, item.Count)
5180
+
5181
+					//err := service.ConsumableMobileDelivery(item.UserOrgId, patient_id, record_time, item, &warehouseOut, adminInfo.AdminUser.Id, item.Count)
5182
+					//fmt.Println("item----------------------------------count", item.Count)
5183
+
4793 5184
 					if err == nil {
4794 5185
 						goodErrcode := models.XtGoodErrcode{
4795 5186
 							UserOrgId:      adminInfo.Org.Id,
@@ -4940,6 +5331,8 @@ func (c *DialysisAPIController) CreateStockOutInfo() {
4940 5331
 			for _, item := range consumables {
4941 5332
 				//出库
4942 5333
 				err := service.ConsumablesGoodDelivery(item.UserOrgId, patient_id, record_time, item, &out, item.Count)
5334
+				//err := service.ConsumableMobileDelivery(item.UserOrgId, patient_id, record_time, item, &out, adminInfo.AdminUser.Id, item.Count)
5335
+				//fmt.Println("item----------------------------------count", item.Count)
4943 5336
 				if err != nil {
4944 5337
 					goodErrcode := models.XtGoodErrcode{
4945 5338
 						UserOrgId:      adminInfo.Org.Id,
@@ -5213,6 +5606,7 @@ func (c *DialysisAPIController) EditConsumables() {
5213 5606
 
5214 5607
 				fmt.Println("退库长度", len(cancelbefor))
5215 5608
 				fmt.Println("出库长度", len(outbefor))
5609
+
5216 5610
 				//退库
5217 5611
 				for _, item := range cancelbefor {
5218 5612
 					warehouseOut, _ := service.FindStockOutByIsSys(adminInfo.Org.Id, 1, record_time)
@@ -5258,7 +5652,6 @@ func (c *DialysisAPIController) EditConsumables() {
5258 5652
 					warehouseOutInfo.LicenseNumber = stockInInfo.LicenseNumber
5259 5653
 					warehouseOutInfo.WarehouseInfotId = stockInInfo.ID
5260 5654
 					//查找当天是否存在出库记录
5261
-
5262 5655
 					_, errcod := service.GetWarehouseOutInfoIsExistOne(item.GoodId, patient_id, record_time, 0)
5263 5656
 
5264 5657
 					if errcod == gorm.ErrRecordNotFound {
@@ -5358,6 +5751,7 @@ func (c *DialysisAPIController) EditConsumables() {
5358 5751
 							StorehouseId:            houseConfig.StorehouseOutInfo,
5359 5752
 						}
5360 5753
 						exsit, errflows := service.GetStockFlowIsExsit(warehouseOutInfos.WarehouseInfotId, patient_id, record_time, item.GoodId)
5754
+
5361 5755
 						if errflows == gorm.ErrRecordNotFound {
5362 5756
 							//创建流水表
5363 5757
 							service.CreateStockFlowOne(stockFlow)
@@ -5478,8 +5872,6 @@ func (c *DialysisAPIController) EditConsumables() {
5478 5872
 
5479 5873
 					}
5480 5874
 
5481
-					//比较剩余库存 和 当前相差的数量,库存剩余量大于则正常出库
5482
-
5483 5875
 					//查询该耗材的总库存
5484 5876
 					wareinfo, _ := service.GetStockGoodCount(item.GoodId)
5485 5877
 					// 如果库存差大于剩余库存则提示库存不足
@@ -7774,3 +8166,33 @@ func (this *DialysisAPIController) CheckSchedule() {
7774 8166
 	}
7775 8167
 
7776 8168
 }
8169
+
8170
+func (this *DialysisAPIController) GetNewDoctorListToday() {
8171
+
8172
+	orgId := this.GetMobileAdminUserInfo().Org.Id
8173
+
8174
+	schedule_type, _ := this.GetInt64("schedule_type")
8175
+
8176
+	partion_type, _ := this.GetInt64("partion_type")
8177
+
8178
+	start_time := this.GetString("start_time")
8179
+	timeLayout := "2006-01-02"
8180
+	loc, _ := time.LoadLocation("Local")
8181
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8182
+	list, err := service.GetDialysisAdviceSchedulist(orgId, schedule_type, partion_type, startTime.Unix())
8183
+	_, config := service.FindXTHisRecordByOrgId(orgId)
8184
+	appId := this.GetMobileAdminUserInfo().App.Id
8185
+	doctorList, _ := service.GetAllAdminUsers(orgId, appId)
8186
+	if err == nil {
8187
+		this.ServeSuccessJSON(map[string]interface{}{
8188
+			"list":       list,
8189
+			"config":     config,
8190
+			"doctorList": doctorList,
8191
+		})
8192
+		return
8193
+
8194
+	} else {
8195
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
8196
+		return
8197
+	}
8198
+}

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Zobrazit soubor

@@ -188,4 +188,6 @@ func MobileAPIControllersRegisterRouters() {
188 188
 	beego.Router("/m/api/settlemobileadvice", &DialysisAPIController{}, "Get:GetSettleMobileAdvice")
189 189
 
190 190
 	beego.Router("/m/api/checkmobileadvice", &DialysisAPIController{}, "Get:GetCheckMobileAdvice")
191
+
192
+	beego.Router("/m/api/getnewdoctorlisttoday", &DialysisAPIController{}, "Get:GetNewDoctorListToday")
191 193
 }

+ 29 - 3
controllers/mobile_api_controllers/patient_api_controller.go Zobrazit soubor

@@ -3193,13 +3193,13 @@ func (c *PatientApiController) GetPatientMonitor() {
3193 3193
 			//获取所有分区
3194 3194
 			zoneList, _ := service.GetAllZoneByList(orgID)
3195 3195
 			//获取透析处方
3196
-			prescriptions, _ := service.GetAllPrescriptionByList(orgID, theStartTime)
3196
+			prescriptions, _ := service.GetAllPrescriptionByListSix(orgID, theStartTime)
3197 3197
 			//获取透前评估
3198 3198
 			assessmentBefores, _ := service.GetAllAssessmentBeforesByListOne(orgID, theStartTime)
3199 3199
 			//获取上机
3200 3200
 			dialysisOrders, _ := service.GetAllDialysisOrdersByListSix(orgID, theStartTime)
3201 3201
 			//获取透后
3202
-			AssessmentAfterDislysis, _ := service.GetAllAssessmentAfterDislysisByListOne(orgID, theStartTime)
3202
+			AssessmentAfterDislysis, _ := service.GetAllAssessmentAfterDislysisByListSix(orgID, theStartTime)
3203 3203
 
3204 3204
 			//获取透后监测
3205 3205
 			monitorlist, _ := service.GetAllMonitorList(orgID, theStartTime)
@@ -3349,7 +3349,7 @@ func (c *PatientApiController) GetPatientDialysisSolutionList() {
3349 3349
 	return
3350 3350
 }
3351 3351
 
3352
-//GetDoctorAdvices 医嘱列表
3352
+// GetDoctorAdvices 医嘱列表
3353 3353
 func (c *PatientApiController) GetDoctorAdvices() {
3354 3354
 	id, _ := c.GetInt64("id", 0)
3355 3355
 	adviceType, _ := c.GetInt64("advice_type", 0)
@@ -3708,6 +3708,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
3708 3708
 				subdrugs := adviceNameM["subdrugs"].([]interface{})
3709 3709
 				if len(subdrugs) > 0 {
3710 3710
 					for _, subdrug := range subdrugs {
3711
+
3711 3712
 						var s models.GroupAdvice
3712 3713
 						s.Remark = Remark
3713 3714
 						s.AdviceType = adviceType
@@ -3723,6 +3724,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
3723 3724
 						s.PatientId = patientInfo.ID
3724 3725
 						s.AdviceDoctor = adminUserInfo.AdminUser.Id
3725 3726
 						s.IsSettle = 2
3727
+
3726 3728
 						errcode := c.setAdviceWithJSON(&s, subdrug.(map[string]interface{}))
3727 3729
 						if errcode > 0 {
3728 3730
 							c.ServeFailJSONWithSGJErrorCode(errcode)
@@ -3734,6 +3736,18 @@ func (c *PatientApiController) CreateGroupAdvice() {
3734 3736
 				}
3735 3737
 			}
3736 3738
 
3739
+			//长沙南雅
3740
+			if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 9671 {
3741
+
3742
+				//查询该患者今日有没有双人核对
3743
+				check, _ := service.MobileGetDoubleCheckSix(adminUserInfo.Org.Id, patientInfo.ID, RecordDate)
3744
+
3745
+				if check.ID > 0 {
3746
+					advice.Checker = check.Modifier
3747
+					advice.CheckState = 1
3748
+					advice.CheckTime = time.Now().Unix()
3749
+				}
3750
+			}
3737 3751
 			advices = append(advices, &advice)
3738 3752
 		}
3739 3753
 
@@ -3810,6 +3824,18 @@ func (c *PatientApiController) CreateGroupAdvice() {
3810 3824
 		advice.PatientId = patient
3811 3825
 		advice.AdviceDoctor = adminUserInfo.AdminUser.Id
3812 3826
 		advice.IsSettle = 2
3827
+
3828
+		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 9671 {
3829
+
3830
+			//查询该患者今日有没有双人核对
3831
+			check, _ := service.MobileGetDoubleCheckSix(adminUserInfo.Org.Id, patientInfo.ID, advice.AdviceDate)
3832
+
3833
+			if check.ID > 0 {
3834
+				advice.Checker = check.Modifier
3835
+				advice.CheckState = 1
3836
+				advice.CheckTime = time.Now().Unix()
3837
+			}
3838
+		}
3813 3839
 		err := service.CreateDoctorAdvice(&advice)
3814 3840
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
3815 3841
 		redis := service.RedisClient()

+ 8 - 1
controllers/print_data_api_controller.go Zobrazit soubor

@@ -141,7 +141,14 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
141 141
 		for _, item := range schedules {
142 142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
143 143
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
144
-				item.Count = list.Count
144
+				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
145
+					listOrder, _ := service.GetDialysisOrderCountTen(item.PatientID, item.ScheduleDate)
146
+					item.Count = listOrder.DialysisTotal
147
+				}
148
+				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
149
+					item.Count = list.Count
150
+				}
151
+
145 152
 			}
146 153
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
147 154
 				//listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)

+ 8 - 4
controllers/schedule_api_controller.go Zobrazit soubor

@@ -3379,6 +3379,7 @@ func (this *ScheduleApiController) GetNextWeekDayScheduleOne() {
3379 3379
 	}
3380 3380
 
3381 3381
 	schedule, err := service.GetNextWeekDayScheduleSix(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone, theStartTIme)
3382
+	fmt.Println("schedule------------------------------------------------", len(schedule))
3382 3383
 	for _, item := range schedule {
3383 3384
 		order, _ := service.GetLastDialysisOrder(adminUserInfo.CurrentOrgId, item.PatientId, theStartTIme)
3384 3385
 		item.XtDialysisOrderSix = order
@@ -4103,11 +4104,14 @@ func (c *ScheduleApiController) GetScheduleOne() {
4103 4104
 	weekEndPoint := theEndTime.Unix()
4104 4105
 
4105 4106
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4107
+
4108
+	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4106 4109
 	c.ServeSuccessJSON(map[string]interface{}{
4107
-		"days":      days,
4108
-		"weekTitle": weekTitle,
4109
-		"schdules":  schdules,
4110
-		"today":     today,
4110
+		"days":           days,
4111
+		"weekTitle":      weekTitle,
4112
+		"schdules":       schdules,
4113
+		"today":          today,
4114
+		"schedulesGroup": schedulesGroup,
4111 4115
 	})
4112 4116
 	return
4113 4117
 }

+ 4 - 3
models/device_models.go Zobrazit soubor

@@ -110,6 +110,7 @@ type DeviceZone struct {
110 110
 	CreateTime int64  `gorm:"column:ctime" json:"-"`
111 111
 	ModifyTime int64  `gorm:"column:mtime" json:"-"`
112 112
 	Status     int64  `gorm:"column:status" json:"status" form:"status"`
113
+	Sort       int64  `gorm:"column:sort" json:"sort" form:"sort"`
113 114
 }
114 115
 
115 116
 func (DeviceZone) TableName() string {
@@ -696,7 +697,7 @@ type DeviceCultures struct {
696 697
 	Modifications     int64  `gorm:"column:modifications" json:"modifications" form:"modifications"`
697 698
 }
698 699
 
699
-//细菌培养检测
700
+// 细菌培养检测
700 701
 type DeviceCulture struct {
701 702
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
702 703
 	SpelingDate       int64  `gorm:"column:speling_date" json:"speling_date" form:"speling_date"`
@@ -749,7 +750,7 @@ type DeviceDialysates struct {
749 750
 	Modifications     int64  `gorm:"column:modifications" json:"modifications" form:"modifications"`
750 751
 }
751 752
 
752
-//内霉素检测
753
+// 内霉素检测
753 754
 type DeviceDialysate struct {
754 755
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
755 756
 	SamplingDate      int64  `gorm:"column:sampling_date" json:"sampling_date" form:"sampling_date"`
@@ -808,7 +809,7 @@ type DeviceIons struct {
808 809
 	Modifications   int64  `gorm:"column:modifications" json:"modifications" form:"modifications"`
809 810
 }
810 811
 
811
-//透析液离子浓度检测
812
+// 透析液离子浓度检测
812 813
 type DeviceIon struct {
813 814
 	ID              int64  `gorm:"column:id" json:"id" form:"id"`
814 815
 	SamplingDate    int64  `gorm:"column:sampling_date" json:"sampling_date" form:"sampling_date"`

+ 11 - 7
models/dialysis.go Zobrazit soubor

@@ -347,7 +347,7 @@ func (PredialysisEvaluationList) TableName() string {
347 347
 	return "xt_assessment_before_dislysis"
348 348
 }
349 349
 
350
-//更改的地方
350
+// 更改的地方
351 351
 type DoctorAdvices struct {
352 352
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
353 353
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
@@ -458,6 +458,7 @@ type DoctorAdvice struct {
458 458
 	IsMedicine            int64           `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
459 459
 	PushStartTime         int64           `gorm:"column:push_start_time" json:"push_start_time" form:"push_start_time"`
460 460
 	IsSettle              int64           `gorm:"column:is_settle" json:"is_settle" form:"is_settle"`
461
+	IsPrescription        int64           `gorm:"column:is_prescription" json:"is_prescription" form:"is_prescription"`
461 462
 }
462 463
 
463 464
 func (DoctorAdvice) TableName() string {
@@ -792,12 +793,13 @@ type DialysisOrders struct {
792 793
 }
793 794
 
794 795
 type VmDialysisOrder struct {
795
-	Count        int64
796
-	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date"`
797
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
798
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
799
-	Stage        int64 `gorm:"column:stage" json:"stage"`
800
-	Status       int64 `gorm:"column:status" json:"status"`
796
+	Count         int64
797
+	DialysisDate  int64 `gorm:"column:dialysis_date" json:"dialysis_date"`
798
+	UserOrgId     int64 `gorm:"column:user_org_id" json:"user_org_id"`
799
+	PatientId     int64 `gorm:"column:patient_id" json:"patient_id"`
800
+	Stage         int64 `gorm:"column:stage" json:"stage"`
801
+	Status        int64 `gorm:"column:status" json:"status"`
802
+	DialysisTotal int64 `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
801 803
 }
802 804
 
803 805
 func (VmDialysisOrder) TableName() string {
@@ -850,6 +852,7 @@ type DialysisOrder struct {
850 852
 	ScheduleRemark             string        `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
851 853
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
852 854
 	DialysisTotal              int64         `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
855
+	CatheterOperation          string        `gorm:"column:catheter_operation" json:"catheter_operation" form:"catheter_operation"`
853 856
 }
854 857
 
855 858
 func (DialysisOrder) TableName() string {
@@ -1383,6 +1386,7 @@ type XtDialysisOrderSix struct {
1383 1386
 	BloodAccessId      int64  `gorm:"column:blood_access_id" json:"blood_access_id" form:"blood_access_id"`
1384 1387
 	DialysisIrrigation string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
1385 1388
 	DialysisDialyszers string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
1389
+	ScheduleRemark     string `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1386 1390
 }
1387 1391
 
1388 1392
 func (XtDialysisOrderSix) TableName() string {

+ 17 - 13
models/new_monitor.go Zobrazit soubor

@@ -57,19 +57,20 @@ func (VMMonitorDialysisOrder) TableName() string {
57 57
 }
58 58
 
59 59
 type VMDialysisPrescription struct {
60
-	ID                    int64   `gorm:"column:id" json:"id"`
61
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id"`
62
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id"`
63
-	Status                int64   `gorm:"column:status" json:"status"`
64
-	RecordDate            int64   `gorm:"column:record_date" json:"record_date"`
65
-	TargetUltrafiltration float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration"`
66
-
60
+	ID                         int64   `gorm:"column:id" json:"id"`
61
+	UserOrgId                  int64   `gorm:"column:user_org_id" json:"user_org_id"`
62
+	PatientId                  int64   `gorm:"column:patient_id" json:"patient_id"`
63
+	Status                     int64   `gorm:"column:status" json:"status"`
64
+	RecordDate                 int64   `gorm:"column:record_date" json:"record_date"`
65
+	TargetUltrafiltration      float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration"`
67 66
 	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
68 67
 	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
69 68
 	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
70 69
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
71 70
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
72 71
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
72
+	DialysisDurationHour       int64   `gorm:"column:dialysis_duration_hour" json:"dialysis_duration_hour" form:"dialysis_duration_hour"`
73
+	DialysisDurationMinute     int64   `gorm:"column:dialysis_duration_minute" json:"dialysis_duration_minute" form:"dialysis_duration_minute"`
73 74
 }
74 75
 
75 76
 func (VMDialysisPrescription) TableName() string {
@@ -91,12 +92,15 @@ func (VMPredialysisEvaluation) TableName() string {
91 92
 }
92 93
 
93 94
 type VMAssessmentAfterDislysis struct {
94
-	ID             int64   `gorm:"column:id" json:"id"`
95
-	UserOrgId      int64   `gorm:"column:user_org_id" json:"user_org_id"`
96
-	PatientId      int64   `gorm:"column:patient_id" json:"patient_id"`
97
-	AssessmentDate int64   `gorm:"column:assessment_date" json:"assessment_date"`
98
-	WeightAfter    float64 `gorm:"column:weight_after" json:"weight_after"`
99
-	Status         int64   `gorm:"column:status" json:"status"`
95
+	ID                    int64   `gorm:"column:id" json:"id"`
96
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id"`
97
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id"`
98
+	AssessmentDate        int64   `gorm:"column:assessment_date" json:"assessment_date"`
99
+	WeightAfter           float64 `gorm:"column:weight_after" json:"weight_after"`
100
+	Status                int64   `gorm:"column:status" json:"status"`
101
+	ActualUltrafiltration float64 `gorm:"column:actual_ultrafiltration" json:"actual_ultrafiltration" form:"actual_ultrafiltration"`
102
+	ActualTreatmentHour   int64   `gorm:"column:actual_treatment_hour" json:"actual_treatment_hour" form:"actual_treatment_hour"`
103
+	ActualTreatmentMinute int64   `gorm:"column:actual_treatment_minute" json:"actual_treatment_minute" form:"actual_treatment_minute"`
100 104
 }
101 105
 
102 106
 func (VMAssessmentAfterDislysis) TableName() string {

+ 10 - 0
models/patient_models.go Zobrazit soubor

@@ -357,6 +357,11 @@ type DialysisPrescription struct {
357 357
 	AddAmount                  float64       `gorm:"column:add_amount" json:"add_amount" form:"add_amount"`
358 358
 	ReduceAmount               float64       `gorm:"column:reduce_amount" json:"reduce_amount" form:"reduce_amount"`
359 359
 	DialysisRemark             string        `gorm:"column:dialysis_remark" json:"dialysis_remark" form:"dialysis_remark"`
360
+	PrescribingNumber          float64       `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
361
+	TreatmentRemark            string        `gorm:"column:treatment_remark" json:"treatment_remark" form:"treatment_remark"`
362
+	PrescriptionSodium         string        `gorm:"column:prescription_sodium" json:"prescription_sodium" form:"prescription_sodium"`
363
+	StartSodium                string        `gorm:"column:start_sodium" json:"start_sodium" form:"start_sodium"`
364
+	SodiumCurve                string        `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
360 365
 }
361 366
 
362 367
 func (DialysisPrescription) TableName() string {
@@ -564,6 +569,11 @@ type DialysisSolution struct {
564 569
 	PreImpulse                 float64 `gorm:"column:pre_impulse" json:"pre_impulse" form:"pre_impulse"`
565 570
 	SolutionStatus             int64   `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
566 571
 	DialysisRemark             string  `gorm:"column:dialysis_remark" json:"dialysis_remark" form:"dialysis_remark"`
572
+	PrescribingNumber          float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
573
+	TreatmentRemark            string  `gorm:"column:treatment_remark" json:"treatment_remark" form:"treatment_remark"`
574
+	PrescriptionSodium         string  `gorm:"column:prescription_sodium" json:"prescription_sodium" form:"prescription_sodium"`
575
+	StartSodium                string  `gorm:"column:start_sodium" json:"start_sodium" form:"start_sodium"`
576
+	SodiumCurve                string  `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
567 577
 }
568 578
 
569 579
 func (DialysisSolution) TableName() string {

+ 40 - 0
models/schedule_models.go Zobrazit soubor

@@ -632,6 +632,46 @@ func (ScheduleNewPatients) TableName() string {
632 632
 	return "xt_schedule"
633 633
 }
634 634
 
635
+type MySchedule struct {
636
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
637
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
638
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
639
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
640
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
641
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
642
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
643
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
644
+	Count        int64
645
+}
646
+
647
+func (MySchedule) TableName() string {
648
+	return "xt_schedule"
649
+}
650
+
651
+type MyVmBloodSchedule struct {
652
+	ID                        int64                      `gorm:"column:id" json:"id" form:"id"`
653
+	UserOrgId                 int64                      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
654
+	PartitionId               int64                      `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
655
+	BedId                     int64                      `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
656
+	PatientId                 int64                      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
657
+	ScheduleDate              int64                      `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
658
+	ScheduleType              int64                      `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
659
+	ScheduleWeek              int64                      `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
660
+	ModeId                    int64                      `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
661
+	Status                    int64                      `gorm:"column:status" json:"status" form:"status"`
662
+	CreatedTime               int64                      `gorm:"column:created_time" json:"created_time" form:"created_time"`
663
+	UpdatedTime               int64                      `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
664
+	IsExport                  int64                      `gorm:"column:is_export" json:"is_export" form:"is_export"`
665
+	SchedualPatient           *NewMSchedualPatientVMList `gorm:"ForeignKey:PatientId" json:"patient"`
666
+	DialysisPrescription      DialysisPrescription       `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"dialysis_prescription"`
667
+	XtAssessmentAfterDislysis XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
668
+	MonitoringRecord          MonitoringRecord           `gorm:"ForeignKey:PatientId,MonitoringDate;AssociationForeignKey:PatientId,ScheduleDate" json:"monitor_record"`
669
+}
670
+
671
+func (MyVmBloodSchedule) TableName() string {
672
+	return "xt_schedule"
673
+}
674
+
635 675
 type ScheduleConfig struct {
636 676
 	ID            int64 `gorm:"column:id" json:"id" form:"id"`
637 677
 	UserOrgId     int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 3 - 3
service/device_service.go Zobrazit soubor

@@ -843,21 +843,21 @@ func GetScheduleTemplateForDeviceNumber(orgID int64, deviceNumberID int64, templ
843 843
 	return item, err
844 844
 }
845 845
 
846
-//某模板下,某周几下,该床位是否有患者
846
+// 某模板下,某周几下,该床位是否有患者
847 847
 func GetScheduleTemplateOne(orgID int64, deviceNumberID int64, template_id int64, week_type int64, time_type int64) (models.PatientScheduleTemplateItem, error) {
848 848
 	var item models.PatientScheduleTemplateItem
849 849
 	err := readDb.Model(&models.PatientScheduleTemplateItem{}).Where("device_number_id = ? AND org_id = ? AND status = 1 AND template_id = ? AND weekday = ? AND time_type = ?", deviceNumberID, orgID, template_id, week_type, time_type).First(&item).Error
850 850
 	return item, err
851 851
 }
852 852
 
853
-//某模板下,某周几下,是否有排班
853
+// 某模板下,某周几下,是否有排班
854 854
 func GetScheduleTemplateTwo(orgID int64, template_id int64, week_type int64, patient_id int64) (models.PatientScheduleTemplateItem, error) {
855 855
 	var item models.PatientScheduleTemplateItem
856 856
 	err := readDb.Model(&models.PatientScheduleTemplateItem{}).Where("patient_id = ? AND org_id = ? AND status = 1 AND template_id = ? AND weekday = ?", patient_id, orgID, template_id, week_type).First(&item).Error
857 857
 	return item, err
858 858
 }
859 859
 
860
-//某模板下,某周几下,该床位是否有患者(不包括当前排班的人)
860
+// 某模板下,某周几下,该床位是否有患者(不包括当前排班的人)
861 861
 func GetScheduleTemplateThree(orgID int64, deviceNumberID int64, template_id int64, week_type int64, time_type int64, patient_id int64) (models.PatientScheduleTemplateItem, error) {
862 862
 	var item models.PatientScheduleTemplateItem
863 863
 	err := readDb.Model(&models.PatientScheduleTemplateItem{}).Where("device_number_id = ? AND org_id = ? AND status = 1 AND template_id = ? AND weekday = ? AND time_type = ? AND patient_id <> ?", deviceNumberID, orgID, template_id, week_type, time_type, patient_id).First(&item).Error

+ 53 - 40
service/dialysis_service.go Zobrazit soubor

@@ -10,7 +10,7 @@ import (
10 10
 	"time"
11 11
 )
12 12
 
13
-//GetPatientList 返回患者的列表
13
+// GetPatientList 返回患者的列表
14 14
 func GetSchedualPatientList(orgID int64, schedulDate int64, schedulType int64, partitionType int64, keywords string, page int64, limit int64) (schedule []*models.DialysisSchedule, err error) {
15 15
 	var total int64
16 16
 	//if len(keywords) > 0 {
@@ -62,7 +62,7 @@ func GetSchedualPatientList(orgID int64, schedulDate int64, schedulType int64, p
62 62
 	return schedule, errors
63 63
 }
64 64
 
65
-//用户基本信息
65
+// 用户基本信息
66 66
 func FindPatientInfoById(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
67 67
 	err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
68 68
 		return db.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).Where("patient_id = ? AND user_org_id = ? AND schedule_date = ? ", id, orgID, time)
@@ -70,31 +70,31 @@ func FindPatientInfoById(orgID int64, id int64, time int64) (patient models.Sche
70 70
 	return
71 71
 }
72 72
 
73
-//透析处方
73
+// 透析处方
74 74
 func FindPatientPrescribeById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescription, err error) {
75 75
 	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id=? and status=1 and  record_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
76 76
 	return
77 77
 }
78 78
 
79
-//透析方案中的透析处方
79
+// 透析方案中的透析处方
80 80
 func FindDialysisSolution(orgID int64, patientsId int64) (patient models.DialysisSolution, err error) {
81 81
 	err = readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id=? and status=1", patientsId, orgID).Last(&patient).Error
82 82
 	return
83 83
 }
84 84
 
85
-//透析方案中的透析模式
85
+// 透析方案中的透析模式
86 86
 func FindTreatmentModeById(modeId int64) (mode models.TreatmentMode, err error) {
87 87
 	err = readDb.Model(&models.TreatmentMode{}).Where("id = ? AND status=1", modeId).First(&mode).Error
88 88
 	return
89 89
 }
90 90
 
91
-//接诊评估
91
+// 接诊评估
92 92
 func FindReceiverTreatmentAccessRecordById(orgID int64, patientsId int64, recordDate int64) (receiveTreatmentAsses models.ReceiveTreatmentAsses, err error) {
93 93
 	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ?", patientsId, orgID, recordDate).First(&receiveTreatmentAsses).Error
94 94
 	return
95 95
 }
96 96
 
97
-//透前评估
97
+// 透前评估
98 98
 func FindPredialysisEvaluationById(orgID int64, patientsId int64, recordDate int64) (patient models.PredialysisEvaluation, err error) {
99 99
 	err = readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ?", patientsId, orgID, recordDate).First(&patient).Error
100 100
 	return
@@ -106,7 +106,7 @@ func FindPredialysisName(id int64, orgid int64) (models.Dataconfig, error) {
106 106
 	return dataconfig, err
107 107
 }
108 108
 
109
-//临时医嘱
109
+// 临时医嘱
110 110
 func FindDoctorAdviceById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
111 111
 	err = readDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? AND  advice_type = 2", patientsId, orgID, recordDate).Find(&patient).Error
112 112
 	return
@@ -128,7 +128,7 @@ func GetTotalDialysisCout(orgid int64, patientid int64) (order []*models.Dialysi
128 128
 	return order, total, err
129 129
 }
130 130
 
131
-//临时医嘱
131
+// 临时医嘱
132 132
 func FindDoctorAdviceOrderById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
133 133
 	err = readDb.Model(&models.DoctorAdvice{}).
134 134
 		Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? and (advice_type = 2 or advice_type = 3)", patientsId, orgID, recordDate).
@@ -137,13 +137,13 @@ func FindDoctorAdviceOrderById(orgID int64, patientsId int64, recordDate int64)
137 137
 	return
138 138
 }
139 139
 
140
-//双人核对
140
+// 双人核对
141 141
 func FindDoubleCheckById(orgID int64, patientsId int64, recordDate int64) (patient models.DoubleCheck, err error) {
142 142
 	err = readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id=? and status=1 and check_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
143 143
 	return
144 144
 }
145 145
 
146
-//透析监测
146
+// 透析监测
147 147
 func FindAllMonitorRecord(orgID int64, patientsId int64, recordDate int64) (record []*models.MonitoringRecord, err error) {
148 148
 	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id=? and status=1 and monitoring_date = ?", patientsId, orgID, recordDate).Order("operate_time ASC").Find(&record).Error
149 149
 	return
@@ -154,37 +154,37 @@ func FindAllMonitor(orgID int64, patientsId int64, recordDate int64) (record []*
154 154
 	return
155 155
 }
156 156
 
157
-//透后评估
157
+// 透后评估
158 158
 func FindAssessmentAfterDislysisById(orgID int64, patientsId int64, recordDate int64) (patient models.AssessmentAfterDislysis, err error) {
159 159
 	err = readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date =?", patientsId, orgID, recordDate).First(&patient).Error
160 160
 	return
161 161
 }
162 162
 
163
-//治疗小结
163
+// 治疗小结
164 164
 func FindTreatmentSummaryById(orgID int64, patientsId int64, recordDate int64) (patient models.TreatmentSummary, err error) {
165 165
 	err = readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
166 166
 	return
167 167
 }
168 168
 
169
-//机构叫号配置
169
+// 机构叫号配置
170 170
 func FindQueueCallInfo(orgID int64) (queueConfig models.QueueCallConfig, err error) {
171 171
 	err = readDb.Model(&models.QueueCallConfig{}).Where("org_id=? ", orgID).First(&queueConfig).Error
172 172
 	return
173 173
 }
174 174
 
175
-//修改机构叫号配置
175
+// 修改机构叫号配置
176 176
 func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
177 177
 	err := writeDb.Save(&queueConfig).Error
178 178
 	return err
179 179
 }
180 180
 
181
-//所有设备信息
181
+// 所有设备信息
182 182
 func FindAllDeviceInfo(orgID int64) (device []*models.Device, err error) {
183 183
 	err = readDb.Model(&models.Device{}).Where("org_id=? and status=1 and device_type = 1", orgID).Find(&device).Error
184 184
 	return device, err
185 185
 }
186 186
 
187
-//所有设备区域
187
+// 所有设备区域
188 188
 func GetAllDeviceZone(orgId int64) (error, []*models.DeviceZone) {
189 189
 	var zone []*models.DeviceZone
190 190
 	err := readDb.Model(&zone).Where("org_id = ? AND status = 1", orgId).Find(&zone).Error
@@ -192,7 +192,7 @@ func GetAllDeviceZone(orgId int64) (error, []*models.DeviceZone) {
192 192
 	return err, zone
193 193
 }
194 194
 
195
-//获取所有子药物
195
+// 获取所有子药物
196 196
 func FindAllSubDoctorAdvice(id int64, parentId int64) (error, []models.DoctorAdvice) {
197 197
 	var subAdvies []models.DoctorAdvice
198 198
 	err := readDb.Model(&subAdvies).Where("patient_id = ? AND parent_id = ?", id, parentId).Find(&subAdvies).Error
@@ -272,7 +272,7 @@ func AddSigleDoubleCheck(check *models.DoubleCheck) (err error) {
272 272
 	return errors
273 273
 }
274 274
 
275
-//修改透析处方
275
+// 修改透析处方
276 276
 func UpDateDialysisPrescription(dialysisPrescription *models.DialysisPrescription) error {
277 277
 	tx := writeDb.Begin()
278 278
 	err := writeDb.Save(&dialysisPrescription).Error
@@ -283,25 +283,25 @@ func UpDateDialysisPrescription(dialysisPrescription *models.DialysisPrescriptio
283 283
 	return err
284 284
 }
285 285
 
286
-//修改接诊评估
286
+// 修改接诊评估
287 287
 func UpadateReceiveTreatmentAsses(receiveTreatmentAsses *models.ReceiveTreatmentAsses) error {
288 288
 	err := writeDb.Save(receiveTreatmentAsses).Error
289 289
 	return err
290 290
 }
291 291
 
292
-//修改透前评估
292
+// 修改透前评估
293 293
 func UpadatePredialysisEvaluation(predialysisEvaluation *models.PredialysisEvaluation) error {
294 294
 	err := writeDb.Save(&predialysisEvaluation).Error
295 295
 	return err
296 296
 }
297 297
 
298
-//修改双人核对
298
+// 修改双人核对
299 299
 func UpdateDoubleCheck(check *models.DoubleCheck) error {
300 300
 	err := writeDb.Save(&check).Error
301 301
 	return err
302 302
 }
303 303
 
304
-//修改透后评估
304
+// 修改透后评估
305 305
 func UpdateAssessmentAfterDislysisRecord(assessmentAfterDislysis *models.AssessmentAfterDislysis) error {
306 306
 	err := writeDb.Save(&assessmentAfterDislysis).Error
307 307
 	return err
@@ -330,21 +330,21 @@ func UpdatePredialysisEvaluationFour(predialysisevaluation *models.PredialysisEv
330 330
 	return err
331 331
 }
332 332
 
333
-//修改
333
+// 修改
334 334
 func UpdateSummeRecord(treatmentSummary *models.TreatmentSummary) error {
335 335
 	err := writeDb.Save(&treatmentSummary).Error
336 336
 	return err
337 337
 }
338 338
 
339
-// func UpdateDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
340
-// 	tx := writeDb.Begin()
341
-// 	err := tx.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND id = ? AND status = 1 ", patientId, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1, "checker": m.Checker}).Error
342
-// 	if err != nil {
343
-// 		tx.Rollback()
344
-// 	}
345
-// 	tx.Commit()
346
-// 	return err
347
-// }
339
+//	func UpdateDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
340
+//		tx := writeDb.Begin()
341
+//		err := tx.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND id = ? AND status = 1 ", patientId, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1, "checker": m.Checker}).Error
342
+//		if err != nil {
343
+//			tx.Rollback()
344
+//		}
345
+//		tx.Commit()
346
+//		return err
347
+//	}
348 348
 func ExceDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
349 349
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND (id = ? Or parent_id=?)  AND status = 1 ", patientId, id, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
350 350
 	return err
@@ -412,7 +412,7 @@ func UpdateSolution(solution *models.DialysisSolution) {
412 412
 
413 413
 }
414 414
 
415
-//创建长期处方
415
+// 创建长期处方
416 416
 func CreateSolution(solution *models.DialysisSolution) {
417 417
 	writeDb.Create(&solution)
418 418
 }
@@ -442,7 +442,7 @@ func SavePrescriptionAndCreateSolution(solution *models.DialysisSolution, prescr
442 442
 	return
443 443
 }
444 444
 
445
-//透析处方
445
+// 透析处方
446 446
 func FindDialysisPrescriptionByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DialysisPrescription) {
447 447
 	dialysisPrescription := models.DialysisPrescription{}
448 448
 	err := readDb.Model(&dialysisPrescription).Where("patient_id = ? AND  record_date = ? AND status = 1 AND user_org_id = ? ", id, recordDate, orgId).Find(&dialysisPrescription).Error
@@ -455,14 +455,14 @@ func FindReceiveTreatmentAssesByReordDate(id int64, recordDate int64, orgId int6
455 455
 	return err, &receiveTreatmentAsses
456 456
 }
457 457
 
458
-//透前评估
458
+// 透前评估
459 459
 func FindPredialysisEvaluationByReordDate(id int64, recordDate int64, orgId int64) (error, *models.PredialysisEvaluation) {
460 460
 	dialysisEvaluation := models.PredialysisEvaluation{}
461 461
 	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? AND  assessment_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&dialysisEvaluation).Error
462 462
 	return err, &dialysisEvaluation
463 463
 }
464 464
 
465
-//双人核对
465
+// 双人核对
466 466
 func FindDoubleCheckByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DoubleCheck) {
467 467
 	check := models.DoubleCheck{}
468 468
 	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? AND  check_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&check).Error
@@ -571,7 +571,7 @@ func UpdateSolutionByPatientId(id int64) error {
571 571
 
572 572
 }
573 573
 
574
-//更新透析处方记录ID
574
+// 更新透析处方记录ID
575 575
 func UpDateRecordIdToDialysisPrescription(patientId int64, orgId int64, recordTime int64, recordId int64) error {
576 576
 	errors := writeDb.Model(&models.DialysisPrescription{}).Where("user_org_id = ? AND patient_id = ? AND record_date = ? ", orgId, patientId, recordTime).Updates(map[string]interface{}{"record_id": recordId}).Error
577 577
 	return errors
@@ -612,7 +612,7 @@ func UpDateRecordIdToDoctorAdvice(patientId int64, orgId int64, recordTime int64
612 612
 	return errors
613 613
 }
614 614
 
615
-//透析处方
615
+// 透析处方
616 616
 func FindPatientPrescribeWidyDevideById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescriptionAddtional, err error) {
617 617
 	err = readDb.Preload("Device", "status = 1 AND org_id = ?", orgID).
618 618
 		Model(&models.DialysisPrescriptionAddtional{}).
@@ -687,7 +687,7 @@ func FindDoctorName(adminid int64, appid int64, orgid int64) (models.App_Roles,
687 687
 	return role, err
688 688
 }
689 689
 
690
-/////////////// 新 18-10-22
690
+// ///////////// 新 18-10-22
691 691
 func GetDialysisScheduals(orgID int64, scheduleDate int64) ([]*MDialysisScheduleVM, error) {
692 692
 	var vms []*MDialysisScheduleVM
693 693
 	db := readDb.
@@ -2051,3 +2051,16 @@ func GetFiledConfig(orgid int64) (models.FiledConfig, error) {
2051 2051
 	err := XTReadDB().Where("filed_name = 'dialyzer_perfusion_apparatus' and org_id = ? and module =1 and is_show = 1", orgid).First(&config).Error
2052 2052
 	return config, err
2053 2053
 }
2054
+
2055
+func GetDoctorAdviceCheckList(patient_id int64, advice_date int64, user_org_id int64) (doctor []*models.DoctorAdvice, err error) {
2056
+
2057
+	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id =? and status= 1 and check_state= 0", patient_id, advice_date, user_org_id).Find(&doctor).Error
2058
+	return doctor, err
2059
+}
2060
+
2061
+func UpdateDoctorAdviceList(id int64, checker int64) error {
2062
+
2063
+	advice := models.DoctorAdvice{}
2064
+	err := XTWriteDB().Model(&advice).Where("id = ? and status =1", id).Updates(map[string]interface{}{"checker": checker, "check_state": 1, "check_time": time.Now().Unix()}).Error
2065
+	return err
2066
+}

+ 1 - 1
service/dialysis_solution_service.go Zobrazit soubor

@@ -234,7 +234,7 @@ func GetDialysisAdviceSchedulist(orgID int64, schedule_type int64, partition_id
234 234
 	}
235 235
 	err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
236 236
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
237
-		Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ?", orgID, scheduleDate).
237
+		Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 2", orgID, scheduleDate).
238 238
 		Preload("HisDoctorAdvice", func(db *gorm.DB) *gorm.DB {
239 239
 			return db.Where("user_org_id = ? and status = 1 and advice_date = ?", orgID, scheduleDate).Preload("Drug", "org_id =? and status = 1", orgID)
240 240
 		}).Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error

+ 28 - 1
service/gobal_config_service.go Zobrazit soubor

@@ -237,7 +237,7 @@ func UpdateHisStockPriceRecord(config *models.HisStockPriceConfig) (err error) {
237 237
 	return
238 238
 }
239 239
 
240
-//TODO:项目开关
240
+// TODO:项目开关
241 241
 func FindXTHisProjectByOrgId(org_id int64) (err error, config models.XtHisProjectConfig) {
242 242
 	err = readDb.Model(&models.XtHisProjectConfig{}).Where("status = 1 AND user_org_id = ?", org_id).Find(&config).Error
243 243
 	return
@@ -1034,3 +1034,30 @@ func GetScheduleConfigById(id int64) (config models.ScheduleConfig, err error) {
1034 1034
 //	err = XTReadDB().Model(&models.ScheduleConfig{}).Where("id = ?", id).First(&config).Error
1035 1035
 //	return config, err
1036 1036
 //}
1037
+
1038
+func GetMobileScheduleList(orgid int64) (schedule []*models.MyVmBloodSchedule, err error) {
1039
+
1040
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and schedule_date>=1667232000 and schedule_date<=1669737600", orgid).Preload("SchedualPatient", "user_org_id = ? and status = 1", orgid).Find(&schedule).Error
1041
+	return schedule, err
1042
+}
1043
+
1044
+func GetPrescriptionList(patient_id int64, schedule_date int64, user_org_id int64) (models.DialysisPrescription, error) {
1045
+
1046
+	prescription := models.DialysisPrescription{}
1047
+	err := XTReadDB().Where("patient_id = ? and record_date =? and user_org_id = ? and status =1", patient_id, schedule_date, user_org_id).Find(&prescription).Error
1048
+	return prescription, err
1049
+}
1050
+
1051
+func GetLastMonitorRecordList(patient_id int64, schedule_date int64, user_org_id int64) (models.MonitoringRecord, error) {
1052
+
1053
+	record := models.MonitoringRecord{}
1054
+	err := XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Last(&record).Error
1055
+	return record, err
1056
+}
1057
+
1058
+func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {
1059
+
1060
+	dislysis := models.XtAssessmentAfterDislysis{}
1061
+	err := XTReadDB().Where("patient_id = ? and assessment_date = ? and user_org_id =? and status= 1", patient_id, schedule_date, user_org_id).Find(&dislysis).Error
1062
+	return dislysis, err
1063
+}

+ 12 - 0
service/inspection_service.go Zobrazit soubor

@@ -33,6 +33,18 @@ func GetAdvices(orgid int64, patientid int64, recorddate int64) (advcie []*model
33 33
 	err = XTReadDB().Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id = ? and record_date = ? and status =1", patientid, orgid, recorddate).Find(&advcie).Error
34 34
 	return
35 35
 }
36
+func GetAdvicesByPrescription(orgid int64, patientid int64, recorddate int64) (models.DoctorAdvice, error) {
37
+	advice := models.DoctorAdvice{}
38
+	err = XTReadDB().Where("patient_id = ? and user_org_id = ? and record_date = ? and status =1 and is_prescription = 1", patientid, orgid, recorddate).Find(&advice).Error
39
+	return advice, err
40
+}
41
+
42
+func UpdateDoctorAdvieById(id int64, prescription_number float64) (models.DoctorAdvice, error) {
43
+
44
+	advice := models.DoctorAdvice{}
45
+	err := XTWriteDB().Model(&advice).Where("id=? and status= 1", id).Updates(map[string]interface{}{"prescribing_number": prescription_number}).Error
46
+	return advice, err
47
+}
36 48
 
37 49
 func CreatePatientInspection(inspectins []models.Inspection) (err error) {
38 50
 	if len(inspectins) == 0 {

+ 9 - 1
service/mobile_dialysis_service.go Zobrazit soubor

@@ -2214,7 +2214,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
2214 2214
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2215 2215
 	tx := writeDb.Begin()
2216 2216
 	updateTime := time.Now().Unix()
2217
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark}).Error
2217
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark, "catheter_operation": order.CatheterOperation}).Error
2218 2218
 	if err != nil {
2219 2219
 		tx.Rollback()
2220 2220
 		return err
@@ -5249,3 +5249,11 @@ func UpdateDeviceInformation(patientid int64, dialysis_date int64) error {
5249 5249
 	err := UserWriteDB().Model(&information).Where("patient_id = ? and date = ? and status = 1", patientid, dialysis_date).Update(map[string]interface{}{"status": 0}).Error
5250 5250
 	return err
5251 5251
 }
5252
+
5253
+func MobileGetDoubleCheckSix(orgID int64, patientID int64, recordDate int64) (models.DoubleCheck, error) {
5254
+	var record models.DoubleCheck
5255
+
5256
+	err := readDb.Where("patient_id = ? and user_org_id = ? and status = 1 and check_date = ?", patientID, orgID, recordDate).First(&record).Error
5257
+
5258
+	return record, err
5259
+}

+ 77 - 7
service/patient_service.go Zobrazit soubor

@@ -11,7 +11,7 @@ import (
11 11
 	"github.com/jinzhu/gorm"
12 12
 )
13 13
 
14
-//GetPatientList 返回患者的列表
14
+// GetPatientList 返回患者的列表
15 15
 func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool) (patients []*models.Patients, total int64, err error) {
16 16
 
17 17
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
@@ -79,7 +79,7 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
79 79
 
80 80
 }
81 81
 
82
-//GetAllPatientList 返回全部患者的列表
82
+// GetAllPatientList 返回全部患者的列表
83 83
 func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, err error) {
84 84
 
85 85
 	db := readDb.Table("xt_patients as p").Where("p.user_org_id=? and p.status=1", orgID)
@@ -103,7 +103,7 @@ func GetAllPatientListSix(orgID int64) (patients []*models.MSchedualPatientList,
103 103
 	return patients, err
104 104
 }
105 105
 
106
-//GetAllPatientList 返回全部患者的列表
106
+// GetAllPatientList 返回全部患者的列表
107 107
 func GetAllPatientListByList(orgID int64) (patients []*models.MSchedualPatientList, err error) {
108 108
 	redis := RedisClient()
109 109
 	defer redis.Close()
@@ -557,10 +557,10 @@ func FindPatientByIdTwo(orgID int64, id int64) (patient models.XtPatientsNew, er
557 557
 	return
558 558
 }
559 559
 
560
-//func FindPatientByIdWithDiseases(orgID int64, id int64) (patient models.Patients, err error) {
560
+// func FindPatientByIdWithDiseases(orgID int64, id int64) (patient models.Patients, err error) {
561 561
 // 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
562 562
 // return
563
-//}
563
+// }
564 564
 func FindPatientByIdWithDiseases(orgID int64, id int64) (patient models.Patients, err error) {
565 565
 	redis := RedisClient()
566 566
 	defer redis.Close()
@@ -919,7 +919,7 @@ func UpdatePatientDialysisSolution(solution *models.DialysisSolution) (err error
919 919
 	return
920 920
 }
921 921
 
922
-//GetPatientDialysisSolutionList 返回患者透析方案的列表
922
+// GetPatientDialysisSolutionList 返回患者透析方案的列表
923 923
 func GetPatientDialysisSolutionList(orgID int64, patientID int64, page, limit int64) (solutions []*models.DialysisSolution, total int64, err error) {
924 924
 
925 925
 	offset := (page - 1) * limit
@@ -964,7 +964,7 @@ func GetPatientDialysisSolutionList(orgID int64, patientID int64, page, limit in
964 964
 	return
965 965
 }
966 966
 
967
-//GetPatientDryWeightAdjustList 返回患者调整干体重的列表
967
+// GetPatientDryWeightAdjustList 返回患者调整干体重的列表
968 968
 func GetPatientDryWeightAdjustList(orgID int64, patientID int64, page int64, limit int64) (weights []*models.DryWeightAdjust, total int64, err error) {
969 969
 	db := readDb.Table("xt_dry_weight_adjust as dwa").Where("dwa.status=1")
970 970
 	if orgID > 0 {
@@ -2358,11 +2358,46 @@ func GetAllDialysisOrdersByListSeven(orgID int64, scheduleDate int64) (dialysisO
2358 2358
 	return dialysisOrders, err
2359 2359
 }
2360 2360
 
2361
+func GetAllPrescriptionByListSix(orgID int64, scheduleDate int64) (prescriptions []*models.VMDialysisPrescription, err error) {
2362
+
2363
+	err = readDb.Model(&models.VMDialysisPrescription{}).Where("status= 1 and user_org_id = ? and record_date = ?", orgID, scheduleDate).Find(&prescriptions).Error
2364
+	return prescriptions, err
2365
+	//redis := RedisClient()
2366
+	//defer redis.Close()
2367
+	//key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":prescriptions_list_all"
2368
+	//redis.Set(key, "", time.Second)
2369
+	//prescriptions_list_all, _ := redis.Get(key).Result()
2370
+	//
2371
+	//if len(prescriptions_list_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2372
+	//	err = readDb.Model(&models.VMDialysisPrescription{}).Where("status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).Find(&prescriptions).Error
2373
+	//	if err != nil {
2374
+	//		if err == gorm.ErrRecordNotFound {
2375
+	//			return nil, nil
2376
+	//		} else {
2377
+	//			return nil, err
2378
+	//		}
2379
+	//	} else {
2380
+	//		if len(prescriptions) > 0 {
2381
+	//			//缓存数据
2382
+	//			prescriptions_list_all, err := json.Marshal(&prescriptions)
2383
+	//			if err == nil {
2384
+	//				redis.Set(key, prescriptions_list_all, time.Second*60*60*18)
2385
+	//			}
2386
+	//		}
2387
+	//		return prescriptions, nil
2388
+	//	}
2389
+	//} else { //缓存数据了数据,将redis缓存的json字符串转为map
2390
+	//	json.Unmarshal([]byte(prescriptions_list_all), &prescriptions)
2391
+	//	return prescriptions, nil
2392
+	//}
2393
+}
2394
+
2361 2395
 func GetAllPrescriptionByList(orgID int64, scheduleDate int64) (prescriptions []*models.VMDialysisPrescription, err error) {
2362 2396
 
2363 2397
 	redis := RedisClient()
2364 2398
 	defer redis.Close()
2365 2399
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":prescriptions_list_all"
2400
+	redis.Set(key, "", time.Second)
2366 2401
 	prescriptions_list_all, _ := redis.Get(key).Result()
2367 2402
 
2368 2403
 	if len(prescriptions_list_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -2457,10 +2492,45 @@ func GetAllDialysisOrdersByListOne(orgID int64, scheduleDate int64) (dialysisOrd
2457 2492
 	}
2458 2493
 }
2459 2494
 
2495
+func GetAllAssessmentAfterDislysisByListSix(orgID int64, scheduleDate int64) (assessmentAfterDislysis []*models.VMAssessmentAfterDislysis, err error) {
2496
+
2497
+	err = readDb.Model(&models.VMAssessmentAfterDislysis{}).Where("status=1 and user_org_id = ? and assessment_date = ?", orgID, scheduleDate).Find(&assessmentAfterDislysis).Error
2498
+	return assessmentAfterDislysis, err
2499
+	//redis := RedisClient()
2500
+	//defer redis.Close()
2501
+	//key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":assessment_after_dislysis_list_all"
2502
+	//redis.Set(key, "", time.Second)
2503
+	//assessment_after_dislysis__all, _ := redis.Get(key).Result()
2504
+	//
2505
+	//if len(assessment_after_dislysis__all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2506
+	//	err = readDb.Model(&models.VMAssessmentAfterDislysis{}).Where("status = 1  AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).Find(&assessmentAfterDislysis).Error
2507
+	//	if err != nil {
2508
+	//		if err == gorm.ErrRecordNotFound {
2509
+	//			return nil, nil
2510
+	//		} else {
2511
+	//			return nil, err
2512
+	//		}
2513
+	//	} else {
2514
+	//		if len(assessmentAfterDislysis) > 0 {
2515
+	//			//缓存数据
2516
+	//			assessment_after_dislysis__all, err := json.Marshal(&assessmentAfterDislysis)
2517
+	//			if err == nil {
2518
+	//				redis.Set(key, assessment_after_dislysis__all, time.Second*60*60*18)
2519
+	//			}
2520
+	//		}
2521
+	//		return assessmentAfterDislysis, nil
2522
+	//	}
2523
+	//} else { //缓存数据了数据,将redis缓存的json字符串转为map
2524
+	//	json.Unmarshal([]byte(assessment_after_dislysis__all), &assessmentAfterDislysis)
2525
+	//	return assessmentAfterDislysis, nil
2526
+	//}
2527
+}
2528
+
2460 2529
 func GetAllAssessmentAfterDislysisByListOne(orgID int64, scheduleDate int64) (assessmentAfterDislysis []*models.VMAssessmentAfterDislysis, err error) {
2461 2530
 	redis := RedisClient()
2462 2531
 	defer redis.Close()
2463 2532
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":assessment_after_dislysis_list_all"
2533
+	redis.Set(key, "", time.Second)
2464 2534
 	assessment_after_dislysis__all, _ := redis.Get(key).Result()
2465 2535
 
2466 2536
 	if len(assessment_after_dislysis__all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis

+ 8 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Zobrazit soubor

@@ -207,7 +207,13 @@ func GetDialysisOrderCount(orgID int64, patient_id int64, recordDate int64) (cou
207 207
 
208 208
 func GetDialysisOrderCountSeven(patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
209 209
 	order := models.VmDialysisOrder{}
210
-	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ?", recordDate, patient_id).Scan(&order).Error
210
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date,dialysis_total from xt_dialysis_order where dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ?", recordDate, patient_id).Scan(&order).Error
211
+	return order, err
212
+}
213
+
214
+func GetDialysisOrderCountTen(patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
215
+	order := models.VmDialysisOrder{}
216
+	err := p_service.XTReadDB().Where("patient_id = ? and dialysis_date = ? and status = 1", patient_id, recordDate).Last(&order).Error
211 217
 	return order, err
212 218
 }
213 219
 
@@ -456,7 +462,7 @@ func GetHisBatchDoctorAdvice(orgid int64, patient_id int64, advice_date int64) (
456 462
 
457 463
 func GetHisBatchProject(orgid int64, patient_id int64, advice_date int64) (project []*models.HisPrescriptionProject, err error) {
458 464
 
459
-	err = p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and record_date = ? and status= 1", orgid, patient_id, advice_date).Find(&project).Error
465
+	err = p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and record_date = ? and status= 1", orgid, patient_id, advice_date).Preload("HisProject").Preload("GoodInfo", "status=1").Find(&project).Error
460 466
 	return project, err
461 467
 }
462 468
 

+ 25 - 0
service/schedule_service.go Zobrazit soubor

@@ -129,6 +129,31 @@ func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, schedule
129 129
 	return
130 130
 }
131 131
 
132
+func GetScheduleTotalCount(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.MySchedule, err error) {
133
+
134
+	db := readDb.Table("xt_schedule as s").Where("status= 1 and (mode_id = 2 or mode_id= 3)")
135
+	if len(schIds) > 0 {
136
+		db = db.Where("s.partition_id in (?)", schIds)
137
+	}
138
+	if scheduletype > 0 {
139
+		db = db.Where("s.schedule_type = ?", scheduletype)
140
+	}
141
+	if orgID > 0 {
142
+		db = db.Where("s.user_org_id = ?", orgID)
143
+	}
144
+	if start > 0 {
145
+		db = db.Where("s.schedule_date>=?", start)
146
+	}
147
+	if end > 0 {
148
+		db = db.Where("s.schedule_date<=?", end)
149
+	}
150
+
151
+	err = db.Select("Count(id) as count,schedule_date,mode_id,user_org_id,schedule_week,schedule_type").Group("schedule_date,schedule_type,mode_id").Find(&schedules).Error
152
+
153
+	return schedules, err
154
+
155
+}
156
+
132 157
 func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, scheduletype int64, WeekDayIds []string) (schedules []*models.Schedule, err error) {
133 158
 
134 159
 	db := readDb.Table("xt_schedule as s")

+ 2 - 2
service/user_service.go Zobrazit soubor

@@ -28,7 +28,7 @@ type AdminUserList struct {
28 28
 	Status   int64  `json:"status"`
29 29
 }
30 30
 
31
-func GetAllDoctorAndNurse(orgId, appid int64) (doctors []AdminUserList, nurses []AdminUserList, err error) {
31
+func GetAllDoctorAndNurse(orgId int64, appid int64) (doctors []AdminUserList, nurses []AdminUserList, err error) {
32 32
 
33 33
 	var users []AdminUserList
34 34
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1 and org_id=? and app_id =? and uar.user_type IN (2,3) and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&users).Error
@@ -48,7 +48,7 @@ func GetAllDoctorAndNurse(orgId, appid int64) (doctors []AdminUserList, nurses [
48 48
 	return
49 49
 }
50 50
 
51
-func GetAllDoctorAndNurseSix(orgId, appid int64) (doctors []AdminUserList, nurses []AdminUserList, err error) {
51
+func GetAllDoctorAndNurseSix(orgId int64, appid int64) (doctors []AdminUserList, nurses []AdminUserList, err error) {
52 52
 
53 53
 	var users []AdminUserList
54 54
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("org_id=? and app_id =? and uar.user_type IN (2,3)", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&users).Error