Просмотр исходного кода

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

陈少旭 1 год назад
Родитель
Сommit
41c216d6f8

+ 7 - 7
controllers/base_api_controller.go Просмотреть файл

73
 		var userAdmin models.AdminUser
73
 		var userAdmin models.AdminUser
74
 		userAdmin.Id = 16919
74
 		userAdmin.Id = 16919
75
 		userAdmin.Mobile = "15717313968"
75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 10344 //4,809
76
+		userAdmin.Id = 10579 //4,809
77
 		userAdmin.Mobile = "12222222222"
77
 		userAdmin.Mobile = "12222222222"
78
 		userAdmin.IsSuperAdmin = true
78
 		userAdmin.IsSuperAdmin = true
79
 		userAdmin.Status = 1
79
 		userAdmin.Status = 1
81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10206 //机构id 10344
84
+		subscibe.OrgId = 10344 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
95
-		adminUserInfo.CurrentAppId = 17282 //4
94
+		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
95
+		adminUserInfo.CurrentAppId = 14655 //4
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
98
 		this.SetSession("admin_user_info", &adminUserInfo)
98
 		this.SetSession("admin_user_info", &adminUserInfo)
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10206 //机构id小英10344或4
329
+		subscibe.OrgId = 10344 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
337
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
340
-		adminUserInfo.CurrentAppId = 17282 //4
339
+		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
340
+		adminUserInfo.CurrentAppId = 14655 //4
341
 		adminUserInfo.AdminUser = &userAdmin
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
342
 		adminUserInfo.Subscibes = subscibes
343
 		this.SetSession("admin_user_info", &adminUserInfo)
343
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 1
controllers/data_api_controller.go Просмотреть файл

884
 	ef.UpdatedTime = timeNow
884
 	ef.UpdatedTime = timeNow
885
 	ef.Name = efdata.Name
885
 	ef.Name = efdata.Name
886
 	ef.Code = efdata.Code
886
 	ef.Code = efdata.Code
887
-
887
+	ef.Count = efdata.Count
888
 	err = service.UpdateExecutionFrequency(ef)
888
 	err = service.UpdateExecutionFrequency(ef)
889
 	if err != nil {
889
 	if err != nil {
890
 		utils.ErrorLog("%v", err)
890
 		utils.ErrorLog("%v", err)

+ 65 - 3
controllers/dialysis_api_controller.go Просмотреть файл

141
 	beego.Router("/api/patient/getgathersetting", &DialysisApiController{}, "Get:GetGatherSetting")
141
 	beego.Router("/api/patient/getgathersetting", &DialysisApiController{}, "Get:GetGatherSetting")
142
 
142
 
143
 	beego.Router("/api/patient/getdialysisgatherlist", &DialysisApiController{}, "Get:GetDialysisGatherList")
143
 	beego.Router("/api/patient/getdialysisgatherlist", &DialysisApiController{}, "Get:GetDialysisGatherList")
144
+
145
+	beego.Router("/api/getpatientdialysisrecordlist", &DialysisApiController{}, "Get:GetPatientDialysisRecordList")
144
 }
146
 }
145
 
147
 
146
 func (c *DialysisApiController) GetQueueCall() {
148
 func (c *DialysisApiController) GetQueueCall() {
2594
 				//lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribe(adminUserInfo.Org.Id, id,schedual.ModeId)
2596
 				//lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribe(adminUserInfo.Org.Id, id,schedual.ModeId)
2595
 				// 获取透析模版
2597
 				// 获取透析模版
2596
 				dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
2598
 				dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
2597
-				dialysisSolution, _ = service.MobileGetDialysisSolution(adminUserInfo.CurrentOrgId, patient)
2599
+				// 获取透析模版
2600
+				dialysisSolution, _ = service.MobileGetDialysisSolutionByModeIdSix(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)
2598
 
2601
 
2599
 				if dialysisPrescribe == nil && dialysisSolution != nil {
2602
 				if dialysisPrescribe == nil && dialysisSolution != nil {
2600
 					mode_id = dialysisSolution.ModeId
2603
 					mode_id = dialysisSolution.ModeId
2648
 				newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
2651
 				newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
2649
 				newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
2652
 				newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
2650
 				newprescribe.TargetKtv = dialysisSolution.TargetKtv
2653
 				newprescribe.TargetKtv = dialysisSolution.TargetKtv
2651
-
2654
+				newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
2655
+				newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2656
+				newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
2652
 				newprescribe.CreatedTime = time.Now().Unix()
2657
 				newprescribe.CreatedTime = time.Now().Unix()
2653
 				newprescribe.UpdatedTime = time.Now().Unix()
2658
 				newprescribe.UpdatedTime = time.Now().Unix()
2654
 				newprescribe.RecordDate = recordDate.Unix()
2659
 				newprescribe.RecordDate = recordDate.Unix()
2720
 					newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
2725
 					newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
2721
 					newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
2726
 					newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
2722
 					newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
2727
 					newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
2728
+					newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
2729
+					newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2730
+					newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
2723
 					newprescribe.CreatedTime = time.Now().Unix()
2731
 					newprescribe.CreatedTime = time.Now().Unix()
2724
 					newprescribe.UpdatedTime = time.Now().Unix()
2732
 					newprescribe.UpdatedTime = time.Now().Unix()
2725
 					newprescribe.RecordDate = recordDate.Unix()
2733
 					newprescribe.RecordDate = recordDate.Unix()
2951
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
2959
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
2952
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
2960
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
2953
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
2961
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
2954
-
2962
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
2963
+			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2964
+			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
2955
 			newprescribe.CreatedTime = time.Now().Unix()
2965
 			newprescribe.CreatedTime = time.Now().Unix()
2956
 			newprescribe.UpdatedTime = time.Now().Unix()
2966
 			newprescribe.UpdatedTime = time.Now().Unix()
2957
 			newprescribe.RecordDate = recordDate.Unix()
2967
 			newprescribe.RecordDate = recordDate.Unix()
3028
 				newprescribe.DewaterAmount = dewater_amount
3038
 				newprescribe.DewaterAmount = dewater_amount
3029
 				newprescribe.TargetUltrafiltration = dewater_amount
3039
 				newprescribe.TargetUltrafiltration = dewater_amount
3030
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3040
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3041
+				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3042
+				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3043
+				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3031
 				newprescribe.Status = 1
3044
 				newprescribe.Status = 1
3032
 
3045
 
3033
 				err := service.AddSigleRecord(&newprescribe)
3046
 				err := service.AddSigleRecord(&newprescribe)
7618
 	})
7631
 	})
7619
 	return
7632
 	return
7620
 }
7633
 }
7634
+
7635
+func (this *DialysisApiController) GetPatientDialysisRecordList() {
7636
+
7637
+	patient_id, _ := this.GetInt64("patient_id")
7638
+
7639
+	timeLayout := "2006-01-02"
7640
+	loc, _ := time.LoadLocation("Local")
7641
+
7642
+	start_time := this.GetString("start_time")
7643
+
7644
+	end_time := this.GetString("end_time")
7645
+
7646
+	var startdateunix int64
7647
+	if len(start_time) > 0 {
7648
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7649
+		if err != nil {
7650
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7651
+			return
7652
+		}
7653
+		startdateunix = theTime.Unix()
7654
+	}
7655
+	var enddateunix int64
7656
+	if len(end_time) > 0 {
7657
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
7658
+		if err != nil {
7659
+			utils.ErrorLog(err.Error())
7660
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7661
+			return
7662
+		}
7663
+		enddateunix = theTime.Unix()
7664
+	}
7665
+
7666
+	org_id := this.GetAdminUserInfo().CurrentOrgId
7667
+
7668
+	if org_id == 9538 || org_id == 10101 || org_id == 10353 {
7669
+		list, _ := service.GetPatientDialysisRecordList(patient_id, startdateunix, enddateunix)
7670
+		this.ServeSuccessJSON(map[string]interface{}{
7671
+			"list": list,
7672
+		})
7673
+		return
7674
+	} else {
7675
+		list, _ := service.GetPatientDialysisRecordListOne(patient_id, startdateunix, enddateunix)
7676
+		this.ServeSuccessJSON(map[string]interface{}{
7677
+			"list": list,
7678
+		})
7679
+	}
7680
+
7681
+	return
7682
+}

+ 1 - 0
controllers/his_config_api_controller.go Просмотреть файл

1112
 	var list []*models.DialysisPatient
1112
 	var list []*models.DialysisPatient
1113
 	finlist := make([]*models.DialysisPatient, 0) //筛选后的列表
1113
 	finlist := make([]*models.DialysisPatient, 0) //筛选后的列表
1114
 	list, err = service.GetDialysisModePatient(orgid, mode)
1114
 	list, err = service.GetDialysisModePatient(orgid, mode)
1115
+	fmt.Println("list-----------------", list)
1115
 	if err != nil {
1116
 	if err != nil {
1116
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1117
 		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
1117
 		return
1118
 		return

+ 2 - 0
controllers/his_project_api_controller.go Просмотреть файл

1295
 
1295
 
1296
 	eles, _ := service.GetNewAdminUserES(adminUserInfo.CurrentOrgId)
1296
 	eles, _ := service.GetNewAdminUserES(adminUserInfo.CurrentOrgId)
1297
 
1297
 
1298
+	roles, _ := service.GetAllDoctor(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
1298
 	if err != nil {
1299
 	if err != nil {
1299
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1300
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1300
 		return
1301
 		return
1308
 		"info":              prescriptionInfo,
1309
 		"info":              prescriptionInfo,
1309
 		"eles":              eles,
1310
 		"eles":              eles,
1310
 		"psn_info":          psn_info,
1311
 		"psn_info":          psn_info,
1312
+		"roles":             roles,
1311
 	})
1313
 	})
1312
 }
1314
 }
1313
 
1315
 

+ 328 - 64
controllers/mobile_api_controllers/check_weight_api_controller.go Просмотреть файл

428
 				newprescribe.Remark = lastDialysisPrescription.Remark
428
 				newprescribe.Remark = lastDialysisPrescription.Remark
429
 			}
429
 			}
430
 
430
 
431
+			//恒泰
432
+			if adminUserInfo.Org.Id == 10490 {
433
+				newprescribe.Remark = ""
434
+			}
435
+
436
+			if adminUserInfo.Org.Id == 10599 {
437
+				// 获取透析模版
438
+				solutionone, _ := service.MobileGetDialysisSolutionByModeIdSevenTwety(adminUserInfo.Org.Id, id, schedual.ModeId)
439
+				if solutionone.Anticoagulant > 0 {
440
+					newprescribe.Anticoagulant = solutionone.Anticoagulant
441
+					newprescribe.AnticoagulantShouji = solutionone.AnticoagulantShouji
442
+					newprescribe.AnticoagulantWeichi = solutionone.AnticoagulantWeichi
443
+					newprescribe.AnticoagulantZongliang = solutionone.AnticoagulantZongliang
444
+					newprescribe.BloodAccess = solutionone.BloodAccess
445
+					newprescribe.DialysisDurationHour = solutionone.DialysisDurationHour
446
+					newprescribe.DialysisDurationMinute = solutionone.DialysisDurationMinute
447
+					newprescribe.DialysisIrrigation = solutionone.DialysisIrrigation
448
+					newprescribe.DialysisDialyszers = solutionone.DialysisDialyszers
449
+					newprescribe.DialysisStrainer = solutionone.DialysisStrainer
450
+
451
+				}
452
+
453
+			}
454
+
431
 			//针对普宁和揭阳
455
 			//针对普宁和揭阳
432
 			if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
456
 			if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
433
 				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
457
 				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
524
 				newprescribe.TargetUltrafiltration = dewater_amount
548
 				newprescribe.TargetUltrafiltration = dewater_amount
525
 				newprescribe.PrescriptionWater = dewater_amount
549
 				newprescribe.PrescriptionWater = dewater_amount
526
 				newprescribe.Status = 1
550
 				newprescribe.Status = 1
527
-				if adminUserInfo.Org.Id != 10490 {
528
-					newprescribe.Remark = lastDialysisPrescribe.Remark
529
-				} else {
551
+				//if adminUserInfo.Org.Id != 10490 {
552
+				//	newprescribe.Remark = lastDialysisPrescribe.Remark
553
+				//} else {
554
+				//	newprescribe.Remark = ""
555
+				//}
556
+				if adminUserInfo.Org.Id == 10490 {
530
 					newprescribe.Remark = ""
557
 					newprescribe.Remark = ""
531
 				}
558
 				}
532
 
559
 
1226
 			if daySchedule[0].Schedule.ID > 0 {
1253
 			if daySchedule[0].Schedule.ID > 0 {
1227
 				sc["code"] = 0
1254
 				sc["code"] = 0
1228
 				sc["msg"] = ""
1255
 				sc["msg"] = ""
1229
-				sc["mode"] = daySchedule[0].Schedule.ModeId
1256
+				var mode = "HD"
1257
+				if daySchedule[0].Schedule.ModeId == 1 {
1258
+					mode = "HD"
1259
+				}
1260
+
1261
+				if daySchedule[0].Schedule.ModeId == 2 {
1262
+					mode = "HDF"
1263
+				}
1264
+
1265
+				if daySchedule[0].Schedule.ModeId == 3 {
1266
+					mode = "HD+HP"
1267
+				}
1268
+
1269
+				if daySchedule[0].Schedule.ModeId == 4 {
1270
+					mode = "HP"
1271
+				}
1272
+
1273
+				if daySchedule[0].Schedule.ModeId == 5 {
1274
+					mode = "HF"
1275
+				}
1276
+
1277
+				if daySchedule[0].Schedule.ModeId == 6 {
1278
+					mode = "SCUF"
1279
+				}
1280
+
1281
+				if daySchedule[0].Schedule.ModeId == 7 {
1282
+					mode = "IUF"
1283
+				}
1284
+
1285
+				if daySchedule[0].Schedule.ModeId == 8 {
1286
+					mode = "HFHD"
1287
+				}
1288
+
1289
+				if daySchedule[0].Schedule.ModeId == 9 {
1290
+					mode = "HFHD+HP"
1291
+				}
1292
+				if daySchedule[0].Schedule.ModeId == 10 {
1293
+					mode = "PHF"
1294
+				}
1295
+
1296
+				if daySchedule[0].Schedule.ModeId == 11 {
1297
+					mode = "HFR"
1298
+				}
1299
+
1300
+				if daySchedule[0].Schedule.ModeId == 12 {
1301
+					mode = "HDF+HP"
1302
+				}
1303
+
1304
+				if daySchedule[0].Schedule.ModeId == 13 {
1305
+					mode = "CRRT"
1306
+				}
1307
+
1308
+				if daySchedule[0].Schedule.ModeId == 14 {
1309
+					mode = "腹水回输"
1310
+				}
1311
+				if daySchedule[0].Schedule.ModeId == 19 {
1312
+					mode = "IUF+HD"
1313
+				}
1314
+				if daySchedule[0].Schedule.ModeId == 20 {
1315
+					mode = "UF"
1316
+				}
1317
+				if daySchedule[0].Schedule.ModeId == 21 {
1318
+					mode = "HD+"
1319
+				}
1320
+				if daySchedule[0].Schedule.ModeId == 22 {
1321
+					mode = "血浆胆红素吸附+HDF"
1322
+				}
1323
+				if daySchedule[0].Schedule.ModeId == 23 {
1324
+					mode = "血浆胆红素吸附"
1325
+				}
1326
+				if daySchedule[0].Schedule.ModeId == 24 {
1327
+					mode = "I-HDF"
1328
+				}
1329
+
1330
+				if daySchedule[0].Schedule.ModeId == 25 {
1331
+					mode = "HD高通"
1332
+				}
1333
+
1334
+				if daySchedule[0].Schedule.ModeId == 26 {
1335
+					mode = "CVVH"
1336
+				}
1337
+
1338
+				if daySchedule[0].Schedule.ModeId == 27 {
1339
+					mode = "CVVHD"
1340
+				}
1341
+
1342
+				if daySchedule[0].Schedule.ModeId == 28 {
1343
+					mode = "CVVHDF"
1344
+				}
1345
+
1346
+				if daySchedule[0].Schedule.ModeId == 29 {
1347
+					mode = "PE"
1348
+				}
1349
+
1350
+				if daySchedule[0].Schedule.ModeId == 30 {
1351
+					mode = "血浆胆红素吸附+HP"
1352
+				}
1353
+				if daySchedule[0].Schedule.ModeId == 31 {
1354
+					mode = "HPD"
1355
+				}
1356
+				if daySchedule[0].Schedule.ModeId == 32 {
1357
+					mode = "HDP"
1358
+				}
1359
+				if daySchedule[0].Schedule.ModeId == 33 {
1360
+					mode = "HFD"
1361
+				}
1362
+				if daySchedule[0].Schedule.ModeId == 34 {
1363
+					mode = "HDF100"
1364
+				}
1365
+				if daySchedule[0].Schedule.ModeId == 35 {
1366
+					mode = "HDF600"
1367
+				}
1368
+				if daySchedule[0].Schedule.ModeId == 36 {
1369
+					mode = "HDF800"
1370
+				}
1371
+				if daySchedule[0].Schedule.ModeId == 37 {
1372
+					mode = "HDF1000"
1373
+				}
1374
+
1375
+				sc["mode"] = mode
1230
 				sc["data"] = daySchedule
1376
 				sc["data"] = daySchedule
1231
 			} else {
1377
 			} else {
1232
 				sc["code"] = 1
1378
 				sc["code"] = 1
1254
 			if nextSchedule[0].Schedule.ID > 0 {
1400
 			if nextSchedule[0].Schedule.ID > 0 {
1255
 				sc["code"] = 0
1401
 				sc["code"] = 0
1256
 				sc["msg"] = ""
1402
 				sc["msg"] = ""
1257
-				sc["mode"] = nextSchedule[0].Schedule.ModeId
1403
+				var mode = "HD"
1404
+				if nextSchedule[0].Schedule.ModeId == 1 {
1405
+					mode = "HD"
1406
+				}
1407
+
1408
+				if nextSchedule[0].Schedule.ModeId == 2 {
1409
+					mode = "HDF"
1410
+				}
1411
+
1412
+				if nextSchedule[0].Schedule.ModeId == 3 {
1413
+					mode = "HD+HP"
1414
+				}
1415
+
1416
+				if nextSchedule[0].Schedule.ModeId == 4 {
1417
+					mode = "HP"
1418
+				}
1419
+
1420
+				if nextSchedule[0].Schedule.ModeId == 5 {
1421
+					mode = "HF"
1422
+				}
1423
+
1424
+				if nextSchedule[0].Schedule.ModeId == 6 {
1425
+					mode = "SCUF"
1426
+				}
1427
+
1428
+				if nextSchedule[0].Schedule.ModeId == 7 {
1429
+					mode = "IUF"
1430
+				}
1431
+
1432
+				if nextSchedule[0].Schedule.ModeId == 8 {
1433
+					mode = "HFHD"
1434
+				}
1435
+
1436
+				if nextSchedule[0].Schedule.ModeId == 9 {
1437
+					mode = "HFHD+HP"
1438
+				}
1439
+				if nextSchedule[0].Schedule.ModeId == 10 {
1440
+					mode = "PHF"
1441
+				}
1442
+
1443
+				if nextSchedule[0].Schedule.ModeId == 11 {
1444
+					mode = "HFR"
1445
+				}
1446
+
1447
+				if nextSchedule[0].Schedule.ModeId == 12 {
1448
+					mode = "HDF+HP"
1449
+				}
1450
+
1451
+				if nextSchedule[0].Schedule.ModeId == 13 {
1452
+					mode = "CRRT"
1453
+				}
1454
+
1455
+				if nextSchedule[0].Schedule.ModeId == 14 {
1456
+					mode = "腹水回输"
1457
+				}
1458
+				if nextSchedule[0].Schedule.ModeId == 19 {
1459
+					mode = "IUF+HD"
1460
+				}
1461
+				if nextSchedule[0].Schedule.ModeId == 20 {
1462
+					mode = "UF"
1463
+				}
1464
+				if nextSchedule[0].Schedule.ModeId == 21 {
1465
+					mode = "HD+"
1466
+				}
1467
+				if nextSchedule[0].Schedule.ModeId == 22 {
1468
+					mode = "血浆胆红素吸附+HDF"
1469
+				}
1470
+				if nextSchedule[0].Schedule.ModeId == 23 {
1471
+					mode = "血浆胆红素吸附"
1472
+				}
1473
+				if nextSchedule[0].Schedule.ModeId == 24 {
1474
+					mode = "I-HDF"
1475
+				}
1476
+
1477
+				if nextSchedule[0].Schedule.ModeId == 25 {
1478
+					mode = "HD高通"
1479
+				}
1480
+
1481
+				if nextSchedule[0].Schedule.ModeId == 26 {
1482
+					mode = "CVVH"
1483
+				}
1484
+
1485
+				if nextSchedule[0].Schedule.ModeId == 27 {
1486
+					mode = "CVVHD"
1487
+				}
1488
+
1489
+				if nextSchedule[0].Schedule.ModeId == 28 {
1490
+					mode = "CVVHDF"
1491
+				}
1492
+
1493
+				if nextSchedule[0].Schedule.ModeId == 29 {
1494
+					mode = "PE"
1495
+				}
1496
+
1497
+				if nextSchedule[0].Schedule.ModeId == 30 {
1498
+					mode = "血浆胆红素吸附+HP"
1499
+				}
1500
+				if nextSchedule[0].Schedule.ModeId == 31 {
1501
+					mode = "HPD"
1502
+				}
1503
+				if nextSchedule[0].Schedule.ModeId == 32 {
1504
+					mode = "HDP"
1505
+				}
1506
+				if nextSchedule[0].Schedule.ModeId == 33 {
1507
+					mode = "HFD"
1508
+				}
1509
+				if nextSchedule[0].Schedule.ModeId == 34 {
1510
+					mode = "HDF100"
1511
+				}
1512
+				if nextSchedule[0].Schedule.ModeId == 35 {
1513
+					mode = "HDF600"
1514
+				}
1515
+				if nextSchedule[0].Schedule.ModeId == 36 {
1516
+					mode = "HDF800"
1517
+				}
1518
+				if nextSchedule[0].Schedule.ModeId == 37 {
1519
+					mode = "HDF1000"
1520
+				}
1521
+				sc["mode"] = mode
1258
 				sc["data"] = nextSchedule
1522
 				sc["data"] = nextSchedule
1259
 			} else {
1523
 			} else {
1260
 				sc["code"] = 1
1524
 				sc["code"] = 1
1265
 		}
1529
 		}
1266
 	}
1530
 	}
1267
 
1531
 
1268
-	switch sc["mode"] {
1269
-	case 1:
1270
-		sc["mode"] = "HD"
1271
-		break
1272
-	case 2:
1273
-		sc["mode"] = "HDF"
1274
-		break
1275
-	case 3:
1276
-		sc["mode"] = "HD+HP"
1277
-		break
1278
-	case 4:
1279
-		sc["mode"] = "HP"
1280
-		break
1281
-	case 5:
1282
-		sc["mode"] = "HF"
1283
-		break
1284
-	case 6:
1285
-		sc["mode"] = "SCUF"
1286
-		break
1287
-	case 7:
1288
-		sc["mode"] = "IUF"
1289
-		break
1290
-	case 8:
1291
-		sc["mode"] = "HFHD"
1292
-		break
1293
-	case 9:
1294
-		sc["mode"] = "HFHD+HP"
1295
-		break
1296
-	case 10:
1297
-		sc["mode"] = "PHF"
1298
-		break
1299
-	case 11:
1300
-		sc["mode"] = "HFR"
1301
-		break
1302
-	case 12:
1303
-		sc["mode"] = "HDF+HP"
1304
-		break
1305
-	case 13:
1306
-		sc["mode"] = "CRRT"
1307
-		break
1308
-	case 14:
1309
-		sc["mode"] = "腹水回输"
1310
-		break
1311
-	case 15:
1312
-		sc["mode"] = "HD前置换"
1313
-		break
1314
-	case 16:
1315
-		sc["mode"] = "HD后置换"
1316
-		break
1317
-	case 17:
1318
-		sc["mode"] = "HDF前置换"
1319
-		break
1320
-	case 18:
1321
-		sc["mode"] = "HDF后置换"
1322
-		break
1323
-	default:
1324
-		sc["mode"] = "HD"
1325
-		break
1326
-	}
1532
+	//switch sc["mode"] {
1533
+	//case 1:
1534
+	//	sc["mode"] = "HD"
1535
+	//	break
1536
+	//case 2:
1537
+	//	sc["mode"] = "HDF"
1538
+	//	break
1539
+	//case 3:
1540
+	//	sc["mode"] = "HD+HP"
1541
+	//	break
1542
+	//case 4:
1543
+	//	sc["mode"] = "HP"
1544
+	//	break
1545
+	//case 5:
1546
+	//	sc["mode"] = "HF"
1547
+	//	break
1548
+	//case 6:
1549
+	//	sc["mode"] = "SCUF"
1550
+	//	break
1551
+	//case 7:
1552
+	//	sc["mode"] = "IUF"
1553
+	//	break
1554
+	//case 8:
1555
+	//	sc["mode"] = "HFHD"
1556
+	//	break
1557
+	//case 9:
1558
+	//	sc["mode"] = "HFHD+HP"
1559
+	//	break
1560
+	//case 10:
1561
+	//	sc["mode"] = "PHF"
1562
+	//	break
1563
+	//case 11:
1564
+	//	sc["mode"] = "HFR"
1565
+	//	break
1566
+	//case 12:
1567
+	//	sc["mode"] = "HDF+HP"
1568
+	//	break
1569
+	//case 13:
1570
+	//	sc["mode"] = "CRRT"
1571
+	//	break
1572
+	//case 14:
1573
+	//	sc["mode"] = "腹水回输"
1574
+	//	break
1575
+	//case 15:
1576
+	//	sc["mode"] = "HD前置换"
1577
+	//	break
1578
+	//case 16:
1579
+	//	sc["mode"] = "HD后置换"
1580
+	//	break
1581
+	//case 17:
1582
+	//	sc["mode"] = "HDF前置换"
1583
+	//	break
1584
+	//case 18:
1585
+	//	sc["mode"] = "HDF后置换"
1586
+	//	break
1587
+	//default:
1588
+	//	sc["mode"] = "HD"
1589
+	//	break
1590
+	//}
1327
 
1591
 
1328
 	// 获取患者透前干体重或者获取患者透前体重
1592
 	// 获取患者透前干体重或者获取患者透前体重
1329
 	var dry_weight map[string]interface{}
1593
 	var dry_weight map[string]interface{}

+ 19 - 16
controllers/mobile_api_controllers/patient_api_controller.go Просмотреть файл

1666
 				//
1666
 				//
1667
 				fmt.Println("config.IsOpen", config.IsOpen)
1667
 				fmt.Println("config.IsOpen", config.IsOpen)
1668
 				fmt.Println("config.IsOpen", item.UserOrgId)
1668
 				fmt.Println("config.IsOpen", item.UserOrgId)
1669
-				//if config.IsOpen == 0 && item.UserOrgId == 10402 {
1670
-				//
1671
-				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1672
-				//	//更新字典里面的库存
1673
-				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1674
-				//	var sum_count int64
1675
-				//	for _, its := range stockInfo {
1676
-				//		if its.MaxUnit == medical.MaxUnit {
1677
-				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1678
-				//		}
1679
-				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1680
-				//	}
1681
-				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1682
-				//	//剩余库存
1683
-				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1684
-				//}
1669
+				if config.IsOpen == 1 && item.UserOrgId == 10375 {
1670
+
1671
+					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1672
+					//更新字典里面的库存
1673
+					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1674
+					var sum_count int64
1675
+					for _, its := range stockInfo {
1676
+						if its.MaxUnit == medical.MaxUnit {
1677
+							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1678
+						}
1679
+						sum_count += its.StockMaxNumber + its.StockMinNumber
1680
+					}
1681
+					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1682
+					//剩余库存
1683
+					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1684
+				}
1685
 
1685
 
1686
 			}
1686
 			}
1687
 		}
1687
 		}
2702
 		newprescribe.Status = 1
2702
 		newprescribe.Status = 1
2703
 		newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
2703
 		newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
2704
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2704
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2705
+		newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
2705
 		newprescribe.Remark = lastDialysisPrescription.Remark
2706
 		newprescribe.Remark = lastDialysisPrescription.Remark
2706
 		newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2707
 		newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2707
 
2708
 
2864
 			newprescribe.Status = 1
2865
 			newprescribe.Status = 1
2865
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2866
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2866
 			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
2867
 			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
2868
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
2867
 			newprescribe.Remark = lastDialysisPrescription.Remark
2869
 			newprescribe.Remark = lastDialysisPrescription.Remark
2868
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2870
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2869
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2871
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
3018
 			newprescribe.Status = 1
3020
 			newprescribe.Status = 1
3019
 			newprescribe.DialysisDialyszers = system_dialysisPrescribe.DialysisDialyszers
3021
 			newprescribe.DialysisDialyszers = system_dialysisPrescribe.DialysisDialyszers
3020
 			newprescribe.DialysisIrrigation = system_dialysisPrescribe.DialysisIrrigation
3022
 			newprescribe.DialysisIrrigation = system_dialysisPrescribe.DialysisIrrigation
3023
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
3021
 			newprescribe.Remark = lastDialysisPrescription.Remark
3024
 			newprescribe.Remark = lastDialysisPrescription.Remark
3022
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3025
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3023
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
3026
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)

+ 28 - 7
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Просмотреть файл

10
 	"fmt"
10
 	"fmt"
11
 	"github.com/astaxie/beego"
11
 	"github.com/astaxie/beego"
12
 	"github.com/jinzhu/gorm"
12
 	"github.com/jinzhu/gorm"
13
+	"github.com/mozillazg/go-pinyin"
13
 	"strconv"
14
 	"strconv"
14
 	"strings"
15
 	"strings"
15
 	"time"
16
 	"time"
272
 			return
273
 			return
273
 		}
274
 		}
274
 
275
 
276
+		hans := name // 要转换的汉字字符串
277
+		// 创建一个拼音转换器
278
+		p := pinyin.NewArgs()
279
+
280
+		// 将汉字转为拼音
281
+		pinyinSlice := pinyin.Pinyin(hans, p)
282
+
283
+		// 输出拼音
284
+		fmt.Println("Pinyin:", pinyinSlice)
285
+
286
+		// 获取首字母
287
+		firstLetter := ""
288
+		for _, py := range pinyinSlice {
289
+			if len(py) > 0 {
290
+				firstLetter += string(py[0][0])
291
+			}
292
+		}
293
+
275
 		patients := models.Patients{
294
 		patients := models.Patients{
276
 			Name:              name,
295
 			Name:              name,
277
 			Gender:            sex,
296
 			Gender:            sex,
296
 			SchRemark:         remark,
315
 			SchRemark:         remark,
297
 			TreatmentPlan:     treatment_plan,
316
 			TreatmentPlan:     treatment_plan,
298
 		}
317
 		}
318
+		patients.FirstLetter = firstLetter
299
 		err = service.CreateOldPatient(&patients)
319
 		err = service.CreateOldPatient(&patients)
300
 		fmt.Print("报错", err)
320
 		fmt.Print("报错", err)
301
 		patient, err := service.GetLastOldPatient(orgid)
321
 		patient, err := service.GetLastOldPatient(orgid)
340
 			SchRemark:         remark,
360
 			SchRemark:         remark,
341
 			TreatmentPlan:     treatment_plan,
361
 			TreatmentPlan:     treatment_plan,
342
 		}
362
 		}
363
+		patientsNew.FirstLetter = firstLetter
343
 		err = service.CreateNewPatient(&patientsNew)
364
 		err = service.CreateNewPatient(&patientsNew)
344
 		key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patient.ID, 10) + ":patient_info"
365
 		key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patient.ID, 10) + ":patient_info"
345
 		redis := service.RedisClient()
366
 		redis := service.RedisClient()
1368
 		}
1389
 		}
1369
 
1390
 
1370
 		//查询号透析号是否相同
1391
 		//查询号透析号是否相同
1371
-		thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis, id)
1372
-		if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
1373
-			returnData := make(map[string]interface{}, 0)
1374
-			returnData["msg"] = "透析号码已存在"
1375
-			this.ServeSuccessJSON(returnData)
1376
-			return
1377
-		}
1392
+		//thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis, id)
1393
+		//if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
1394
+		//	returnData := make(map[string]interface{}, 0)
1395
+		//	returnData["msg"] = "透析号码已存在"
1396
+		//	this.ServeSuccessJSON(returnData)
1397
+		//	return
1398
+		//}
1378
 
1399
 
1379
 		patients := models.Patients{
1400
 		patients := models.Patients{
1380
 			Name:              name,
1401
 			Name:              name,

+ 38 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Просмотреть файл

409
 		}
409
 		}
410
 	}
410
 	}
411
 
411
 
412
+	if orgid == 10585 {
413
+		//获取今日的排班数据
414
+		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
415
+		for _, item := range list {
416
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
417
+			var str = solution.DialyzerPerfusionApparatus
418
+			service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
419
+		}
420
+	}
421
+
422
+	//查询排班里面的空透析器
423
+	if orgid == 10375 {
424
+
425
+		schedulesFive, _ := service.GetMobileScheduleListByScheduleDateOne(orgid, startTime)
426
+
427
+		for _, item := range schedulesFive {
428
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
429
+			var DialysisMachineName string
430
+			if len(solution.DialysisDialyszers) > 0 {
431
+				DialysisMachineName = solution.DialysisDialyszers
432
+			}
433
+			if len(solution.DialyzerPerfusionApparatus) > 0 {
434
+				DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
435
+			}
436
+
437
+			if len(solution.DialysisIrrigation) > 0 {
438
+				DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
439
+			}
440
+			item.DialysisMachineName = DialysisMachineName
441
+			service.UpdateSchOne(item.ID, item.DialysisMachineName)
442
+		}
443
+
444
+	}
445
+
412
 	// stockType, _ := service.GetStockType(orgid)
446
 	// stockType, _ := service.GetStockType(orgid)
413
 	//zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
447
 	//zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
414
 	// if err != nil {
448
 	// if err != nil {
522
 			if len(advice) > 0 {
556
 			if len(advice) > 0 {
523
 				service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
557
 				service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
524
 			}
558
 			}
559
+			project, _ := service.GetHisPrescriptionProjectList(schedule.PatientId, schedule.ScheduleDate, org_id)
560
+			if len(project) > 0 {
561
+				service.UpdateProjectObj(schedule.PatientId, schedule.ScheduleDate, org_id)
562
+			}
525
 		}
563
 		}
526
 		redis := service.RedisClient()
564
 		redis := service.RedisClient()
527
 		//处方
565
 		//处方

+ 56 - 0
controllers/patient_api_controller.go Просмотреть файл

7
 	"XT_New/utils"
7
 	"XT_New/utils"
8
 	"encoding/json"
8
 	"encoding/json"
9
 	"github.com/jinzhu/gorm"
9
 	"github.com/jinzhu/gorm"
10
+	"github.com/mozillazg/go-pinyin"
10
 
11
 
11
 	//"github.com/jinzhu/gorm"
12
 	//"github.com/jinzhu/gorm"
12
 	"math"
13
 	"math"
132
 
133
 
133
 	beego.Router("api/patient/gettherapyinformed", &PatientApiController{}, "Get:GetTherapyInformed")
134
 	beego.Router("api/patient/gettherapyinformed", &PatientApiController{}, "Get:GetTherapyInformed")
134
 
135
 
136
+	beego.Router("/api/patient/savemedicalhistory", &PatientApiController{}, "Post:SaveMedicalHistory")
137
+
135
 }
138
 }
136
 func (c *PatientApiController) GetExportList() {
139
 func (c *PatientApiController) GetExportList() {
137
 	startTime := c.GetString("start_time")
140
 	startTime := c.GetString("start_time")
355
 	patient.BindingState = 2
358
 	patient.BindingState = 2
356
 	// patient.Lapseto = 1
359
 	// patient.Lapseto = 1
357
 
360
 
361
+	hans := patient.Name // 要转换的汉字字符串
362
+	// 创建一个拼音转换器
363
+	p := pinyin.NewArgs()
364
+
365
+	// 将汉字转为拼音
366
+	pinyinSlice := pinyin.Pinyin(hans, p)
367
+
368
+	// 输出拼音
369
+	fmt.Println("Pinyin:", pinyinSlice)
370
+
371
+	// 获取首字母
372
+	firstLetter := ""
373
+	for _, py := range pinyinSlice {
374
+		if len(py) > 0 {
375
+			firstLetter += string(py[0][0])
376
+		}
377
+	}
378
+
379
+	patient.FirstLetter = firstLetter
380
+
358
 	err := service.CreatePatient(&patient, contagions, diseases)
381
 	err := service.CreatePatient(&patient, contagions, diseases)
359
 	fmt.Println("创建病人失败err")
382
 	fmt.Println("创建病人失败err")
360
 	if err != nil {
383
 	if err != nil {
466
 		AllergicHistory:              patient.AllergicHistory,
489
 		AllergicHistory:              patient.AllergicHistory,
467
 		PatientAddress:               patient.PatientAddress,
490
 		PatientAddress:               patient.PatientAddress,
468
 	}
491
 	}
492
+	patientsNew.FirstLetter = firstLetter
469
 
493
 
470
 	err = service.CreatePatientsNew(&patientsNew)
494
 	err = service.CreatePatientsNew(&patientsNew)
471
 	fmt.Print("创建失败", err)
495
 	fmt.Print("创建失败", err)
6631
 		"list": theapyInformed,
6655
 		"list": theapyInformed,
6632
 	})
6656
 	})
6633
 }
6657
 }
6658
+
6659
+func (c *PatientApiController) SaveMedicalHistory() {
6660
+
6661
+	orgId := c.GetAdminUserInfo().CurrentOrgId
6662
+	dataBody := make(map[string]interface{}, 0)
6663
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
6664
+	fmt.Println("err", err)
6665
+	content := dataBody["content"].(string)
6666
+	patient_id := int64(dataBody["patient_id"].(float64))
6667
+	medicalHistory := models.XtMedicalHistory{
6668
+		UserOrgId: orgId,
6669
+		PatientId: patient_id,
6670
+		Ctime:     time.Now().Unix(),
6671
+		Mtime:     0,
6672
+		Status:    1,
6673
+		Content:   content,
6674
+	}
6675
+
6676
+	//
6677
+	history, _ := service.GetPatientMedicalHistory(patient_id, orgId)
6678
+
6679
+	if history.ID > 0 {
6680
+		service.UpdatePatientMedicalHistory(history.ID, content)
6681
+	}
6682
+	if history.ID == 0 {
6683
+		service.CreatePatientMedicalHistory(medicalHistory)
6684
+	}
6685
+	c.ServeSuccessJSON(map[string]interface{}{
6686
+		"medicalHistory": medicalHistory,
6687
+	})
6688
+
6689
+}

+ 12 - 0
controllers/patient_dataconfig_api_controller.go Просмотреть файл

50
 
50
 
51
 	beego.Router("/api/patient/getpatientdetailinformedconsent", &PatientDataConfigAPIController{}, "Get:GetPatientDetailInformedConsent")
51
 	beego.Router("/api/patient/getpatientdetailinformedconsent", &PatientDataConfigAPIController{}, "Get:GetPatientDetailInformedConsent")
52
 
52
 
53
+	beego.Router("/api/patient/getpatientmedicallist", &PatientDataConfigAPIController{}, "Get:GetPatientMedicalList")
54
+
53
 }
55
 }
54
 
56
 
55
 type PatientDataConfigAPIController struct {
57
 type PatientDataConfigAPIController struct {
1614
 		"patients": patients,
1616
 		"patients": patients,
1615
 	})
1617
 	})
1616
 }
1618
 }
1619
+
1620
+func (this *PatientDataConfigAPIController) GetPatientMedicalList() {
1621
+
1622
+	patient_id, _ := this.GetInt64("patient_id")
1623
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1624
+	list, _ := service.GetPatientMedicalList(patient_id, orgId)
1625
+	this.ServeSuccessJSON(map[string]interface{}{
1626
+		"list": list,
1627
+	})
1628
+}

+ 1 - 0
controllers/pharmacy_controller.go Просмотреть файл

495
 		etime = stime + 86399
495
 		etime = stime + 86399
496
 	}
496
 	}
497
 	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
497
 	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
498
+
498
 	if err != nil {
499
 	if err != nil {
499
 		utils.ErrorLog(err.Error())
500
 		utils.ErrorLog(err.Error())
500
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
501
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())

+ 30 - 2
controllers/schedule_api_controller.go Просмотреть файл

2012
 		}
2012
 		}
2013
 	}
2013
 	}
2014
 
2014
 
2015
-	if adminINfo.CurrentOrgId == 10206 {
2015
+	if adminINfo.CurrentOrgId == 10206 || adminINfo.CurrentOrgId == 10344 {
2016
 		hisAdvice, _ := service.GetHisDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2016
 		hisAdvice, _ := service.GetHisDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2017
+		project, _ := service.GetHisPrescriptionProjectList(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2017
 		if len(hisAdvice) > 0 {
2018
 		if len(hisAdvice) > 0 {
2018
 			service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2019
 			service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2019
 		}
2020
 		}
2021
+		if len(project) > 0 {
2022
+			service.UpdateProjectObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
2023
+		}
2020
 	}
2024
 	}
2021
 
2025
 
2022
 	redis := service.RedisClient()
2026
 	redis := service.RedisClient()
4559
 	}
4563
 	}
4560
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4564
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4561
 
4565
 
4562
-	if adminInfo.CurrentOrgId == 10346 {
4566
+	if adminInfo.CurrentOrgId == 10346 || adminInfo.CurrentOrgId == 10585 {
4563
 
4567
 
4564
 		if len(schdules) > 0 {
4568
 		if len(schdules) > 0 {
4565
 			//获取长期医嘱里面的透析器灌流器
4569
 			//获取长期医嘱里面的透析器灌流器
4570
 
4574
 
4571
 		}
4575
 		}
4572
 	}
4576
 	}
4577
+
4578
+	//查询排班里面的空透析器
4579
+	if adminInfo.CurrentOrgId == 10375 {
4580
+
4581
+		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4582
+
4583
+		for _, item := range schedulesFive {
4584
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4585
+			var DialysisMachineName string
4586
+			if len(solution.DialysisDialyszers) > 0 {
4587
+				DialysisMachineName = solution.DialysisDialyszers
4588
+			}
4589
+			if len(solution.DialyzerPerfusionApparatus) > 0 {
4590
+				DialysisMachineName = DialysisMachineName + "," + solution.DialyzerPerfusionApparatus
4591
+			}
4592
+
4593
+			if len(solution.DialysisIrrigation) > 0 {
4594
+				DialysisMachineName = DialysisMachineName + "," + solution.DialysisIrrigation
4595
+			}
4596
+			item.DialysisMachineName = DialysisMachineName
4597
+			service.UpdateSchOne(item.ID, item.DialysisMachineName)
4598
+		}
4599
+
4600
+	}
4573
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4601
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4574
 	c.ServeSuccessJSON(map[string]interface{}{
4602
 	c.ServeSuccessJSON(map[string]interface{}{
4575
 		"days":           days,
4603
 		"days":           days,

+ 30 - 30
controllers/sign_api_controller.go Просмотреть файл

665
 
665
 
666
 func (this *SignApiController) UploadPrintOrder() {
666
 func (this *SignApiController) UploadPrintOrder() {
667
 
667
 
668
-	//list, _ := service.GetAllPatientNew(10622)
669
-	//for _, item := range list {
670
-	//
671
-	//	hans := item.Name // 要转换的汉字字符串
672
-	//	// 创建一个拼音转换器
673
-	//	p := pinyin.NewArgs()
674
-	//
675
-	//	// 将汉字转为拼音
676
-	//	pinyinSlice := pinyin.Pinyin(hans, p)
677
-	//
678
-	//	// 输出拼音
679
-	//	fmt.Println("Pinyin:", pinyinSlice)
680
-	//
681
-	//	// 获取首字母
682
-	//	firstLetter := ""
683
-	//	for _, py := range pinyinSlice {
684
-	//		if len(py) > 0 {
685
-	//			firstLetter += string(py[0][0])
686
-	//		}
687
-	//	}
688
-	//
689
-	//	item.FirstLetter = firstLetter
690
-	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
691
-	//	// 输出首字母
692
-	//	//fmt.Println("First Letter:", firstLetter)
693
-	//}
668
+	list, _ := service.GetAllPatientNew(10375)
669
+	for _, item := range list {
694
 
670
 
695
-	baseList, _ := service.GeteAllBaseList(10622)
696
-	for _, item := range baseList {
697
-		hans := item.DrugName // 要转换的汉字字符串
671
+		hans := item.Name // 要转换的汉字字符串
698
 		// 创建一个拼音转换器
672
 		// 创建一个拼音转换器
699
 		p := pinyin.NewArgs()
673
 		p := pinyin.NewArgs()
674
+
700
 		// 将汉字转为拼音
675
 		// 将汉字转为拼音
701
 		pinyinSlice := pinyin.Pinyin(hans, p)
676
 		pinyinSlice := pinyin.Pinyin(hans, p)
677
+
678
+		// 输出拼音
679
+		fmt.Println("Pinyin:", pinyinSlice)
680
+
702
 		// 获取首字母
681
 		// 获取首字母
703
 		firstLetter := ""
682
 		firstLetter := ""
704
 		for _, py := range pinyinSlice {
683
 		for _, py := range pinyinSlice {
706
 				firstLetter += string(py[0][0])
685
 				firstLetter += string(py[0][0])
707
 			}
686
 			}
708
 		}
687
 		}
688
+
709
 		item.FirstLetter = firstLetter
689
 		item.FirstLetter = firstLetter
710
-		service.UpdateBaseList(item.ID, item.FirstLetter)
690
+		service.UpdatePatientNew(item.ID, item.FirstLetter)
691
+		// 输出首字母
692
+		//fmt.Println("First Letter:", firstLetter)
711
 	}
693
 	}
694
+
695
+	//baseList, _ := service.GeteAllBaseList(10375)
696
+	//for _, item := range baseList {
697
+	//	hans := item.DrugName // 要转换的汉字字符串
698
+	//	// 创建一个拼音转换器
699
+	//	p := pinyin.NewArgs()
700
+	//	// 将汉字转为拼音
701
+	//	pinyinSlice := pinyin.Pinyin(hans, p)
702
+	//	// 获取首字母
703
+	//	firstLetter := ""
704
+	//	for _, py := range pinyinSlice {
705
+	//		if len(py) > 0 {
706
+	//			firstLetter += string(py[0][0])
707
+	//		}
708
+	//	}
709
+	//	item.FirstLetter = firstLetter
710
+	//	service.UpdateBaseList(item.ID, item.FirstLetter)
711
+	//}
712
 	//pdf := gofpdf.New("P", "mm", "A4", "")
712
 	//pdf := gofpdf.New("P", "mm", "A4", "")
713
 	//pdf.AddPage()
713
 	//pdf.AddPage()
714
 	//pdf.Text(5, 10, "血液净化治疗记录单")
714
 	//pdf.Text(5, 10, "血液净化治疗记录单")

+ 1 - 0
models/dialysis.go Просмотреть файл

1274
 	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1274
 	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1275
 	IsMobile              int64              `gorm:"column:is_mobile" json:"is_mobile" form:"is_mobile"`
1275
 	IsMobile              int64              `gorm:"column:is_mobile" json:"is_mobile" form:"is_mobile"`
1276
 	IsSelfDrug            int64              `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1276
 	IsSelfDrug            int64              `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1277
+	IsMedicine            int64              `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1277
 }
1278
 }
1278
 
1279
 
1279
 func (HisDoctorAdvice) TableName() string {
1280
 func (HisDoctorAdvice) TableName() string {

+ 14 - 0
models/patient_models.go Просмотреть файл

2532
 func (XtTheapyinformedPrint) TableName() string {
2532
 func (XtTheapyinformedPrint) TableName() string {
2533
 	return "xt_theapyinformed_print"
2533
 	return "xt_theapyinformed_print"
2534
 }
2534
 }
2535
+
2536
+type XtMedicalHistory struct {
2537
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2538
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2539
+	PatientId int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2540
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2541
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2542
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2543
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2544
+}
2545
+
2546
+func (XtMedicalHistory) TableName() string {
2547
+	return "xt_medical_history"
2548
+}

+ 15 - 15
models/schedule_models.go Просмотреть файл

168
 }
168
 }
169
 
169
 
170
 type Search_Schedule struct {
170
 type Search_Schedule struct {
171
-	ID           int64 `gorm:"column:id" json:"id" form:"id"`
172
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
173
-	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
174
-	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
175
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
176
-	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
177
-	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
178
-	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
179
-	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
180
-	Status       int64 `gorm:"column:status" json:"status" form:"status"`
181
-	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
182
-	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
183
-	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
184
-
185
-	Patient string `gorm:"-" json:"patient" form:"patient"`
171
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
172
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
173
+	PartitionId         int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
174
+	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
175
+	PatientId           int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
176
+	ScheduleDate        int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
177
+	ScheduleType        int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
178
+	ScheduleWeek        int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
179
+	ModeId              int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
180
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
181
+	CreatedTime         int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
182
+	UpdatedTime         int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
183
+	IsExport            int64  `gorm:"column:is_export" json:"is_export" form:"is_export"`
184
+	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
185
+	Patient             string `gorm:"-" json:"patient" form:"patient"`
186
 }
186
 }
187
 
187
 
188
 func (Search_Schedule) TableName() string {
188
 func (Search_Schedule) TableName() string {

+ 3 - 3
service/dialysis_solution_service.go Просмотреть файл

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/models"
4
 	"XT_New/models"
5
-	"fmt"
6
 	"github.com/jinzhu/gorm"
5
 	"github.com/jinzhu/gorm"
7
 )
6
 )
8
 
7
 
42
 }
41
 }
43
 
42
 
44
 func GetPatientDialysisSolutionGroupList(keywords string, limit int64, page int64, partition_id int64, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
43
 func GetPatientDialysisSolutionGroupList(keywords string, limit int64, page int64, partition_id int64, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
45
-	fmt.Println("ids23322332323232wode", len(ids))
44
+
46
 	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
45
 	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
47
 	offset := (page - 1) * limit
46
 	offset := (page - 1) * limit
48
 	if scheduleDate > 0 {
47
 	if scheduleDate > 0 {
66
 		db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
65
 		db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
67
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
66
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
68
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
67
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
69
-			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID)
68
+			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).Preload("DialysisPrescription", "status=1 and user_org_id =? and record_date =?", orgID, scheduleDate)
70
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
69
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
71
 		err = db.Count(&total).Offset(offset).Limit(limit).Find(&schedule).Error
70
 		err = db.Count(&total).Offset(offset).Limit(limit).Find(&schedule).Error
72
 	} else {
71
 	} else {
73
 		err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
72
 		err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
74
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
73
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
75
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
74
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
75
+			Preload("DialysisPrescription", "status=1 and user_org_id =? and record_date =?", orgID, scheduleDate).
76
 			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).Count(&total).Offset(offset).Limit(limit).Find(&schedule).Error
76
 			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).Count(&total).Offset(offset).Limit(limit).Find(&schedule).Error
77
 	}
77
 	}
78
 
78
 

+ 17 - 0
service/doctor_schedule_service.go Просмотреть файл

819
 	return schedule, err
819
 	return schedule, err
820
 }
820
 }
821
 
821
 
822
+func GetMobileScheduleListByScheduleDateOne(org_id int64, schedule_date int64) (schedule []*models.Search_Schedule, err error) {
823
+
824
+	db := XTReadDB().Model(&schedule).Where("status= 1 and dialysis_machine_name=''")
825
+
826
+	if org_id > 0 {
827
+		db = db.Where("user_org_id = ?", org_id)
828
+	}
829
+
830
+	if schedule_date > 0 {
831
+		db = db.Where("schedule_date=?", schedule_date)
832
+	}
833
+
834
+	err = db.Find(&schedule).Error
835
+
836
+	return schedule, err
837
+}
838
+
822
 func DeleteStaffScheduleById(id int64, user_org_id int64) (err error) {
839
 func DeleteStaffScheduleById(id int64, user_org_id int64) (err error) {
823
 
840
 
824
 	schedule := models.StaffSchedule{}
841
 	schedule := models.StaffSchedule{}

+ 10 - 2
service/mobile_dialysis_service.go Просмотреть файл

2321
 // 透析方案
2321
 // 透析方案
2322
 func MobileGetDialysisSolutionByModeIdSix(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2322
 func MobileGetDialysisSolutionByModeIdSix(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2323
 	var record models.DialysisSolution
2323
 	var record models.DialysisSolution
2324
-	err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
2324
+	err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and solution_status =1", patientID, orgID, mode_id).Last(&record).Error
2325
 	if err != nil {
2325
 	if err != nil {
2326
 		if err == gorm.ErrRecordNotFound {
2326
 		if err == gorm.ErrRecordNotFound {
2327
 			return nil, nil
2327
 			return nil, nil
2332
 	return &record, nil
2332
 	return &record, nil
2333
 }
2333
 }
2334
 
2334
 
2335
+// 透析方案
2336
+func MobileGetDialysisSolutionByModeIdSevenTwety(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2337
+	var record models.DialysisSolution
2338
+	err = readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and solution_status =1", patientID, orgID, mode_id).Last(&record).Error
2339
+
2340
+	return record, nil
2341
+}
2342
+
2335
 // 透析方案
2343
 // 透析方案
2336
 func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2344
 func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2337
 	var record models.DialysisSolution
2345
 	var record models.DialysisSolution
4021
 		db = db.Where("x.dialysis_date <= ?", endtime)
4029
 		db = db.Where("x.dialysis_date <= ?", endtime)
4022
 	}
4030
 	}
4023
 
4031
 
4024
-	err = db.Select("x.id,x.dialysis_date,x.schedual_type,s.mode_id").Joins("left join xt_schedule as s on  x.patient_id = s.patient_id and x.dialysis_date = s.schedule_date ").Scan(&order).Error
4032
+	err = db.Select("x.id,x.dialysis_date,x.schedual_type,s.mode_id").Where("s.status=1").Joins("left join xt_schedule as s on  x.patient_id = s.patient_id and x.dialysis_date = s.schedule_date ").Group("x.id").Scan(&order).Error
4025
 	return order, err
4033
 	return order, err
4026
 }
4034
 }
4027
 
4035
 

+ 31 - 0
service/patient_service.go Просмотреть файл

3682
 	err := XTWriteDB().Model(&models.XtTheapyinformedPrint{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3682
 	err := XTWriteDB().Model(&models.XtTheapyinformedPrint{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"content": content}).Error
3683
 	return err
3683
 	return err
3684
 }
3684
 }
3685
+
3686
+func GetPatientMedicalHistory(patient_id int64, user_org_id int64) (models.XtMedicalHistory, error) {
3687
+
3688
+	history := models.XtMedicalHistory{}
3689
+
3690
+	err := XTReadDB().Model(&history).Where("patient_id = ? and user_org_id = ? and status=1", patient_id, user_org_id).Find(&history).Error
3691
+
3692
+	return history, err
3693
+}
3694
+
3695
+func UpdatePatientMedicalHistory(id int64, content string) error {
3696
+
3697
+	history := models.XtMedicalHistory{}
3698
+
3699
+	err := XTWriteDB().Model(&history).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
3700
+	return err
3701
+}
3702
+
3703
+func CreatePatientMedicalHistory(history models.XtMedicalHistory) error {
3704
+
3705
+	err := XTWriteDB().Create(&history).Error
3706
+
3707
+	return err
3708
+}
3709
+
3710
+func GetPatientMedicalList(patient_id int64, user_org_id int64) (models.XtMedicalHistory, error) {
3711
+
3712
+	history := models.XtMedicalHistory{}
3713
+	err := XTReadDB().Where("patient_id = ? and user_org_id = ? and status=1", patient_id, user_org_id).Find(&history).Error
3714
+	return history, err
3715
+}

+ 121 - 47
service/pharmacy_service.go Просмотреть файл

249
 func GetPatientMedication(orgid, patient_id, stime, etime, is_medicine int64) (pp []*models.PharmacyContent, err error) {
249
 func GetPatientMedication(orgid, patient_id, stime, etime, is_medicine int64) (pp []*models.PharmacyContent, err error) {
250
 	InitDrugidIsNil(orgid, stime, etime)
250
 	InitDrugidIsNil(orgid, stime, etime)
251
 	var tmp []*models.HisDoctorAdviceInfoL
251
 	var tmp []*models.HisDoctorAdviceInfoL
252
-	if is_medicine == 0 {
252
+	if orgid == 10375 {
253
 		err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
253
 		err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
254
-			"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
254
+			"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and drug_id in (select id from xt_base_drug where org_id = ?)", stime, etime, orgid, patient_id, orgid).Find(&tmp).Error
255
 		if err != nil {
255
 		if err != nil {
256
 			return pp, err
256
 			return pp, err
257
 		}
257
 		}
258
-	} else {
259
-		err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
260
-			"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
261
-		if err != nil {
262
-			return pp, err
258
+
259
+		for _, v := range tmp {
260
+			pp = append(pp, &models.PharmacyContent{
261
+				Name:         v.AdviceName,
262
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
263
+				Usage:        v.DeliveryWay,
264
+				Frequency:    v.ExecutionFrequency,
265
+				Days:         config.ToString(v.Day) + "天",
266
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
267
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
268
+				DataSources:  "his处方",
269
+				Remarks:      v.Remark, //备注
270
+				DrugId:       v.DrugId,
271
+			})
263
 		}
272
 		}
264
-	}
265
 
273
 
266
-	for _, v := range tmp {
267
-		pp = append(pp, &models.PharmacyContent{
268
-			Name:         v.AdviceName,
269
-			SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
270
-			Usage:        v.DeliveryWay,
271
-			Frequency:    v.ExecutionFrequency,
272
-			Days:         config.ToString(v.Day) + "天",
273
-			Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
274
-			Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
275
-			DataSources:  "his处方",
276
-			Remarks:      v.Remark, //备注
277
-			DrugId:       v.DrugId,
278
-		})
274
+		var tmp_advice []*models.XtDoctorAdviceL
275
+		if is_medicine == 0 {
276
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
277
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
278
+			if err != nil {
279
+				return pp, err
280
+			}
281
+		} else {
282
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
283
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
284
+			if err != nil {
285
+				return pp, err
286
+			}
287
+		}
288
+
289
+		for _, v := range tmp_advice {
290
+			pp = append(pp, &models.PharmacyContent{
291
+				Name:         v.AdviceName,
292
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
293
+				Usage:        v.DeliveryWay,
294
+				Frequency:    v.ExecutionFrequency,
295
+				Days:         "-",
296
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
297
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
298
+				DataSources:  "临时医嘱",
299
+				Remarks:      v.Remark,
300
+				DrugId:       v.DrugId,
301
+			})
302
+		}
303
+		return
279
 	}
304
 	}
280
 
305
 
281
-	var tmp_advice []*models.XtDoctorAdviceL
282
-	if is_medicine == 0 {
283
-		err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
284
-			"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
285
-		if err != nil {
286
-			return pp, err
306
+	if orgid != 10375 {
307
+		if is_medicine == 0 {
308
+			err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
309
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
310
+			if err != nil {
311
+				return pp, err
312
+			}
313
+		} else {
314
+			err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
315
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
316
+			if err != nil {
317
+				return pp, err
318
+			}
287
 		}
319
 		}
288
-	} else {
289
-		err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
290
-			"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
291
-		if err != nil {
292
-			return pp, err
320
+
321
+		for _, v := range tmp {
322
+			pp = append(pp, &models.PharmacyContent{
323
+				Name:         v.AdviceName,
324
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
325
+				Usage:        v.DeliveryWay,
326
+				Frequency:    v.ExecutionFrequency,
327
+				Days:         config.ToString(v.Day) + "天",
328
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
329
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
330
+				DataSources:  "his处方",
331
+				Remarks:      v.Remark, //备注
332
+				DrugId:       v.DrugId,
333
+			})
293
 		}
334
 		}
294
-	}
295
 
335
 
296
-	for _, v := range tmp_advice {
297
-		pp = append(pp, &models.PharmacyContent{
298
-			Name:         v.AdviceName,
299
-			SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
300
-			Usage:        v.DeliveryWay,
301
-			Frequency:    v.ExecutionFrequency,
302
-			Days:         "-",
303
-			Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
304
-			Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
305
-			DataSources:  "临时医嘱",
306
-			Remarks:      v.Remark,
307
-			DrugId:       v.DrugId,
308
-		})
336
+		var tmp_advice []*models.XtDoctorAdviceL
337
+		if is_medicine == 0 {
338
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
339
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
340
+			if err != nil {
341
+				return pp, err
342
+			}
343
+		} else {
344
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
345
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
346
+			if err != nil {
347
+				return pp, err
348
+			}
349
+		}
350
+
351
+		for _, v := range tmp_advice {
352
+			pp = append(pp, &models.PharmacyContent{
353
+				Name:         v.AdviceName,
354
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
355
+				Usage:        v.DeliveryWay,
356
+				Frequency:    v.ExecutionFrequency,
357
+				Days:         "-",
358
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
359
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
360
+				DataSources:  "临时医嘱",
361
+				Remarks:      v.Remark,
362
+				DrugId:       v.DrugId,
363
+			})
364
+		}
365
+		return
309
 	}
366
 	}
310
 	return
367
 	return
311
 }
368
 }
996
 			//扣减库存
1053
 			//扣减库存
997
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1054
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
998
 
1055
 
1056
+			//退药
1057
+			UpdateHisPrescriptionInfo(v.PatientId, v.AdviceDate, v.UserOrgId)
1058
+
999
 		}
1059
 		}
1000
 	}
1060
 	}
1001
 
1061
 
1035
 				err = fmt.Errorf("!:%v", err)
1095
 				err = fmt.Errorf("!:%v", err)
1036
 				return
1096
 				return
1037
 			}
1097
 			}
1038
-			//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
1039
 			//查询默认仓库
1098
 			//查询默认仓库
1040
 			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
1099
 			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
1041
 			//查询默认仓库剩余多少库存
1100
 			//查询默认仓库剩余多少库存
1051
 			UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
1110
 			UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
1052
 			//扣减库存
1111
 			//扣减库存
1053
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1112
 			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1113
+
1054
 		}
1114
 		}
1055
 	}
1115
 	}
1056
 
1116
 
2210
 	err := XTWriteDB().Model(&models.HisDoctorAdviceInfo{}).Where("id = ? and status = 1 and is_medicine =0", id).Update(map[string]interface{}{"is_medicine": 1}).Error
2270
 	err := XTWriteDB().Model(&models.HisDoctorAdviceInfo{}).Where("id = ? and status = 1 and is_medicine =0", id).Update(map[string]interface{}{"is_medicine": 1}).Error
2211
 	return err
2271
 	return err
2212
 }
2272
 }
2273
+
2274
+func UpdateHisPrescriptionInfo(patient_id int64, advice_date int64, user_org_id int64) error {
2275
+
2276
+	err = XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("patient_id = ? and advice_date = ? and user_org_id= ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2277
+
2278
+	err = XTWriteDB().Model(&models.HisPrintPrescription{}).Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2279
+	return err
2280
+}
2281
+
2282
+func GetHisPatientAdviceList(user_org_id int64, patient_id int64, start_time int64, end_time int64) (list []*models.HisDoctorAdvice, err error) {
2283
+
2284
+	err = XTReadDB().Model(&models.HisDoctorAdvice{}).Where("patient_id=? and advice_date=? and advice_date>=? and advice_date<=? and status=1 and user_org_id = ? and is_medicine =1", patient_id, start_time, end_time, user_org_id).Find(&list).Error
2285
+	return list, err
2286
+}

+ 38 - 0
service/schedule_service.go Просмотреть файл

129
 	return
129
 	return
130
 }
130
 }
131
 
131
 
132
+func GetWeekScheduleFive(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.ScheduleTwo, err error) {
133
+
134
+	db := readDb.Table("xt_schedule as s").Where("s.status=1 and s.dialysis_machine_name='")
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
+	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
142
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
143
+		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
144
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time,s.dialysis_machine_name, p.name as patient").
145
+		Order("updated_time asc").
146
+		Find(&schedules).Error
147
+	return
148
+}
149
+
150
+func UpdateSchOne(id int64, dialysis_machine_name string) (err error) {
151
+	err = writeDb.Model(&models.ScheduleTwo{}).Where("status=1 AND id = ?", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
152
+	return
153
+}
154
+
132
 func GetScheduleTotalCount(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.MySchedule, err error) {
155
 func GetScheduleTotalCount(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.MySchedule, err error) {
133
 
156
 
134
 	db := readDb.Table("xt_schedule as s").Where("status= 1 and (mode_id = 2 or mode_id= 3)")
157
 	db := readDb.Table("xt_schedule as s").Where("status= 1 and (mode_id = 2 or mode_id= 3)")
1775
 	return advice, err
1798
 	return advice, err
1776
 }
1799
 }
1777
 
1800
 
1801
+func GetHisPrescriptionProjectList(patient_id int64, record_date int64, user_org_id int64) (project []*models.HisPrescriptionProject, err error) {
1802
+	err = XTReadDB().Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, record_date, user_org_id).Find(&project).Error
1803
+	return project, err
1804
+}
1805
+
1806
+func UpdateProjectObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1807
+
1808
+	err = XTWriteDB().Model(&models.HisPrescriptionProject{}).Where("patient_id = ? and record_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1809
+
1810
+	err = XTWriteDB().Model(&models.HisPrescription{}).Where("patient_id = ? and status=1 and record_date = ? and user_org_id =?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1811
+
1812
+	err = XTWriteDB().Model(&models.HisPrescriptionInfo{}).Where("patient_id = ? and status=1 and record_date = ? and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1813
+	return err
1814
+}
1815
+
1778
 func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1816
 func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1779
 
1817
 
1780
 	err = XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1818
 	err = XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error