Ver código fonte

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

陈少旭 1 ano atrás
pai
commit
59547725f0
40 arquivos alterados com 1032 adições e 185 exclusões
  1. 10 10
      controllers/base_api_controller.go
  2. 156 8
      controllers/dialysis_api_controller.go
  3. 1 0
      controllers/dialysis_record_api_controller.go
  4. 1 0
      controllers/doctors_api_controller.go
  5. 7 0
      controllers/drug_stock_api_contorller.go
  6. 16 22
      controllers/mobile_api_controllers/check_weight_api_controller.go
  7. 137 46
      controllers/mobile_api_controllers/dialysis_api_controller.go
  8. 32 4
      controllers/mobile_api_controllers/patient_api_controller.go
  9. 2 5
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  10. 8 0
      controllers/new_mobile_api_controllers/staff_schedule_api_controller.go
  11. 6 1
      controllers/patient_api_controller.go
  12. 70 50
      controllers/pharmacy_controller.go
  13. 18 9
      controllers/print_data_api_controller.go
  14. 8 0
      controllers/schedule_api_controller.go
  15. 51 4
      controllers/sign_api_controller.go
  16. 13 1
      controllers/stock_in_api_controller.go
  17. 14 0
      models/dialysis.go
  18. 1 0
      models/dialysis_parameter_models.go
  19. 5 0
      models/drug.go
  20. 1 0
      models/new_monitor.go
  21. 27 11
      models/patient_models.go
  22. 41 0
      models/role_models.go
  23. 2 0
      models/schedule_models.go
  24. 3 0
      models/user_models.go
  25. 7 0
      service/dialysis_parameter_service.go
  26. 6 0
      service/dialysis_service.go
  27. 62 0
      service/dialysis_solution_service.go
  28. 38 3
      service/gobal_config_service.go
  29. 2 2
      service/inspection_service.go
  30. 5 0
      service/manage_service.go
  31. 5 2
      service/mobile_dialysis_service.go
  32. 59 2
      service/patient_service.go
  33. 1 1
      service/patientmanage_service.go
  34. 138 0
      service/pharmacy_service.go
  35. 1 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  36. 2 2
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go
  37. 13 1
      service/schedule_service.go
  38. 60 1
      service/sign_service.go
  39. 1 0
      service/stock_service.go
  40. 2 0
      service/warhouse_service.go

+ 10 - 10
controllers/base_api_controller.go Ver arquivo

@@ -71,9 +71,9 @@ func (this *BaseAuthAPIController) Prepare() {
71 71
 	this.BaseAPIController.Prepare()
72 72
 	if this.GetAdminUserInfo() == nil {
73 73
 		var userAdmin models.AdminUser
74
-		userAdmin.Id = 796
74
+		userAdmin.Id = 16919
75 75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 796 //4,809
76
+		userAdmin.Id = 16919 //4,809
77 77
 		userAdmin.Mobile = "12222222222"
78 78
 		userAdmin.IsSuperAdmin = true
79 79
 		userAdmin.Status = 1
@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10344 //机构id 10344
84
+		subscibe.OrgId = 10579 //机构id 10344
85 85
 		subscibe.PeriodStart = 1547447814
86 86
 		subscibe.PeriodEnd = 1550039814
87 87
 		subscibe.State = 1
@@ -91,8 +91,8 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
95
-		adminUserInfo.CurrentAppId = 3244  //4
94
+		adminUserInfo.CurrentOrgId = 10579 //机构id小英9675或4
95
+		adminUserInfo.CurrentAppId = 16919 //4
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
98 98
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -316,9 +316,9 @@ func (this *BaseServeAPIController) Prepare() {
316 316
 	this.BaseAPIController.Prepare()
317 317
 	if this.GetAdminUserInfo() == nil {
318 318
 		var userAdmin models.AdminUser
319
-		userAdmin.Id = 796
319
+		userAdmin.Id = 16919
320 320
 		userAdmin.Mobile = "15717313968"
321
-		userAdmin.Id = 796 //4,809
321
+		userAdmin.Id = 16919 //4,809
322 322
 		userAdmin.Mobile = "12222222222"
323 323
 		userAdmin.IsSuperAdmin = false
324 324
 		userAdmin.Status = 1
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10344 //机构id小英10344或4
329
+		subscibe.OrgId = 10579 //机构id小英10344或4
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,8 +336,8 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
340
-		adminUserInfo.CurrentAppId = 3244  //4
339
+		adminUserInfo.CurrentOrgId = 10579 //机构id小英9675或4
340
+		adminUserInfo.CurrentAppId = 16919 //4
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes
343 343
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 156 - 8
controllers/dialysis_api_controller.go Ver arquivo

@@ -135,6 +135,12 @@ func DialysisApiRegistRouters() {
135 135
 	beego.Router("/api/patient/getmonitorloglist", &DialysisApiController{}, "Get:GetMonitorLogList")
136 136
 
137 137
 	beego.Router("/api/patient/getafterloglist", &DialysisApiController{}, "Get:GetAfterLogList")
138
+
139
+	beego.Router("/api/patient/savegathersetting", &DialysisApiController{}, "Get:SaveGatherSetting")
140
+
141
+	beego.Router("/api/patient/getgathersetting", &DialysisApiController{}, "Get:GetGatherSetting")
142
+
143
+	beego.Router("/api/patient/getdialysisgatherlist", &DialysisApiController{}, "Get:GetDialysisGatherList")
138 144
 }
139 145
 
140 146
 func (c *DialysisApiController) GetQueueCall() {
@@ -363,6 +369,7 @@ func (c *DialysisApiController) PostPrescription() {
363 369
 	washing_time := c.GetString("washing_time")
364 370
 	warsh_count := c.GetString("warsh_count")
365 371
 	blood_access_part_id := c.GetString("blood_access_part_id")
372
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
366 373
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
367 374
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
368 375
 
@@ -484,6 +491,7 @@ func (c *DialysisApiController) PostPrescription() {
484 491
 		WarshCount:                 warsh_count,
485 492
 		WashingTime:                washing_time,
486 493
 		BloodAccessPartId:          blood_access_part_id,
494
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
487 495
 	}
488 496
 
489 497
 	//长沙南雅医院,自动生成抗凝剂的临时处方
@@ -1012,6 +1020,7 @@ func (c *DialysisApiController) PostSoulution() {
1012 1020
 	warsh_count := c.GetString("warsh_count")
1013 1021
 	washing_time := c.GetString("washing_time")
1014 1022
 	blood_access_part_id := c.GetString("blood_access_part_id")
1023
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1015 1024
 	var prescription_doctor int64
1016 1025
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1017 1026
 
@@ -1183,6 +1192,7 @@ func (c *DialysisApiController) PostSoulution() {
1183 1192
 		WarshCount:                 warsh_count,
1184 1193
 		WashingTime:                washing_time,
1185 1194
 		BloodAccessPartId:          blood_access_part_id,
1195
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1186 1196
 	}
1187 1197
 
1188 1198
 	if prescription.Anticoagulant == 0 {
@@ -1392,6 +1402,7 @@ func (c *DialysisApiController) PostSoulution() {
1392 1402
 		WarshCount:                 warsh_count,
1393 1403
 		WashingTime:                washing_time,
1394 1404
 		BloodAccessPartId:          blood_access_part_id,
1405
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1395 1406
 	}
1396 1407
 
1397 1408
 	if solution.Anticoagulant == 0 {
@@ -2383,6 +2394,8 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2383 2394
 
2384 2395
 	washing_time := c.GetString("washing_time")
2385 2396
 
2397
+	puncture_needle_direction := c.GetString("puncture_needle_direction")
2398
+
2386 2399
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
2387 2400
 		DialysisCount:                  dialysis_count,
2388 2401
 		EmergencyTreatment:             emergency_treatment,
@@ -2465,6 +2478,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2465 2478
 		BeforSymptoms:                  befor_symptoms,
2466 2479
 		WarshCount:                     warsh_count,
2467 2480
 		WashingTime:                    washing_time,
2481
+		PunctureNeedleDirection:        puncture_needle_direction,
2468 2482
 	}
2469 2483
 
2470 2484
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -4392,12 +4406,12 @@ func (c *DialysisApiController) GetDialysisOrder() {
4392 4406
 	}
4393 4407
 	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
4394 4408
 
4395
-		if xttime <= 1672416000 {
4409
+		if xttime <= 1703952000 {
4396 4410
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4397 4411
 			patientInfo.TotalDialysis = dialysis_count
4398 4412
 		}
4399 4413
 
4400
-		if xttime >= 1672502400 {
4414
+		if xttime >= 1704038400 {
4401 4415
 			dialysis_count, _ := service.GetDialysisOrderCountTwo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4402 4416
 			patientInfo.TotalDialysis = dialysis_count
4403 4417
 		}
@@ -5900,17 +5914,20 @@ func (this *DialysisApiController) GetDialysisAdviceTemplateList() {
5900 5914
 	//获取长期医嘱
5901 5915
 	adviceList, _ := service.GetAllLongAdviceList(orgId)
5902 5916
 
5917
+	longHisAdviceList, _ := service.GetHisLongAdviceList(orgId)
5918
+
5903 5919
 	_, config := service.FindXTHisRecordByOrgId(orgId)
5904 5920
 
5905 5921
 	drugList, _ := service.GetAllBaseDrugListTwenty(orgId)
5906 5922
 	if err == nil {
5907 5923
 		this.ServeSuccessJSON(map[string]interface{}{
5908
-			"list":       list,
5909
-			"total":      total,
5910
-			"adviceList": adviceList,
5911
-			"config":     config,
5912
-			"drugList":   drugList,
5913
-			"tablelist":  tablelist,
5924
+			"list":              list,
5925
+			"total":             total,
5926
+			"adviceList":        adviceList,
5927
+			"config":            config,
5928
+			"drugList":          drugList,
5929
+			"tablelist":         tablelist,
5930
+			"longHisAdviceList": longHisAdviceList,
5914 5931
 		})
5915 5932
 		return
5916 5933
 
@@ -7463,3 +7480,134 @@ func (this *DialysisApiController) GetAfterLogList() {
7463 7480
 		return
7464 7481
 	}
7465 7482
 }
7483
+
7484
+func (this *DialysisApiController) SaveGatherSetting() {
7485
+
7486
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7487
+	is_index_number, _ := this.GetInt64("is_index_number")
7488
+	fmt.Println("this,23o2332232323232332", is_index_number)
7489
+	is_zone, _ := this.GetInt64("is_zone")
7490
+	is_number, _ := this.GetInt64("is_number")
7491
+	is_birth, _ := this.GetInt64("is_birth")
7492
+	is_age, _ := this.GetInt64("is_age")
7493
+	is_name, _ := this.GetInt64("is_name")
7494
+	is_mode_type, _ := this.GetInt64("is_mode_type")
7495
+	is_prescription_status, _ := this.GetInt64("is_prescription_status")
7496
+	is_admission_number, _ := this.GetInt64("is_admission_number")
7497
+	is_dialysis_no, _ := this.GetInt64("is_dialysis_no")
7498
+	is_dry_weight, _ := this.GetInt64("is_dry_weight")
7499
+	is_dialysis_dialyszers, _ := this.GetInt64("is_dialysis_dialyszers")
7500
+	is_dialysis_strainer, _ := this.GetInt64("is_dialysis_strainer")
7501
+	is_dialysis_irrigation, _ := this.GetInt64("is_dialysis_irrigation")
7502
+	is_calcium, _ := this.GetInt64("is_calcium")
7503
+	is_kalium, _ := this.GetInt64("is_kalium")
7504
+	is_change_nurse, _ := this.GetInt64("is_change_nurse")
7505
+	is_puncture_needle, _ := this.GetInt64("is_puncture_needle")
7506
+	is_anticoagulant, _ := this.GetInt64("is_anticoagulant")
7507
+	is_tube, _ := this.GetInt64("is_tube")
7508
+	is_cuhong, _ := this.GetInt64("is_cuhong")
7509
+	is_zuoka, _ := this.GetInt64("is_zuoka")
7510
+	is_zhetangtie, _ := this.GetInt64("is_zhetangtie")
7511
+	is_paligu, _ := this.GetInt64("is_paligu")
7512
+	is_guhuachun, _ := this.GetInt64("is_guhuachun")
7513
+	is_niaojimei, _ := this.GetInt64("is_niaojimei")
7514
+	is_putaosuangai, _ := this.GetInt64("is_putaosuangai")
7515
+	is_jiaguan, _ := this.GetInt64("is_jiaguan")
7516
+	is_xiongxiewutai, _ := this.GetInt64("is_xiongxiewutai")
7517
+
7518
+	gatherSetting := models.XtDialysisGatherSetting{
7519
+		UserOrgId:          orgId,
7520
+		IndexNumber:        is_index_number,
7521
+		Zone:               is_zone,
7522
+		Number:             is_number,
7523
+		Birth:              is_birth,
7524
+		Name:               is_name,
7525
+		Age:                is_age,
7526
+		ModeType:           is_mode_type,
7527
+		PrescriptionStatus: is_prescription_status,
7528
+		AdmissionNumber:    is_admission_number,
7529
+		DialysisNo:         is_dialysis_no,
7530
+		DryWeight:          is_dry_weight,
7531
+		DialysisDialyszers: is_dialysis_dialyszers,
7532
+		DialysisStrainer:   is_dialysis_strainer,
7533
+		DialysisIrrigation: is_dialysis_irrigation,
7534
+		Calcium:            is_calcium,
7535
+		Kalium:             is_kalium,
7536
+		ChangeNurse:        is_change_nurse,
7537
+		PunctureNeedle:     is_puncture_needle,
7538
+		Anticoagulant:      is_anticoagulant,
7539
+		Tube:               is_tube,
7540
+		Cuhong:             is_cuhong,
7541
+		Zuoka:              is_zuoka,
7542
+		Zhetangtie:         is_zhetangtie,
7543
+		Paligu:             is_paligu,
7544
+		Guhuachun:          is_guhuachun,
7545
+		Niaojimei:          is_niaojimei,
7546
+		Putaosuangai:       is_putaosuangai,
7547
+		Jiaguan:            is_jiaguan,
7548
+		Xiongxiewutai:      is_xiongxiewutai,
7549
+		Ctime:              time.Now().Unix(),
7550
+		Mtime:              time.Now().Unix(),
7551
+		Status:             1,
7552
+	}
7553
+	//查询该机构有没有设置
7554
+	gatherSettingOne, _ := service.GetGatherSettingByOrgId(orgId)
7555
+	if gatherSettingOne.ID == 0 {
7556
+		service.CreateGather(gatherSetting)
7557
+	} else {
7558
+		gatherSetting.ID = gatherSettingOne.ID
7559
+		service.SaveGather(gatherSetting)
7560
+	}
7561
+
7562
+	this.ServeSuccessJSON(map[string]interface{}{
7563
+		"gatherSetting": gatherSetting,
7564
+	})
7565
+	return
7566
+}
7567
+
7568
+func (this *DialysisApiController) GetGatherSetting() {
7569
+
7570
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7571
+
7572
+	gatherSetting, _ := service.GetGatherSetting(orgId)
7573
+
7574
+	this.ServeSuccessJSON(map[string]interface{}{
7575
+		"gatherSetting": gatherSetting,
7576
+	})
7577
+	return
7578
+}
7579
+
7580
+func (this *DialysisApiController) GetDialysisGatherList() {
7581
+
7582
+	keyword := this.GetString("keywords")
7583
+
7584
+	limit, _ := this.GetInt64("limit")
7585
+
7586
+	page, _ := this.GetInt64("page")
7587
+
7588
+	partion_type := this.GetString("partition_id")
7589
+	idSplit := strings.Split(partion_type, ",")
7590
+	schedule_type, _ := this.GetInt64("schedule_type")
7591
+
7592
+	start_time := this.GetString("schedule_date")
7593
+	timeLayout := "2006-01-02"
7594
+	loc, _ := time.LoadLocation("Local")
7595
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7596
+
7597
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7598
+
7599
+	scheduids := this.GetString("ids")
7600
+	var ids []string
7601
+	if scheduids != "" {
7602
+		ids = strings.Split(scheduids, ",")
7603
+	}
7604
+
7605
+	list, total, _ := service.GetDialysisGatherList(keyword, limit, page, idSplit, schedule_type, startTime.Unix(), orgId, ids)
7606
+	gatherSetting, _ := service.GetGatherSetting(orgId)
7607
+	this.ServeSuccessJSON(map[string]interface{}{
7608
+		"list":          list,
7609
+		"total":         total,
7610
+		"gatherSetting": gatherSetting,
7611
+	})
7612
+	return
7613
+}

+ 1 - 0
controllers/dialysis_record_api_controller.go Ver arquivo

@@ -77,6 +77,7 @@ func (this *DialysisRecordAPIController) GetSchedules() {
77 77
 	redis := service.RedisClient()
78 78
 	defer redis.Close()
79 79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
80
+
80 81
 	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81 82
 	scheduals_json_str, _ := redis.Get(key).Result()
82 83
 

+ 1 - 0
controllers/doctors_api_controller.go Ver arquivo

@@ -125,6 +125,7 @@ func (c *DoctorsApiController) ScheduleAdvices() {
125 125
 			})
126 126
 		}
127 127
 	}
128
+
128 129
 	if config.IsOpen == 1 {
129 130
 		hisAdvices, err := service.GetHisDoctorAdvicesTwentyOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency)
130 131
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)

+ 7 - 0
controllers/drug_stock_api_contorller.go Ver arquivo

@@ -1270,6 +1270,8 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
1270 1270
 
1271 1271
 				stock_count, _ := items["stock_count"].(string)
1272 1272
 
1273
+				patient_id := int64(items["patient_id"].(float64))
1274
+
1273 1275
 				id := int64(items["id"].(float64))
1274 1276
 
1275 1277
 				warehouseOutInfo := &models.DrugWarehouseOutInfo{
@@ -1302,6 +1304,7 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
1302 1304
 					StockCount:              stock_count,
1303 1305
 					IsCheck:                 2,
1304 1306
 					SysRecordTime:           warehousingOutDate.Unix(),
1307
+					PatientId:               patient_id,
1305 1308
 				}
1306 1309
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1307 1310
 
@@ -1521,6 +1524,7 @@ func (c *StockDrugApiController) GetDrugWarehouseOutInfoList() {
1521 1524
 	houstList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1522 1525
 	appId := c.GetAdminUserInfo().CurrentAppId
1523 1526
 	doctorList, _ := service.GetAllDoctorListSix(adminInfo.CurrentOrgId, appId)
1527
+	patients, _ := service.GetAllpatientTwenty(adminInfo.CurrentOrgId)
1524 1528
 	c.ServeSuccessJSON(map[string]interface{}{
1525 1529
 		"list":       warehouseOutInfo,
1526 1530
 		"info":       warehouseOut,
@@ -1528,6 +1532,7 @@ func (c *StockDrugApiController) GetDrugWarehouseOutInfoList() {
1528 1532
 		"dealerList": dealerList,
1529 1533
 		"houstList":  houstList,
1530 1534
 		"doctorList": doctorList,
1535
+		"patients":   patients,
1531 1536
 	})
1532 1537
 
1533 1538
 }
@@ -3323,6 +3328,7 @@ func (c *StockDrugApiController) GetAllConfig() {
3323 3328
 	configlist, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
3324 3329
 	appId := c.GetAdminUserInfo().CurrentAppId
3325 3330
 	doctorList, _ := service.GetAllDoctorListSix(adminUserInfo.CurrentOrgId, appId)
3331
+	patients, _ := service.GetAllpatientTwenty(adminUserInfo.CurrentOrgId)
3326 3332
 	c.ServeSuccessJSON(map[string]interface{}{
3327 3333
 		"manufacturer": manufacturer,
3328 3334
 		"dealer":       dealer,
@@ -3331,6 +3337,7 @@ func (c *StockDrugApiController) GetAllConfig() {
3331 3337
 		"list":         list,
3332 3338
 		"configlist":   configlist,
3333 3339
 		"doctorList":   doctorList,
3340
+		"patients":     patients,
3334 3341
 	})
3335 3342
 }
3336 3343
 

+ 16 - 22
controllers/mobile_api_controllers/check_weight_api_controller.go Ver arquivo

@@ -283,23 +283,6 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
283 283
 
284 284
 	schedual, _ := service.MobileGetSchedualDetail(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix())
285 285
 
286
-	//dialysisSolution,_ := service.MobileGetDialysisSolutionByModeId(adminUserInfo.Org.Id,patient.ID,schedual.ModeId)
287
-
288
-	//dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeId(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix(),schedual.ModeId)
289
-
290
-	//dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeId(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix(),schedual.ModeId)
291
-
292
-	//dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeId(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix(),schedual.ModeId)
293
-
294
-	// 查询当前用户今天有没有排班,没有排班,则不处理
295
-	// daySchedule, _ := service.GetPatientScheduleFormDay(adminUserInfo.Org.Id, theAssessmentDateTime, endTime, id)
296
-	// if(len(daySchedule) <= 0) {
297
-	// 	c.ServeSuccessJSON(map[string]interface{}{
298
-	// 		"msg":        "ok",
299
-	// 	})
300
-	// 	return
301
-	// }
302
-
303 286
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
304 287
 
305 288
 	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 {
@@ -403,6 +386,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
403 386
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
404 387
 			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
405 388
 			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
389
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
406 390
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
407 391
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
408 392
 
@@ -444,8 +428,20 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
444 428
 				newprescribe.Remark = lastDialysisPrescription.Remark
445 429
 			}
446 430
 
447
-			//插入透析处方
448
-			err := service.AddSigleRecord(&newprescribe)
431
+			//针对普宁和揭阳
432
+			if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
433
+				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
434
+				if prescriptionTwenty.ID == 0 {
435
+					//插入透析处方
436
+					service.AddSigleRecord(&newprescribe)
437
+				} else {
438
+					//插入透析处方
439
+					service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
440
+				}
441
+			} else {
442
+				//插入透析处方
443
+				service.AddSigleRecord(&newprescribe)
444
+			}
449 445
 
450 446
 			//记录日志
451 447
 			byterequest, _ := json.Marshal(newprescribe)
@@ -473,9 +469,6 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
473 469
 			keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
474 470
 			redis.Set(keyThree, "", time.Second)
475 471
 			defer redis.Close()
476
-			if err != nil {
477
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
478
-			}
479 472
 		}
480 473
 
481 474
 		if dialysisPrescribe == nil && dialysisSolution == nil {
@@ -520,6 +513,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
520 513
 				newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
521 514
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
522 515
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
516
+				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
523 517
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
524 518
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
525 519
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId

+ 137 - 46
controllers/mobile_api_controllers/dialysis_api_controller.go Ver arquivo

@@ -1815,6 +1815,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1815 1815
 	washing_time := c.GetString("washing_time")
1816 1816
 	warsh_count := c.GetString("warsh_count")
1817 1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1818
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1818 1819
 
1819 1820
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820 1821
 
@@ -1979,6 +1980,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1979 1980
 		WashingTime:                washing_time,
1980 1981
 		WarshCount:                 warsh_count,
1981 1982
 		BloodAccessPartId:          blood_access_part_id,
1983
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1982 1984
 	}
1983 1985
 
1984 1986
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -3352,10 +3354,14 @@ func (this *DialysisAPIController) StartDialysis() {
3352 3354
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3353 3355
 
3354 3356
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3355
-			if (template.TemplateId == 6 || template.TemplateId == 32 || template.TemplateId == 65 || adminUserInfo.Org.Id == 10375) && adminUserInfo.Org.Id != 9671 { //adminUserInfo.Org.Id == 9538
3357
+			if (template.TemplateId == 6 || template.TemplateId == 32 || template.TemplateId == 65 || adminUserInfo.Org.Id == 10375 || adminUserInfo.Org.Id == 10599) && adminUserInfo.Org.Id != 9671 { //adminUserInfo.Org.Id == 9538
3356 3358
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3357 3359
 			}
3358 3360
 
3361
+			if adminUserInfo.Org.Id == 10597 { //adminUserInfo.Org.Id == 9538
3362
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater / float64(totalMin) * 60 * 1000)
3363
+			}
3364
+
3359 3365
 			//针对医师汇
3360 3366
 			if adminUserInfo.Org.Id == 10121 {
3361 3367
 				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
@@ -3706,6 +3712,7 @@ func (c *DialysisAPIController) PostSolution() {
3706 3712
 	washing_time := c.GetString("washing_time")
3707 3713
 	warsh_count := c.GetString("warsh_count")
3708 3714
 	blood_access_part_id := c.GetString("blood_access_part_id")
3715
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
3709 3716
 	if mode_id > 0 {
3710 3717
 
3711 3718
 		var str string
@@ -3867,6 +3874,7 @@ func (c *DialysisAPIController) PostSolution() {
3867 3874
 		WashingTime:                washing_time,
3868 3875
 		WarshCount:                 warsh_count,
3869 3876
 		BloodAccessPartId:          blood_access_part_id,
3877
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3870 3878
 	}
3871 3879
 
3872 3880
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -3994,6 +4002,7 @@ func (c *DialysisAPIController) PostSolution() {
3994 4002
 		WashingTime:                washing_time,
3995 4003
 		WarshCount:                 warsh_count,
3996 4004
 		BloodAccessPartId:          blood_access_part_id,
4005
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3997 4006
 	}
3998 4007
 
3999 4008
 	//针对河间咸的
@@ -4359,12 +4368,17 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4359 4368
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4360 4369
 
4361 4370
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4362
-			if (template.TemplateId == 6 || template.TemplateId == 65 || adminInfo.Org.Id == 10375) && adminInfo.Org.Id != 9538 {
4371
+			if (template.TemplateId == 6 || template.TemplateId == 65 || adminInfo.Org.Id == 10375 || adminInfo.Org.Id == 10599) && adminInfo.Org.Id != 9538 {
4363 4372
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4364 4373
 				record.UltrafiltrationRate = ultrafiltration_rate
4365 4374
 
4366 4375
 			}
4367 4376
 
4377
+			if adminInfo.Org.Id == 10597 {
4378
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater / float64(totalMin) * 60 * 1000)
4379
+				record.UltrafiltrationRate = ultrafiltration_rate
4380
+			}
4381
+
4368 4382
 			if adminInfo.Org.Id == 10510 {
4369 4383
 				record.UltrafiltrationRate = 0
4370 4384
 			}
@@ -4435,6 +4449,9 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4435 4449
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
4436 4450
 			}
4437 4451
 
4452
+			if adminInfo.Org.Id == 10597 || adminInfo.Org.Id == 10599 {
4453
+				record.UltrafiltrationRate = 0
4454
+			}
4438 4455
 			//if template.TemplateId == 47 {
4439 4456
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
4440 4457
 			//	record.UltrafiltrationRate = ultrafiltration_rate
@@ -4452,7 +4469,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4452 4469
 		}
4453 4470
 	}
4454 4471
 
4455
-	if template.TemplateId == 6 || template.TemplateId == 65 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 { //adminInfo.Org.Id == 9538
4472
+	if template.TemplateId == 6 || template.TemplateId == 65 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 || adminInfo.Org.Id == 10599 { //adminInfo.Org.Id == 9538
4456 4473
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
4457 4474
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4458 4475
 			record.UltrafiltrationVolume = ultrafiltration_volume
@@ -4460,6 +4477,11 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4460 4477
 		}
4461 4478
 	}
4462 4479
 
4480
+	if adminInfo.Org.Id == 10597 {
4481
+		ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4482
+		record.UltrafiltrationVolume = ultrafiltration_volume
4483
+	}
4484
+
4463 4485
 	//长沙南雅
4464 4486
 	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 10469 || adminInfo.Org.Id == 10375 {
4465 4487
 
@@ -4502,9 +4524,11 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4502 4524
 	if adminInfo.Org.Id == 10510 {
4503 4525
 		record.UltrafiltrationVolume = 0
4504 4526
 	}
4527
+	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
4505 4528
 
4506 4529
 	this.ServeSuccessJSON(map[string]interface{}{
4507
-		"monitor": record,
4530
+		"monitor":               record,
4531
+		"lastMonitorRecordList": lastMonitorRecordList,
4508 4532
 	})
4509 4533
 
4510 4534
 }
@@ -5260,9 +5284,12 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
5260 5284
 	for _, adviceNameMap := range adviceNames {
5261 5285
 		adviceNameM := adviceNameMap.(map[string]interface{})
5262 5286
 		var advice models.GroupAdvice
5287
+
5263 5288
 		advice.Remark = Remark
5264 5289
 		advice.AdviceType = adviceType
5290
+
5265 5291
 		advice.StartTime = StartTime
5292
+
5266 5293
 		advice.AdviceDate = AdviceDate
5267 5294
 
5268 5295
 		advice.RecordDate = RecordDate
@@ -5372,6 +5399,11 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
5372 5399
 			advice.DrugNameId = drug_name_id
5373 5400
 		}
5374 5401
 
5402
+		if adviceNameM["groupno"] != nil || reflect.TypeOf(adviceNameM["groupno"]).String() == "float64" {
5403
+			groupno := int64(adviceNameM["groupno"].(float64))
5404
+			advice.GroupNo = groupno
5405
+		}
5406
+
5375 5407
 		if adviceNameM["template_id"] != nil && reflect.TypeOf(adviceNameM["template_id"]).String() == "string" {
5376 5408
 			template_id, _ := adviceNameM["template_id"].(string)
5377 5409
 			advice.TemplateId = template_id
@@ -5448,6 +5480,11 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
5448 5480
 						child.PrescribingNumberUnit = childPrescribingNumberUnit
5449 5481
 					}
5450 5482
 
5483
+					if childMap["groupno"] != nil || reflect.TypeOf(childMap["groupno"]).String() == "float64" {
5484
+						groupno := int64(childMap["groupno"].(float64))
5485
+						advice.GroupNo = groupno
5486
+					}
5487
+
5451 5488
 					child.DeliveryWay = advice.DeliveryWay
5452 5489
 					child.ExecutionFrequency = advice.ExecutionFrequency
5453 5490
 					advice.Children = append(advice.Children, &child)
@@ -5475,51 +5512,92 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
5475 5512
 			PatientId:  patient,
5476 5513
 		}
5477 5514
 
5478
-		dialysisFinish, err := service.GetDialysisFinish(adminUserInfo.Org.Id, AdviceDate, 4, patient)
5515
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.Org.Id, AdviceDate, 4, patient)
5479 5516
 		if dialysisFinish.ID == 0 {
5480 5517
 			service.CreateDialysisFinish(finish)
5481 5518
 		}
5482 5519
 
5483
-		list, err := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, groupNo)
5520
+		if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 9671 {
5521
+			list, err := service.CreateMGroupAdviceOne(adminUserInfo.Org.Id, advices, groupNo)
5522
+			for _, item := range advices {
5523
+				byterequest, _ := json.Marshal(item)
5524
+				adviceLog := models.XtDoctorAdviceLog{
5525
+					UserOrgId:   adminUserInfo.Org.Id,
5526
+					PatientId:   patient,
5527
+					AdminUserId: adminUserInfo.AdminUser.Id,
5528
+					Module:      1,
5529
+					ErrLog:      string(byterequest),
5530
+					Status:      1,
5531
+					Ctime:       time.Now().Unix(),
5532
+					Mtime:       0,
5533
+					Source:      "手机端医嘱推送",
5534
+					RecordDate:  item.AdviceDate,
5535
+				}
5484 5536
 
5485
-		for _, item := range advices {
5486
-			byterequest, _ := json.Marshal(item)
5487
-			adviceLog := models.XtDoctorAdviceLog{
5488
-				UserOrgId:   adminUserInfo.Org.Id,
5489
-				PatientId:   patient,
5490
-				AdminUserId: adminUserInfo.AdminUser.Id,
5491
-				Module:      1,
5492
-				ErrLog:      string(byterequest),
5493
-				Status:      1,
5494
-				Ctime:       time.Now().Unix(),
5495
-				Mtime:       0,
5496
-				Source:      "手机端医嘱推送",
5497
-				RecordDate:  item.AdviceDate,
5537
+				service.CreateDoctorAdviceLog(adviceLog)
5498 5538
 			}
5499 5539
 
5500
-			service.CreateDoctorAdviceLog(adviceLog)
5501
-		}
5540
+			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(RecordDate, 10) + ":doctor_advices"
5541
+			redis := service.RedisClient()
5542
+			//清空key 值
5543
+			redis.Set(key, "", time.Second)
5502 5544
 
5503
-		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(RecordDate, 10) + ":doctor_advices"
5504
-		redis := service.RedisClient()
5505
-		//清空key 值
5506
-		redis.Set(key, "", time.Second)
5545
+			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
5546
+			redis.Set(keyOne, "", time.Second)
5507 5547
 
5508
-		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
5509
-		redis.Set(keyOne, "", time.Second)
5548
+			keyThree := "scheduals_" + adviceDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
5549
+			defer redis.Close()
5550
+			redis.Set(keyThree, "", time.Second)
5551
+			if err != nil {
5552
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
5553
+				return
5554
+			}
5510 5555
 
5511
-		keyThree := "scheduals_" + adviceDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
5512
-		defer redis.Close()
5513
-		redis.Set(keyThree, "", time.Second)
5514
-		if err != nil {
5515
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
5516
-			return
5517
-		}
5556
+			c.ServeSuccessJSON(map[string]interface{}{
5557
+				"msg":     "ok",
5558
+				"advices": list,
5559
+			})
5560
+		} else {
5561
+			list, err := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, groupNo)
5562
+			for _, item := range advices {
5563
+				byterequest, _ := json.Marshal(item)
5564
+				adviceLog := models.XtDoctorAdviceLog{
5565
+					UserOrgId:   adminUserInfo.Org.Id,
5566
+					PatientId:   patient,
5567
+					AdminUserId: adminUserInfo.AdminUser.Id,
5568
+					Module:      1,
5569
+					ErrLog:      string(byterequest),
5570
+					Status:      1,
5571
+					Ctime:       time.Now().Unix(),
5572
+					Mtime:       0,
5573
+					Source:      "手机端医嘱推送",
5574
+					RecordDate:  item.AdviceDate,
5575
+				}
5518 5576
 
5519
-		c.ServeSuccessJSON(map[string]interface{}{
5520
-			"msg":     "ok",
5521
-			"advices": list,
5522
-		})
5577
+				service.CreateDoctorAdviceLog(adviceLog)
5578
+			}
5579
+
5580
+			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(RecordDate, 10) + ":doctor_advices"
5581
+			redis := service.RedisClient()
5582
+			//清空key 值
5583
+			redis.Set(key, "", time.Second)
5584
+
5585
+			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
5586
+			redis.Set(keyOne, "", time.Second)
5587
+
5588
+			keyThree := "scheduals_" + adviceDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
5589
+			defer redis.Close()
5590
+			redis.Set(keyThree, "", time.Second)
5591
+			if err != nil {
5592
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
5593
+				return
5594
+			}
5595
+
5596
+			c.ServeSuccessJSON(map[string]interface{}{
5597
+				"msg":     "ok",
5598
+				"advices": list,
5599
+			})
5600
+		}
5523 5601
 
5524 5602
 	} else {
5525 5603
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -8091,6 +8169,8 @@ func (c *DialysisAPIController) GetPrescriptionList() {
8091 8169
 
8092 8170
 	start_time := c.GetString("start_time")
8093 8171
 	end_time := c.GetString("end_time")
8172
+	schedule_type, _ := c.GetInt64("schedule_type")
8173
+	partion_id, _ := c.GetInt64("partion_id")
8094 8174
 	orgId := c.GetMobileAdminUserInfo().Org.Id
8095 8175
 	timeLayout := "2006-01-02"
8096 8176
 	loc, _ := time.LoadLocation("Local")
@@ -8113,7 +8193,7 @@ func (c *DialysisAPIController) GetPrescriptionList() {
8113 8193
 		}
8114 8194
 		endTime = theTime.Unix()
8115 8195
 	}
8116
-	schedulelist, _ := service.GetMobileScheduleListOne(startTime, endTime, orgId)
8196
+	schedulelist, _ := service.GetMobileScheduleListOne(startTime, endTime, orgId, schedule_type, partion_id)
8117 8197
 
8118 8198
 	fmt.Println("schedulelist22222222", schedulelist)
8119 8199
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -8157,12 +8237,9 @@ func (c *DialysisAPIController) GetPatientDialysisRecordList() {
8157 8237
 
8158 8238
 	end_time := c.GetString("end_time")
8159 8239
 
8160
-	fmt.Println("start_timeo2o2o2o2o2o", start_time)
8161
-	fmt.Println("end_Time2o2o2o2ooo22", end_time)
8162 8240
 	var startdateunix int64
8163 8241
 	if len(start_time) > 0 {
8164 8242
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8165
-		fmt.Println("theTim3333333333333333333333e", theTime)
8166 8243
 		if err != nil {
8167 8244
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8168 8245
 			return
@@ -8190,20 +8267,34 @@ func (c *DialysisAPIController) GetPatientDialysisRecordList() {
8190 8267
 
8191 8268
 	org_id := c.GetMobileAdminUserInfo().Org.Id
8192 8269
 
8193
-	if org_id == 10579 {
8194
-		list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
8270
+	//if org_id == 10579 {
8271
+	//	list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
8272
+	//	c.ServeSuccessJSON(map[string]interface{}{
8273
+	//		"list": list,
8274
+	//	})
8275
+	//	return
8276
+	//} else {
8277
+	//	list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
8278
+	//	c.ServeSuccessJSON(map[string]interface{}{
8279
+	//		"list": list,
8280
+	//	})
8281
+	//	return
8282
+	//}
8283
+	if org_id == 9538 || org_id == 10101 {
8284
+		list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
8195 8285
 		c.ServeSuccessJSON(map[string]interface{}{
8196 8286
 			"list": list,
8197 8287
 		})
8198 8288
 		return
8199 8289
 	} else {
8200
-		list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
8290
+		list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
8201 8291
 		c.ServeSuccessJSON(map[string]interface{}{
8202 8292
 			"list": list,
8203 8293
 		})
8204
-		return
8205 8294
 	}
8206 8295
 
8296
+	return
8297
+
8207 8298
 }
8208 8299
 
8209 8300
 func (c *DialysisAPIController) BathDeleteAdviceList() {

+ 32 - 4
controllers/mobile_api_controllers/patient_api_controller.go Ver arquivo

@@ -716,9 +716,12 @@ func (c *PatientApiController) ExecDoctorAdvice() {
716 716
 			return
717 717
 		}
718 718
 
719
-		if advice.StartTime > theTime.Unix() {
720
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
721
-			return
719
+		//针对普宁
720
+		if adminUserInfo.Org.Id != 10599 {
721
+			if advice.StartTime > theTime.Unix() {
722
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
723
+				return
724
+			}
722 725
 		}
723 726
 
724 727
 		advices := models.DoctorAdvice{
@@ -2701,6 +2704,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2701 2704
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2702 2705
 		newprescribe.Remark = lastDialysisPrescription.Remark
2703 2706
 		newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2707
+
2704 2708
 		_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2705 2709
 		newprescribe.ID = dialysisPrescription.ID
2706 2710
 
@@ -3818,7 +3822,6 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
3818 3822
 
3819 3823
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3820 3824
 		is_infect, _ := dataBody["is_infect"].(string)
3821
-		fmt.Println("is_infect================", is_infect)
3822 3825
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3823 3826
 		evaluation.IsInfect = infect
3824 3827
 	}
@@ -4040,6 +4043,16 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
4040 4043
 		warsh_count, _ := dataBody["warsh_count"].(string)
4041 4044
 		evaluation.WarshCount = warsh_count
4042 4045
 	}
4046
+
4047
+	if dataBody["puncture_needle_direction"] != nil && reflect.TypeOf(dataBody["puncture_needle_direction"]).String() == "string" {
4048
+		puncture_needle_direction, _ := dataBody["puncture_needle_direction"].(string)
4049
+		evaluation.PunctureNeedleDirection = puncture_needle_direction
4050
+	}
4051
+
4052
+	if dataBody["symptom_before_dialysis_other"] != nil && reflect.TypeOf(dataBody["symptom_before_dialysis_other"]).String() == "string" {
4053
+		symptom_before_dialysis_other, _ := dataBody["symptom_before_dialysis_other"].(string)
4054
+		evaluation.SymptomBeforeDialysisOther = symptom_before_dialysis_other
4055
+	}
4043 4056
 	return
4044 4057
 }
4045 4058
 
@@ -4404,6 +4417,21 @@ func (c *PatientApiController) GetPatientMonitor() {
4404 4417
 			//获取所有的患者
4405 4418
 			patients, _ := service.GetAllPatientListByListOne(orgID)
4406 4419
 
4420
+			for _, it := range patients {
4421
+				if orgID == 10445 {
4422
+					if theStartTime <= 1703952000 {
4423
+						listOne, _ := service.GetDialysisOrderCountTwentyEight(orgID, it.ID, theStartTime)
4424
+						it.TotalDialysis = listOne.Count
4425
+
4426
+					}
4427
+
4428
+					if theStartTime >= 1704038400 {
4429
+						listOrder, _ := service.GetDialysisOrderCountTenEight(it.ID, theStartTime)
4430
+						it.TotalDialysis = listOrder.Count
4431
+					}
4432
+				}
4433
+			}
4434
+
4407 4435
 			//获取所有透析模式
4408 4436
 			treatments, _ := service.GetAllTreatModeByList(orgID)
4409 4437
 

+ 2 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Ver arquivo

@@ -843,20 +843,17 @@ func (this *NewDialysisApiController) GetlongDialysisrecord() {
843 843
 	timeLayout := "2006-01-02"
844 844
 	loc, _ := time.LoadLocation("Local")
845 845
 	id, _ := this.GetInt64("id")
846
-	fmt.Print("id", id)
847 846
 	patient, _ := service.GetPatientDetailTwo(id)
848 847
 	start := this.GetString("startime")
849 848
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
850 849
 	startime := startTimes.Unix()
851
-	fmt.Print("startime", startime)
852 850
 	end := this.GetString("endtime")
853 851
 	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
854 852
 	endtime := endTimes.Unix()
855
-	fmt.Print("endtime", endtime)
856 853
 	limit, _ := this.GetInt64("limit")
857
-	fmt.Print("limit", limit)
854
+
858 855
 	page, _ := this.GetInt64("page")
859
-	fmt.Print("page", page)
856
+
860 857
 	adminInfo := this.GetMobileAdminUserInfo()
861 858
 	orgid := adminInfo.Org.Id
862 859
 	dialysisrecord, total, err := service.GetlongDialysisrecord(patient.BloodId, startime, endtime, limit, page, orgid)

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

@@ -508,6 +508,14 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
508 508
 			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
509 509
 		}
510 510
 		service.CreateScheduleLog(xtScheduleLog)
511
+
512
+		//针对凤凰医院
513
+		if org_id == 10579 || org_id == 10344 {
514
+			advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, org_id)
515
+			if len(advice) > 0 {
516
+				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
517
+			}
518
+		}
511 519
 		redis := service.RedisClient()
512 520
 		//处方
513 521
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"

+ 6 - 1
controllers/patient_api_controller.go Ver arquivo

@@ -3686,7 +3686,7 @@ func (c *PatientApiController) DeleteGroupAdvice() {
3686 3686
 		}
3687 3687
 	}
3688 3688
 
3689
-	err := service.DeleteGroupAdvice(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
3689
+	err := service.DeleteGroupAdviceOne(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
3690 3690
 
3691 3691
 	byterequest, _ := json.Marshal(advice)
3692 3692
 	doctorAdviceLog := models.XtDoctorAdviceLog{
@@ -4607,6 +4607,11 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
4607 4607
 		chaptalization := dataBody["chaptalization"].(string)
4608 4608
 		solution.Chaptalization = chaptalization
4609 4609
 	}
4610
+
4611
+	if dataBody["blood_access_part_id"] != nil && reflect.TypeOf(dataBody["blood_access_part_id"]).String() == "string" {
4612
+		blood_access_part_id := dataBody["blood_access_part_id"].(string)
4613
+		solution.BloodAccessPartId = blood_access_part_id
4614
+	}
4610 4615
 	return
4611 4616
 }
4612 4617
 

+ 70 - 50
controllers/pharmacy_controller.go Ver arquivo

@@ -348,6 +348,7 @@ func (this *PharmacyController) GetPharmacyContent() {
348 348
 
349 349
 // 发药按钮点击
350 350
 func (this *PharmacyController) DispensingMedicine() {
351
+
351 352
 	var err error
352 353
 	defer func() {
353 354
 		if rec := recover(); rec != nil {
@@ -379,37 +380,35 @@ func (this *PharmacyController) DispensingMedicine() {
379 380
 		for _, item := range advicelist {
380 381
 			//查询改药品信息
381 382
 			medical, _ := service.GetBaseDrugMedical(item.DrugId)
382
-			//针对阜阳经沃
383
-			if orgid != 10480 {
384
-				if medical.IsPharmacy == 1 {
385
-					houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
386
-					//查询该药品是否有库存
387
-					list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
388
-
389
-					//判断单位是否相等
390
-					if medical.MaxUnit == item.PrescribingNumberUnit {
391
-						prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
392
-						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
393
-						//转化为最小单位
394
-						total = list.Count*medical.MinNumber + list.StockMinNumber
395
-						prescribing_number_total = count * medical.MinNumber
396
-					}
397
-					if medical.MinUnit == item.PrescribingNumberUnit {
398
-						prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
399
-						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
400
-						total = list.Count*medical.MinNumber + list.StockMinNumber
401
-						prescribing_number_total = count
402
-					}
383
+			//如果是药房发药的方式
384
+			if medical.IsPharmacy == 1 {
385
+				houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
386
+				//查询该药品是否有库存
387
+				list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
388
+
389
+				//判断单位是否相等
390
+				if medical.MaxUnit == item.PrescribingNumberUnit {
391
+					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
392
+					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
393
+					//转化为最小单位
394
+					total = list.Count*medical.MinNumber + list.StockMinNumber
395
+					prescribing_number_total = count * medical.MinNumber
396
+				}
397
+				if medical.MinUnit == item.PrescribingNumberUnit {
398
+					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
399
+					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
400
+					total = list.Count*medical.MinNumber + list.StockMinNumber
401
+					prescribing_number_total = count
402
+				}
403 403
 
404
-					if medical.IsUse != 1 {
405
-						//如果出库数量大于库存数量
406
-						if prescribing_number_total > total {
407
-							err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
408
-							if err != nil {
409
-								utils.ErrorLog(err.Error())
410
-								this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
411
-								return
412
-							}
404
+				if medical.IsUse != 1 {
405
+					//如果出库数量大于库存数量
406
+					if prescribing_number_total > total {
407
+						err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
408
+						if err != nil {
409
+							utils.ErrorLog(err.Error())
410
+							this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
411
+							return
413 412
 						}
414 413
 					}
415 414
 				}
@@ -418,34 +417,55 @@ func (this *PharmacyController) DispensingMedicine() {
418 417
 		}
419 418
 	}
420 419
 
421
-	err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
420
+	if orgid != 10480 {
421
+		//发药
422
+		err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
423
+		if err != nil {
424
+			utils.ErrorLog(err.Error())
425
+			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
426
+			return
427
+		}
422 428
 
423
-	if orgid == 10387 || orgid == 3877 {
424
-		advicelist, _ := service.FindeHisAdviceDocAdvice(orgid, patient_id, stime, etime)
425
-		if len(advicelist) > 0 {
426
-			for _, item := range advicelist {
427
-				//查询改药品信息
428
-				medical, _ := service.GetBaseDrugMedical(item.DrugId)
429
-				if medical.IsPharmacy == 1 {
430
-					flow, _ := service.GetFlow(item.DrugId, item.AdviceDate, orgid, item.PatientId)
431
-					if len(flow) > 0 {
432
-						service.UpdateAdviceFlow(item.ID)
429
+		this.ServeSuccessJSON(map[string]interface{}{
430
+			"list": "操作成功",
431
+		})
432
+		return
433
+	}
434
+
435
+	if orgid == 10480 {
436
+		//发药逻辑
437
+
438
+		service.DispensingMedicineOne(orgid, patient_id, stime, etime, creater)
439
+
440
+		//针对桑植盛康
441
+		if orgid == 10387 || orgid == 3877 {
442
+			advicelist, _ := service.FindeHisAdviceDocAdvice(orgid, patient_id, stime, etime)
443
+			if len(advicelist) > 0 {
444
+				for _, item := range advicelist {
445
+					//查询改药品信息
446
+					medical, _ := service.GetBaseDrugMedical(item.DrugId)
447
+					if medical.IsPharmacy == 1 {
448
+						flow, _ := service.GetFlow(item.DrugId, item.AdviceDate, orgid, item.PatientId)
449
+						if len(flow) > 0 {
450
+							service.UpdateAdviceFlow(item.ID)
451
+						}
433 452
 					}
434 453
 				}
435
-			}
436 454
 
455
+			}
437 456
 		}
438
-	}
439
-	if err != nil {
440
-		utils.ErrorLog(err.Error())
441
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
457
+		if err != nil {
458
+			utils.ErrorLog(err.Error())
459
+			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
460
+			return
461
+		}
462
+
463
+		this.ServeSuccessJSON(map[string]interface{}{
464
+			"list": "操作成功",
465
+		})
442 466
 		return
443 467
 	}
444 468
 
445
-	this.ServeSuccessJSON(map[string]interface{}{
446
-		"list": "操作成功",
447
-	})
448
-	return
449 469
 }
450 470
 
451 471
 // 退药按钮点击

+ 18 - 9
controllers/print_data_api_controller.go Ver arquivo

@@ -38,7 +38,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
38 38
 	adminUserInfo := this.GetAdminUserInfo()
39 39
 
40 40
 	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 || this.GetAdminUserInfo().CurrentOrgId == 10441 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
41
-
41
+		fmt.Println("JINALADOOWOWOWOWOWOO")
42 42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
43 43
 		for _, item := range schedules {
44 44
 
@@ -99,14 +99,14 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
99 99
 
100 100
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
101 101
 
102
-				if item.ScheduleDate <= 1672416000 {
102
+				if item.ScheduleDate <= 1703952000 {
103 103
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
104 104
 
105 105
 					item.Patient.TotalDialysis = listOne.Count
106 106
 					item.Count = listOne.Count
107 107
 				}
108 108
 
109
-				if item.ScheduleDate >= 1672502400 {
109
+				if item.ScheduleDate >= 1704038400 {
110 110
 
111 111
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
112 112
 
@@ -145,13 +145,26 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
145 145
 	}
146 146
 
147 147
 	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 && this.GetAdminUserInfo().CurrentOrgId != 10441 && this.GetAdminUserInfo().CurrentOrgId != 9970 && this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 10495 && this.GetAdminUserInfo().CurrentOrgId != 10013 && this.GetAdminUserInfo().CurrentOrgId != 10014 {
148
+
148 149
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
149 150
 		for _, item := range schedules {
151
+
150 152
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
151 153
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
152 154
 				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
153
-					listOrder, _ := service.GetDialysisOrderCountTen(item.PatientID, item.ScheduleDate)
154
-					item.Count = listOrder.DialysisTotal
155
+					if item.ScheduleDate <= 1703952000 {
156
+						listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
157
+
158
+						item.Patient.TotalDialysis = listOne.Count
159
+						item.Count = listOne.Count
160
+					}
161
+
162
+					if item.ScheduleDate >= 1704038400 {
163
+
164
+						listOrder, _ := service.GetDialysisOrderCountTen(item.PatientID, item.ScheduleDate)
165
+						item.Count = listOrder.DialysisTotal
166
+					}
167
+
155 168
 				}
156 169
 				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
157 170
 					item.Count = list.Count
@@ -162,10 +175,6 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
162 175
 
163 176
 			item.Schedule = &lastSchedule
164 177
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
165
-				//listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
166
-
167
-				//item.Patient.TotalDialysis = listOne.Count
168
-				//item.Count = listOne.Count
169 178
 
170 179
 				if item.ScheduleDate <= 1640966400 {
171 180
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)

+ 8 - 0
controllers/schedule_api_controller.go Ver arquivo

@@ -1968,6 +1968,14 @@ func (c *ScheduleApiController) DeleteSchedule() {
1968 1968
 
1969 1969
 	service.CreateScheduleLog(scheduleLog)
1970 1970
 
1971
+	//针对凤凰医院
1972
+	if adminINfo.CurrentOrgId == 10579 || adminINfo.CurrentOrgId == 10344 {
1973
+		advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1974
+		if len(advice) > 0 {
1975
+			service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1976
+		}
1977
+	}
1978
+
1971 1979
 	redis := service.RedisClient()
1972 1980
 
1973 1981
 	//处方

+ 51 - 4
controllers/sign_api_controller.go Ver arquivo

@@ -91,6 +91,9 @@ func SignApiRegistRouters() {
91 91
 
92 92
 	beego.Router("/api/device/toautodiagnose", &SignApiController{}, "Get:ToAutoDiagnose")
93 93
 
94
+	//加油
95
+	beego.Router("/api/device/toautojiayou", &SignApiController{}, "Get:ToAutoJiaYou")
96
+
94 97
 }
95 98
 
96 99
 // 短信服务接口
@@ -662,7 +665,6 @@ func (this *SignApiController) GetEnterPriseDetail() {
662 665
 
663 666
 func (this *SignApiController) UploadPrintOrder() {
664 667
 
665
-	fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
666 668
 	list, _ := service.GetAllPatientNew(10587)
667 669
 	for _, item := range list {
668 670
 
@@ -1214,6 +1216,14 @@ func (this *SignApiController) ToAutoDrug() {
1214 1216
 func (this *SignApiController) ToAutoDiagnose() {
1215 1217
 
1216 1218
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1219
+
1220
+	//order, _ := service.GetDialysisOrderTotalCount()
1221
+	//
1222
+	//for _, item := range order {
1223
+	//
1224
+	//	service.ModifyPatient(item.PatientId, item.Count)
1225
+	//}
1226
+
1217 1227
 	list, _ := service.GetNewAllpatient(orgId)
1218 1228
 
1219 1229
 	for _, item := range list {
@@ -1224,8 +1234,45 @@ func (this *SignApiController) ToAutoDiagnose() {
1224 1234
 	//for _, item := range list {
1225 1235
 	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
1226 1236
 	//}
1227
-	//this.ServeSuccessJSON(map[string]interface{}{
1228
-	//	"msg": "ok",
1229
-	//})
1230 1237
 
1238
+	//drugList, _ := service.GetAllBaseDrugList(10571)
1239
+	//for _, item := range drugList {
1240
+	//	//service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)
1241
+	//
1242
+	//	service.UpdateHisDoctorAdviceOne(item.ID, item.MinPrice, item.OrgId)
1243
+	//}
1244
+
1245
+	//goodList, _ := service.GetAllGoodList(10571)
1246
+	//for _, item := range goodList {
1247
+	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1248
+	//}
1249
+	this.ServeSuccessJSON(map[string]interface{}{
1250
+		"msg": "ok",
1251
+	})
1252
+
1253
+}
1254
+
1255
+func (this *SignApiController) ToAutoJiaYou() {
1256
+
1257
+	list, _ := service.GetPrescriptionListOne(10579)
1258
+
1259
+	for _, item := range list {
1260
+
1261
+		schedule, _ := service.GetPatientScheduleById(item.PatientId, item.RecordDate)
1262
+		var DialysisMachineName string
1263
+		if len(item.DialysisDialyszers) > 0 {
1264
+			DialysisMachineName = item.DialysisDialyszers
1265
+		}
1266
+
1267
+		if len(item.DialysisIrrigation) > 0 {
1268
+			DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
1269
+		}
1270
+
1271
+		if len(item.DialysisStrainer) > 0 {
1272
+			DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
1273
+		}
1274
+		DialysisMachineName = DialysisMachineName
1275
+
1276
+		service.UpdateDialysisScheduleOne(schedule.ID, item.ModeId, DialysisMachineName)
1277
+	}
1231 1278
 }

+ 13 - 1
controllers/stock_in_api_controller.go Ver arquivo

@@ -1329,6 +1329,8 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1329 1329
 				}
1330 1330
 				license_number := items["license_number"].(string)
1331 1331
 
1332
+				patient_id := int64(items["patient_id"].(float64))
1333
+
1332 1334
 				warehouseOutInfo := &models.WarehouseOutInfo{
1333 1335
 					ID:                      id,
1334 1336
 					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
@@ -1357,13 +1359,13 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1357 1359
 					IsCheck:                 2,
1358 1360
 					RegisterNumber:          register_number,
1359 1361
 					SysRecordTime:           warehouseOut.WarehouseOutTime,
1362
+					PatientId:               patient_id,
1360 1363
 				}
1361 1364
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1362 1365
 
1363 1366
 			}
1364 1367
 		}
1365 1368
 	}
1366
-	fmt.Println("warehouseOut_id", warehouseOut_id)
1367 1369
 	if warehouseOut_id == 0 {
1368 1370
 		//查询是否生成出库单
1369 1371
 		_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
@@ -1407,6 +1409,7 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1407 1409
 			Count:                   it.Count,
1408 1410
 			IsCheck:                 2,
1409 1411
 			RegisterNumber:          it.RegisterNumber,
1412
+			PatientId:               it.PatientId,
1410 1413
 		}
1411 1414
 		if it.ID == 0 {
1412 1415
 			service.AddSigleWarehouseOutInfo(warehouseOutInfo)
@@ -1712,6 +1715,8 @@ func (c *StockManagerApiController) EditWarehouseOut() {
1712 1715
 
1713 1716
 				register_number := items["register_number"].(string)
1714 1717
 
1718
+				patient_id := int64(items["patient_id"].(float64))
1719
+
1715 1720
 				var productDate int64
1716 1721
 				if len(product_date) > 0 {
1717 1722
 					theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", product_date+" 00:00:00", loc)
@@ -1751,6 +1756,7 @@ func (c *StockManagerApiController) EditWarehouseOut() {
1751 1756
 						AdminUserId:             admin_user_id,
1752 1757
 						StockCount:              stock_count,
1753 1758
 						RegisterNumber:          register_number,
1759
+						PatientId:               patient_id,
1754 1760
 					}
1755 1761
 					warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1756 1762
 
@@ -1798,6 +1804,7 @@ func (c *StockManagerApiController) EditWarehouseOut() {
1798 1804
 						AdminUserId:             admin_user_id,
1799 1805
 						StockCount:              stock_count,
1800 1806
 						RegisterNumber:          register_number,
1807
+						PatientId:               patient_id,
1801 1808
 					}
1802 1809
 					upDateWarehouseOutInfos = append(upDateWarehouseOutInfos, warehouseOutInfo)
1803 1810
 				}
@@ -3094,6 +3101,8 @@ func (c *StockManagerApiController) GetAllConfig() {
3094 3101
 	configList, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
3095 3102
 	appId := c.GetAdminUserInfo().CurrentAppId
3096 3103
 	doctorList, _ := service.GetAllDoctorListSix(adminUserInfo.CurrentOrgId, appId)
3104
+
3105
+	patients, _ := service.GetAllpatientTwenty(adminUserInfo.CurrentOrgId)
3097 3106
 	c.ServeSuccessJSON(map[string]interface{}{
3098 3107
 		"manufacturer": manufacturer,
3099 3108
 		"dealer":       dealer,
@@ -3102,6 +3111,7 @@ func (c *StockManagerApiController) GetAllConfig() {
3102 3111
 		"list":         list,
3103 3112
 		"configlist":   configList,
3104 3113
 		"doctorList":   doctorList,
3114
+		"patients":     patients,
3105 3115
 	})
3106 3116
 }
3107 3117
 func (this *StockManagerApiController) GetAllSalesReturnConfig() {
@@ -4989,6 +4999,7 @@ func (this *StockManagerApiController) GetSingleOutOrderDetail() {
4989 4999
 	goodType, _ := service.GetAllGoodType(orgId)
4990 5000
 	appId := this.GetAdminUserInfo().CurrentAppId
4991 5001
 	doctorlist, _ := service.GetAllDoctorListSix(orgId, appId)
5002
+	patients, _ := service.GetAllpatientTwenty(orgId)
4992 5003
 	this.ServeSuccessJSON(map[string]interface{}{
4993 5004
 		"list":             warehouseOutInfo,
4994 5005
 		"dealerList":       dealerList,
@@ -4997,6 +5008,7 @@ func (this *StockManagerApiController) GetSingleOutOrderDetail() {
4997 5008
 		"out":              out,
4998 5009
 		"storelist":        storelist,
4999 5010
 		"doctorlist":       doctorlist,
5011
+		"patients":         patients,
5000 5012
 	})
5001 5013
 }
5002 5014
 

+ 14 - 0
models/dialysis.go Ver arquivo

@@ -329,6 +329,7 @@ type PredialysisEvaluation struct {
329 329
 	BeforSymptoms                  string  `gorm:"column:befor_symptoms" json:"befor_symptoms" form:"befor_symptoms"`
330 330
 	WashingTime                    string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
331 331
 	WarshCount                     string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
332
+	PunctureNeedleDirection        string  `gorm:"column:puncture_needle_direction" json:"puncture_needle_direction" form:"puncture_needle_direction"`
332 333
 }
333 334
 
334 335
 func (PredialysisEvaluation) TableName() string {
@@ -1623,3 +1624,16 @@ type NoHisPrescriptionProject struct {
1623 1624
 func (NoHisPrescriptionProject) TableName() string {
1624 1625
 	return "his_prescription_project"
1625 1626
 }
1627
+
1628
+type XtDialysisOrderLost struct {
1629
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1630
+	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date" form:"dialysis_date"`
1631
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1632
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1633
+	Count        int64
1634
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1635
+}
1636
+
1637
+func (XtDialysisOrderLost) TableName() string {
1638
+	return "xt_dialysis_order"
1639
+}

+ 1 - 0
models/dialysis_parameter_models.go Ver arquivo

@@ -136,6 +136,7 @@ type DialysisPrescriptionParameter struct {
136 136
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
137 137
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
138 138
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
139
+	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
139 140
 }
140 141
 
141 142
 func (DialysisPrescriptionParameter) TableName() string {

+ 5 - 0
models/drug.go Ver arquivo

@@ -115,6 +115,11 @@ type BaseDrugLibEleven struct {
115 115
 	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
116 116
 	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
117 117
 	ManufacturerName string `gorm:"column:manufacturer_name" json:"manufacturer_name"`
118
+	MaxUnit          string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
119
+	MinNumber        int64  `gorm:"column:min_number" json:"min_number" form:"min_number"`
120
+	MinUnit          string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
121
+	Dose             string `gorm:"column:dose" json:"dose" form:"dose"`
122
+	DoseUnit         string `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
118 123
 }
119 124
 
120 125
 func (BaseDrugLibEleven) TableName() string {

+ 1 - 0
models/new_monitor.go Ver arquivo

@@ -34,6 +34,7 @@ type VMMonitorPatients struct {
34 34
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
35 35
 	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
36 36
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
37
+	TotalDialysis      int64  `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
37 38
 }
38 39
 
39 40
 func (VMMonitorPatients) TableName() string {

+ 27 - 11
models/patient_models.go Ver arquivo

@@ -380,6 +380,7 @@ type DialysisPrescription struct {
380 380
 	WarshCount                 string        `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
381 381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
382 382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
383
+	AnticoagulantWeichiHour    string        `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
383 384
 }
384 385
 
385 386
 func (DialysisPrescription) TableName() string {
@@ -487,6 +488,7 @@ type DialysisPrescriptionList struct {
487 488
 	MaxUltrafiltrationRate     string  `gorm:"column:max_ultrafiltration_rate" json:"max_ultrafiltration_rate" form:"max_ultrafiltration_rate"`
488 489
 	WaterMachine               string  `gorm:"column:water_machine" json:"water_machine" form:"water_machine"`
489 490
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
491
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
490 492
 }
491 493
 
492 494
 func (DialysisPrescriptionList) TableName() string {
@@ -617,6 +619,7 @@ type DialysisSolution struct {
617 619
 	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
618 620
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
619 621
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
622
+	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
620 623
 }
621 624
 
622 625
 func (DialysisSolution) TableName() string {
@@ -1632,6 +1635,7 @@ type VmDialysisSolution struct {
1632 1635
 	ModeId                     int64                 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1633 1636
 	Anticoagulant              int64                 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1634 1637
 	DialysisSolution           VmDialysisSolutionOne `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"solution"`
1638
+	SolutionStatus             int64                 `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
1635 1639
 }
1636 1640
 
1637 1641
 func (VmDialysisSolution) TableName() string {
@@ -1670,17 +1674,18 @@ func (VmDialysisPrescription) TableName() string {
1670 1674
 }
1671 1675
 
1672 1676
 type XtScheduleList struct {
1673
-	UserOrgId        int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1674
-	PartitionId      int64              `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1675
-	BedId            int64              `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1676
-	PatientId        int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1677
-	ScheduleDate     int64              `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1678
-	ScheduleType     int64              `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1679
-	ScheduleWeek     int64              `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1680
-	ModeId           int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1681
-	IsExport         int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
1682
-	DialysisSolution VmDialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1683
-	Status           int64              `gorm:"column:status" json:"status" form:"status"`
1677
+	UserOrgId            int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1678
+	PartitionId          int64                `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1679
+	BedId                int64                `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1680
+	PatientId            int64                `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1681
+	ScheduleDate         int64                `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1682
+	ScheduleType         int64                `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1683
+	ScheduleWeek         int64                `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1684
+	ModeId               int64                `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1685
+	IsExport             int64                `gorm:"column:is_export" json:"is_export" form:"is_export"`
1686
+	DialysisSolution     VmDialysisSolution   `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1687
+	DialysisPrescription DialysisPrescription `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"prescription"`
1688
+	Status               int64                `gorm:"column:status" json:"status" form:"status"`
1684 1689
 }
1685 1690
 
1686 1691
 func (XtScheduleList) TableName() string {
@@ -2358,3 +2363,14 @@ type XtDeviceValusalMapVrr struct {
2358 2363
 func (XtDeviceValusalMapVrr) TableName() string {
2359 2364
 	return "xt_device_valusal_map_vrr"
2360 2365
 }
2366
+
2367
+type PatientsTwenty struct {
2368
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2369
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2370
+	Name      string `gorm:"column:name" json:"name" form:"name"`
2371
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2372
+}
2373
+
2374
+func (PatientsTwenty) TableName() string {
2375
+	return "xt_patients"
2376
+}

+ 41 - 0
models/role_models.go Ver arquivo

@@ -153,3 +153,44 @@ type Roles struct {
153 153
 func (Roles) TableName() string {
154 154
 	return "sgj_user_role"
155 155
 }
156
+
157
+type XtDialysisGatherSetting struct {
158
+	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
159
+	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
160
+	IndexNumber        int64 `gorm:"column:index_number" json:"index_number" form:"index_number"`
161
+	Zone               int64 `gorm:"column:zone" json:"zone" form:"zone"`
162
+	Number             int64 `gorm:"column:number" json:"number" form:"number"`
163
+	Birth              int64 `gorm:"column:birth" json:"birth" form:"birth"`
164
+	Name               int64 `gorm:"column:name" json:"name" form:"name"`
165
+	Age                int64 `gorm:"column:age" json:"age" form:"age"`
166
+	ModeType           int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
167
+	PrescriptionStatus int64 `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
168
+	AdmissionNumber    int64 `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
169
+	DialysisNo         int64 `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
170
+	DryWeight          int64 `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
171
+	DialysisDialyszers int64 `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
172
+	DialysisStrainer   int64 `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
173
+	DialysisIrrigation int64 `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
174
+	Calcium            int64 `gorm:"column:calcium" json:"calcium" form:"calcium"`
175
+	Kalium             int64 `gorm:"column:kalium" json:"kalium" form:"kalium"`
176
+	ChangeNurse        int64 `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
177
+	PunctureNeedle     int64 `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
178
+	Anticoagulant      int64 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
179
+	Tube               int64 `gorm:"column:tube" json:"tube" form:"tube"`
180
+	Cuhong             int64 `gorm:"column:cuhong" json:"cuhong" form:"cuhong"`
181
+	Zuoka              int64 `gorm:"column:zuoka" json:"zuoka" form:"zuoka"`
182
+	Zhetangtie         int64 `gorm:"column:zhetangtie" json:"zhetangtie" form:"zhetangtie"`
183
+	Paligu             int64 `gorm:"column:paligu" json:"paligu" form:"paligu"`
184
+	Guhuachun          int64 `gorm:"column:guhuachun" json:"guhuachun" form:"guhuachun"`
185
+	Niaojimei          int64 `gorm:"column:niaojimei" json:"niaojimei" form:"niaojimei"`
186
+	Putaosuangai       int64 `gorm:"column:putaosuangai" json:"putaosuangai" form:"putaosuangai"`
187
+	Jiaguan            int64 `gorm:"column:jiaguan" json:"jiaguan" form:"jiaguan"`
188
+	Xiongxiewutai      int64 `gorm:"column:xiongxiewutai" json:"xiongxiewutai" form:"xiongxiewutai"`
189
+	Ctime              int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
190
+	Mtime              int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
191
+	Status             int64 `gorm:"column:status" json:"status" form:"status"`
192
+}
193
+
194
+func (XtDialysisGatherSetting) TableName() string {
195
+	return "xt_dialysis_gather_setting"
196
+}

+ 2 - 0
models/schedule_models.go Ver arquivo

@@ -392,6 +392,7 @@ type VmBloodSchedule struct {
392 392
 	ReceiveTreatmentAsses      ReceiveTreatmentAsses      `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_receive_treatment_asses"`
393 393
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
394 394
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
395
+	DialysisMachineName        string                     `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
395 396
 }
396 397
 
397 398
 func (VmBloodSchedule) TableName() string {
@@ -423,6 +424,7 @@ type NewMSchedualPatientVMList struct {
423 424
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
424 425
 	TrobleShoot        int64  `gorm:"column:troble_shoot" json:"troble_shoot" form:"troble_shoot"`
425 426
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
427
+	AdmissionNumber    string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
426 428
 }
427 429
 
428 430
 func (NewMSchedualPatientVMList) TableName() string {

+ 3 - 0
models/user_models.go Ver arquivo

@@ -351,6 +351,9 @@ type XtDialysisSolution struct {
351 351
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
352 352
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
353 353
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
354
+	SolutionStatus             int64   `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
355
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
356
+	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
354 357
 }
355 358
 
356 359
 func (XtDialysisSolution) TableName() string {

+ 7 - 0
service/dialysis_parameter_service.go Ver arquivo

@@ -452,3 +452,10 @@ func PCGetDialysisGoodsThree(orgID int64, scheduleDate int64) ([]*MDialysisGoods
452 452
 
453 453
 	return vms, err
454 454
 }
455
+
456
+func GetLastDialysisPrescriptionTwenty(patientid int64, record_date int64, orgid int64) (models.XtDialysisPrescription, error) {
457
+
458
+	prescription := models.XtDialysisPrescription{}
459
+	err = XTReadDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date =? and status = 1", record_date, patientid, orgid).Last(&prescription).Error
460
+	return prescription, err
461
+}

+ 6 - 0
service/dialysis_service.go Ver arquivo

@@ -222,6 +222,12 @@ func AddSigleRecord(prescription *models.DialysisPrescription) (err error) {
222 222
 	return errors
223 223
 }
224 224
 
225
+func UpdateAddSigleRecord(id int64, target_ultrafiltration float64) error {
226
+
227
+	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"target_ultrafiltration": target_ultrafiltration}).Error
228
+	return err
229
+}
230
+
225 231
 func AddSigleSummaryRecord(summary *models.TreatmentSummary) (err error) {
226 232
 	tx := writeDb.Begin()
227 233
 	errors := tx.Model(&models.TreatmentSummary{}).Create(&summary).Error

+ 62 - 0
service/dialysis_solution_service.go Ver arquivo

@@ -120,6 +120,12 @@ func GetAllLongAdviceList(user_org_id int64) (advice []*models.DoctorAdvice, err
120 120
 	return advice, err
121 121
 }
122 122
 
123
+func GetHisLongAdviceList(user_org_id int64) (advice []*models.HisDoctorAdviceTemplate, err error) {
124
+
125
+	err = XTReadDB().Where("org_id = ? and status=1", user_org_id).Find(&advice).Error
126
+	return advice, err
127
+}
128
+
123 129
 func GetAllHisAdviceTemplateList(user_org_id int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
124 130
 
125 131
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&advice).Error
@@ -586,3 +592,59 @@ func GetLongDialysisAdviceToday(orgID int64, schedule_type int64, partition_id [
586 592
 	return schedule, err
587 593
 
588 594
 }
595
+
596
+func GetDialysisGatherList(keywords string, limit int64, page int64, partition_id []string, schedule_type int64, scheduleDate int64, orgID int64, ids []string) (schedule []*models.VmBloodSchedule, total int64, err error) {
597
+	db := XTReadDB().Model(&models.VmBloodSchedule{}).Where("xt_schedule.status = 1")
598
+	offset := (page - 1) * limit
599
+	if scheduleDate > 0 {
600
+		db = db.Where("xt_schedule.schedule_date = ?", scheduleDate)
601
+	}
602
+	if schedule_type > 0 {
603
+		db = db.Where("xt_schedule.schedule_type = ?", schedule_type)
604
+	}
605
+	//if partition_id > 0 {
606
+	//	db = db.Where("xt_schedule.partition_id = ?", partition_id)
607
+	//}
608
+	if len(partition_id) > 0 {
609
+		db = db.Where("xt_schedule.partition_id in(?)", partition_id)
610
+	}
611
+	if orgID > 0 {
612
+		db = db.Where("xt_schedule.user_org_id  = ?", orgID)
613
+	}
614
+	if len(ids) >= 1 {
615
+		db = db.Where("xt_schedule.id in(?)", ids)
616
+	}
617
+
618
+	if len(keywords) > 0 {
619
+		keywords = "%" + keywords + "%"
620
+		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)
621
+		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
622
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
623
+			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).
624
+			Preload("DialysisPrescription", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
625
+			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
626
+			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
627
+			Preload("XtAssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
628
+			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
629
+				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
630
+			}).
631
+			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
632
+			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
633
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
634
+	} else {
635
+		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
636
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
637
+			Preload("DialysisSolution", "status = 1 AND user_org_id = ? and solution_status = 1", orgID).
638
+			Preload("DialysisPrescription", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
639
+			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
640
+			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
641
+			Preload("XtAssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
642
+			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
643
+			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
644
+			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
645
+				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
646
+			}).Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
647
+	}
648
+
649
+	return schedule, total, err
650
+}

+ 38 - 3
service/gobal_config_service.go Ver arquivo

@@ -510,7 +510,7 @@ func FindPrintStockGoodInfoByType(types int, startTime int64, end_time int64, or
510 510
 	return
511 511
 }
512 512
 
513
-func GetMobileScheduleListOne(start_time int64, end_time int64, org_id int64) (schedulelist []*models.XtScheduleList, err error) {
513
+func GetMobileScheduleListOne(start_time int64, end_time int64, org_id int64, schedule_type int64, partion_id int64) (schedulelist []*models.XtScheduleList, err error) {
514 514
 
515 515
 	db := XTReadDB().Model(&schedulelist).Where("status =1 and user_org_id =?", org_id)
516 516
 	if start_time > 0 {
@@ -519,7 +519,13 @@ func GetMobileScheduleListOne(start_time int64, end_time int64, org_id int64) (s
519 519
 	if end_time > 0 {
520 520
 		db = db.Where("schedule_date<=?", end_time)
521 521
 	}
522
-	err = db.Preload("DialysisSolution", "status=1 and user_org_id =?", org_id).Find(&schedulelist).Error
522
+	if schedule_type > 0 {
523
+		db = db.Where("schedule_type =?", schedule_type)
524
+	}
525
+	if partion_id > 0 {
526
+		db = db.Where("partition_id = ?", partion_id)
527
+	}
528
+	err = db.Preload("DialysisSolution", "status=1 and user_org_id =? and solution_status =1", org_id).Preload("DialysisPrescription", "status=1 and user_org_id =?", org_id).Find(&schedulelist).Error
523 529
 
524 530
 	return schedulelist, err
525 531
 
@@ -629,7 +635,7 @@ func GetAllBaseDrugListTwo(orgid int64) (drug []*models.BaseDrugLibEleven, err e
629 635
 	if orgid > 0 {
630 636
 		db = db.Where("x.org_id =?", orgid)
631 637
 	}
632
-	err = db.Select("x.id,x.drug_name,p.manufacturer_name").Joins("left join xt_manufacturer as p on p.id =x.manufacturer").Scan(&drug).Error
638
+	err = db.Select("x.id,x.drug_name,p.manufacturer_name,x.dose,x.dose_unit,x.min_number,x.max_unit,x.min_unit").Joins("left join xt_manufacturer as p on p.id =x.manufacturer").Scan(&drug).Error
633 639
 	return drug, err
634 640
 }
635 641
 
@@ -1322,3 +1328,32 @@ func GetAfterLogList(patient_id int64, page int64, limit int64, record_date int6
1322 1328
 
1323 1329
 	return afterlist, total, err
1324 1330
 }
1331
+
1332
+func GetGatherSettingByOrgId(user_org_id int64) (models.XtDialysisGatherSetting, error) {
1333
+
1334
+	gatherSetting := models.XtDialysisGatherSetting{}
1335
+	err := XTReadDB().Where("user_org_id =? and status =1", user_org_id).Find(&gatherSetting).Error
1336
+	return gatherSetting, err
1337
+}
1338
+
1339
+func CreateGather(setting models.XtDialysisGatherSetting) error {
1340
+
1341
+	err := XTWriteDB().Create(&setting).Error
1342
+	return err
1343
+}
1344
+
1345
+func SaveGather(setting models.XtDialysisGatherSetting) error {
1346
+
1347
+	err := XTWriteDB().Save(&setting).Error
1348
+
1349
+	return err
1350
+}
1351
+
1352
+func GetGatherSetting(user_org_id int64) (models.XtDialysisGatherSetting, error) {
1353
+
1354
+	gatherSetting := models.XtDialysisGatherSetting{}
1355
+
1356
+	err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&gatherSetting).Error
1357
+
1358
+	return gatherSetting, err
1359
+}

+ 2 - 2
service/inspection_service.go Ver arquivo

@@ -169,7 +169,7 @@ func DeletePatientInspection(orgId, patientId, projectId, date int64) (err error
169 169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
170 170
 
171 171
 	var projectCount models.UserInspectionProjectCount
172
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Order("created_time desc").Scan(&projectCount).Error
172
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Order("inspect_date desc").Scan(&projectCount).Error
173 173
 
174 174
 	if err != nil {
175 175
 		return
@@ -181,7 +181,7 @@ func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections
181 181
 	}
182 182
 
183 183
 	var Id models.InspectionDate
184
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("inspect_date").Group("inspect_date").Order("created_time desc").Offset(page - 1).Limit(1).Scan(&Id).Error
184
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("inspect_date").Group("inspect_date").Order("inspect_date desc").Offset(page - 1).Limit(1).Scan(&Id).Error
185 185
 	if err != nil {
186 186
 		return
187 187
 	}

+ 5 - 0
service/manage_service.go Ver arquivo

@@ -915,6 +915,11 @@ func GetAllpatient(orgid int64) (patients []*models.Patients, err error) {
915 915
 	return patients, err
916 916
 }
917 917
 
918
+func GetAllpatientTwenty(orgid int64) (patients []*models.PatientsTwenty, err error) {
919
+	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
920
+	return patients, err
921
+}
922
+
918 923
 func GetAllpatientThirty(orgid int64) (patients []*models.PatientsThirty, err error) {
919 924
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
920 925
 	return patients, err

+ 5 - 2
service/mobile_dialysis_service.go Ver arquivo

@@ -2340,6 +2340,7 @@ func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int
2340 2340
 
2341 2341
 	// cur_date := time.Now().Format("2006-01-02")
2342 2342
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
2343
+
2343 2344
 	dialysis_solution_str, _ := redis.Get(key).Result()
2344 2345
 
2345 2346
 	if len(dialysis_solution_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -2809,7 +2810,7 @@ func GetDialysisOrderCountOne(orgID int64, patient_id int64, recordDate int64) (
2809 2810
 }
2810 2811
 
2811 2812
 func GetDialysisOrderCountTwo(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
2812
-	err = readDb.Model(&models.DialysisOrder{}).Where("dialysis_date>=1672502400 and  dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
2813
+	err = readDb.Model(&models.DialysisOrder{}).Where("dialysis_date>=1704038400 and  dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
2813 2814
 	return
2814 2815
 }
2815 2816
 
@@ -8112,7 +8113,7 @@ func GetDialysisTotalCountOne(org_id int64, patient_id int64) (models.BloodDialy
8112 8113
 	order := models.BloodDialysisOrderCount{}
8113 8114
 	db := XTReadDB().Table("xt_dialysis_order as o")
8114 8115
 
8115
-	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and o.patient_id = ? and o.dialysis_date>=1672502400 and  x.schedule_date = o.dialysis_date and x.status = 1 ", org_id, patient_id).Scan(&order).Error
8116
+	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and o.patient_id = ? and o.dialysis_date>=1704038400 and  x.schedule_date = o.dialysis_date and x.status = 1 ", org_id, patient_id).Scan(&order).Error
8116 8117
 
8117 8118
 	return order, err
8118 8119
 }
@@ -8167,6 +8168,7 @@ func GetHisDoctorAdvicesTwentyOne(orgID int64, scheduleDate int64, deliverWay st
8167 8168
 			db = db.Where("partition_id = ?", partitionType)
8168 8169
 		}
8169 8170
 		if patient_id > 0 {
8171
+
8170 8172
 			if execution_state > 0 {
8171 8173
 				if cost_type > 0 {
8172 8174
 					if len(execution_frequency) > 0 {
@@ -8444,6 +8446,7 @@ func GetHisDoctorAdvicesTwentyOne(orgID int64, scheduleDate int64, deliverWay st
8444 8446
 		}
8445 8447
 		if patient_id > 0 {
8446 8448
 			if execution_state > 0 {
8449
+				fmt.Println("execution_state---------------------", execution_state)
8447 8450
 				if cost_type > 0 {
8448 8451
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8449 8452
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).

+ 59 - 2
service/patient_service.go Ver arquivo

@@ -79,11 +79,11 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
79 79
 
80 80
 	}
81 81
 	if lapseto != 2 && lapseto != 3 {
82
-		if orgID != 10579 {
82
+		if orgID != 10579 && orgID != 10600 {
83 83
 			err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
84 84
 		}
85 85
 
86
-		if orgID == 10579 {
86
+		if orgID == 10579 || orgID == 10600 {
87 87
 			err = db.Order("p.dialysis_no asc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
88 88
 		}
89 89
 
@@ -1114,6 +1114,43 @@ func CreateMGroupAdvice(orgId int64, advices []*models.GroupAdvice, groupNo int6
1114 1114
 	return
1115 1115
 }
1116 1116
 
1117
+func CreateMGroupAdviceOne(orgId int64, advices []*models.GroupAdvice, groupNo int64) (list []*models.GroupAdvice, err error) {
1118
+	if groupNo <= 0 {
1119
+		group := GetMaxAdviceGroupID(orgId)
1120
+		groupNo = group + 1
1121
+	}
1122
+	tx := writeDb.Begin()
1123
+	defer func() {
1124
+		if r := recover(); r != nil {
1125
+			tx.Rollback()
1126
+		}
1127
+	}()
1128
+	for _, advice := range advices {
1129
+		advice.GroupNo = advice.GroupNo
1130
+		if err = tx.Create(advice).Error; err != nil {
1131
+			tx.Rollback()
1132
+			return
1133
+		}
1134
+		list = append(list, advice)
1135
+		if len(advice.Children) > 0 {
1136
+			for _, child := range advice.Children {
1137
+
1138
+				child.GroupNo = advice.GroupNo
1139
+				child.ParentId = advice.ID
1140
+				fmt.Println(child)
1141
+				if err = tx.Create(&child).Error; err != nil {
1142
+					tx.Rollback()
1143
+					return
1144
+				}
1145
+				list = append(list, child)
1146
+			}
1147
+		}
1148
+
1149
+	}
1150
+	tx.Commit()
1151
+	return
1152
+}
1153
+
1117 1154
 func UpdateDoctorAdvice(m *models.DoctorAdvice) (err error) {
1118 1155
 	return writeDb.Save(m).Error
1119 1156
 }
@@ -1194,6 +1231,14 @@ func DeleteGroupAdvice(orgId int64, groupNo int64, admin_user_id int64) (err err
1194 1231
 	return
1195 1232
 }
1196 1233
 
1234
+func DeleteGroupAdviceOne(orgId int64, groupNo int64, admin_user_id int64) (err error) {
1235
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? and groupno = ? and status =1 and advice_type=1", orgId, groupNo).Update(map[string]interface{}{"UpdatedTime": time.Now().Unix(), "Status": 0, "Modifier": admin_user_id}).Error
1236
+	if err != nil {
1237
+		return
1238
+	}
1239
+	return
1240
+}
1241
+
1197 1242
 func FindDoctorAdvice(orgID, id int64) (advice models.DoctorAdvice, err error) {
1198 1243
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? and user_org_id=? and status = 1", id, orgID).First(&advice).Error
1199 1244
 	return
@@ -3340,3 +3385,15 @@ func GetPatientScheudleListTwenty(org_id int64, scheduel_type int64, startime in
3340 3385
 	fmt.Println("err2330230320202023", err)
3341 3386
 	return schedule, err
3342 3387
 }
3388
+
3389
+func GetDialysisOrderCountTwentyEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
3390
+	order := models.VmDialysisOrder{}
3391
+	err := XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
3392
+	return order, err
3393
+}
3394
+
3395
+func GetDialysisOrderCountTenEight(patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
3396
+	order := models.VmDialysisOrder{}
3397
+	err := XTReadDB().Where("patient_id = ? and dialysis_date = ? and status = 1", patient_id, recordDate).Last(&order).Error
3398
+	return order, err
3399
+}

+ 1 - 1
service/patientmanage_service.go Ver arquivo

@@ -640,7 +640,7 @@ func GetDryWeightDetail(id int64) (models.SgjPatientDryweights, error) {
640 640
 }
641 641
 
642 642
 func GetlongDialysisrecord(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (prescription []*models.XtDialysisSolution, total int64, err error) {
643
-	db := XTReadDB().Table("xt_dialysis_solution as x").Where("x.status = 1")
643
+	db := XTReadDB().Table("xt_dialysis_solution as x").Where("x.status = 1 and x.solution_status=1")
644 644
 	if patientid > 0 {
645 645
 		db = db.Where("x.patient_id = ?", patientid)
646 646
 	}

+ 138 - 0
service/pharmacy_service.go Ver arquivo

@@ -678,6 +678,7 @@ func DispensingMedicine(orgid, patient_id, stime, etime, creater int64) (err err
678 678
 
679 679
 	if orgid != 10480 {
680 680
 		for _, v := range advice_info {
681
+
681 682
 			tmp_bool := IsPharmacyConfig(orgid)
682 683
 			if tmp_bool {
683 684
 				if PettyCash(v.DrugId) {
@@ -779,6 +780,143 @@ func DispensingMedicine(orgid, patient_id, stime, etime, creater int64) (err err
779 780
 	return
780 781
 }
781 782
 
783
+func DispensingMedicineOne(orgid, patient_id, stime, etime, creater int64) (err error) {
784
+
785
+	//开事务
786
+	tx := XTWriteDB().Begin()
787
+	defer func() {
788
+		if err != nil {
789
+			utils.ErrorLog("事务失败,原因为: %v", err)
790
+			tx.Rollback()
791
+		} else {
792
+			tx.Commit()
793
+		}
794
+	}()
795
+
796
+	//查询当前患者未发药的列表
797
+	adviceList, err := GetHisPatientNoMedical(orgid, patient_id, stime, etime)
798
+	//发药
799
+	if len(adviceList) > 0 {
800
+		for _, item := range adviceList {
801
+			//扣减库存
802
+			err = HisDrugsDelivery(orgid, creater, item)
803
+			if err != nil {
804
+				err = fmt.Errorf("!:%v", err)
805
+				return
806
+			}
807
+			//修改发药状态
808
+			err = UpdateIsMedicalHisAdvice(item.ID)
809
+			if err != nil {
810
+				err = fmt.Errorf("!:%v", err)
811
+				return
812
+			}
813
+			err = UpdateHisPrescription(item.PrescriptionId)
814
+			if err != nil {
815
+				err = fmt.Errorf("!:%v", err)
816
+				return
817
+			}
818
+
819
+			//查询默认仓库
820
+			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
821
+			//查询默认仓库剩余多少库存
822
+			var sum_count int64
823
+			stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, item.DrugId)
824
+			for _, its := range stockInfo {
825
+				baseDrug, _ := GetBaseDrugMedical(its.DrugId)
826
+				if its.MaxUnit == baseDrug.MaxUnit {
827
+					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
828
+				}
829
+				sum_count += its.StockMaxNumber + its.StockMinNumber
830
+			}
831
+			UpdateBaseDrugSumTwo(item.DrugId, sum_count, orgid)
832
+			//扣减库存
833
+			UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
834
+
835
+			over, _ := FindOverCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut)
836
+			UpdateActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount)
837
+		}
838
+	}
839
+
840
+	advice, err := GetDocAdviceList(orgid, patient_id, stime, etime)
841
+
842
+	if len(advice) > 0 {
843
+		for _, item := range advice {
844
+			err = DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
845
+			//查询默认仓库
846
+			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
847
+			//查询默认仓库剩余多少库存
848
+			var sum_count int64
849
+			stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, item.DrugId)
850
+			for _, its := range stockInfo {
851
+				baseDrug, _ := GetBaseDrugMedical(its.DrugId)
852
+				if its.MaxUnit == baseDrug.MaxUnit {
853
+					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
854
+				}
855
+				sum_count += its.StockMaxNumber + its.StockMinNumber
856
+			}
857
+			UpdateBaseDrugSumTwo(item.DrugId, sum_count, orgid)
858
+			//扣减库存
859
+			UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
860
+
861
+			over, _ := FindOverCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut)
862
+			UpdateActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount)
863
+			if err != nil {
864
+				err = fmt.Errorf("!:%v", err)
865
+				return
866
+			}
867
+			err = UpdateIsAdvice(item.ID)
868
+			if err != nil {
869
+				err = fmt.Errorf("!:%v", err)
870
+				return
871
+			}
872
+		}
873
+	}
874
+
875
+	//生成明细记录
876
+	tmp_ph := models.Pharmary{
877
+		UserOrgId:  orgid,
878
+		PatientId:  patient_id,
879
+		Ctime:      time.Now().Unix(),
880
+		Mtime:      time.Now().Unix(),
881
+		Status:     1,
882
+		RecordDate: time.Now().Unix(),
883
+	}
884
+	err = tx.Create(&tmp_ph).Error
885
+
886
+	return
887
+}
888
+
889
+func GetHisPatientNoMedical(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.HisDoctorAdviceInfo, err error) {
890
+
891
+	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0", user_org_id, patient_id, startime, end_time).Find(&advice).Error
892
+	return advice, err
893
+}
894
+
895
+func UpdateIsMedicalHisAdvice(id int64) (err error) {
896
+	adviceInfo := models.HisDoctorAdviceInfo{}
897
+	err = XTWriteDB().Model(&adviceInfo).Where("id =? and status =1", id).Update(map[string]interface{}{"is_medicine": 1, "dispensing_time": time.Now().Unix()}).Error
898
+	return err
899
+}
900
+func UpdateHisPrescription(id int64) (err error) {
901
+
902
+	prescriptionInfo := models.HisPrescription{}
903
+	err = XTWriteDB().Model(&prescriptionInfo).Where("id = ? and status=1", id).Update(map[string]interface{}{"is_medicine": 1, "mtime": time.Now().Unix()}).Error
904
+	return err
905
+}
906
+
907
+func GetDocAdviceList(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.DoctorAdvice, err error) {
908
+
909
+	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0", user_org_id, patient_id, startime, end_time).Find(&advice).Error
910
+	return advice, err
911
+
912
+}
913
+
914
+func UpdateIsAdvice(id int64) (err error) {
915
+
916
+	err = XTWriteDB().Model(&models.DoctorAdvice{}).Where("id = ? and status =1", id).Update(map[string]interface{}{"is_medicine": 1, "dispensing_time": time.Now().Unix()}).Error
917
+	return err
918
+}
919
+
782 920
 // 患者退药按钮点击
783 921
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
784 922
 	//开事务

+ 1 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Ver arquivo

@@ -308,6 +308,7 @@ type AssessmentBeforeDislysisVM struct {
308 308
 	WhetherUnobstructed            int64   `gorm:"column:whether_unobstructed" json:"whether_unobstructed" form:"whether_unobstructed"`
309 309
 	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
310 310
 	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
311
+	PunctureNeedleDirection        string  `gorm:"column:puncture_needle_direction" json:"puncture_needle_direction" form:"puncture_needle_direction"`
311 312
 }
312 313
 
313 314
 func (AssessmentBeforeDislysisVM) TableName() string {

+ 2 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Ver arquivo

@@ -229,13 +229,13 @@ func GetDialysisOrderCountTen(patient_id int64, recordDate int64) (models.VmDial
229 229
 
230 230
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
231 231
 	order := models.VmDialysisOrder{}
232
-	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1640966400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
232
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
233 233
 	return order, err
234 234
 }
235 235
 
236 236
 func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
237 237
 	order := models.VmDialysisOrder{}
238
-	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
238
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1704038400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
239 239
 	return order, err
240 240
 }
241 241
 

+ 13 - 1
service/schedule_service.go Ver arquivo

@@ -243,7 +243,7 @@ func GetNextSchedule(orgID, end, patientID int64) (schedules []*models.PatientSc
243 243
 func GetNextScheduleByList(patient_id int64, schedule_date int64, user_org_id int64) (models.SchedulePatientsOne, error) {
244 244
 
245 245
 	patientsOne := models.SchedulePatientsOne{}
246
-	err := XTReadDB().Where("patient_id = ? and schedule_date >? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).First(&patientsOne).Error
246
+	err := XTReadDB().Where("patient_id = ? and schedule_date >? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Order("schedule_date asc").First(&patientsOne).Error
247 247
 	return patientsOne, err
248 248
 }
249 249
 
@@ -1763,6 +1763,18 @@ func CreateScheduleLog(log models.XtScheduleLog) error {
1763 1763
 	return err
1764 1764
 }
1765 1765
 
1766
+func GetDoctorAdviceListTwenty(patient_id int64, schedule_date int64, user_org_id int64) (advice []*models.XtDoctorAdvice, err error) {
1767
+
1768
+	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&advice).Error
1769
+	return advice, err
1770
+}
1771
+
1772
+func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1773
+
1774
+	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
1775
+	return err
1776
+}
1777
+
1766 1778
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1767 1779
 
1768 1780
 	schedule := models.XtSchedule{}

+ 60 - 1
service/sign_service.go Ver arquivo

@@ -2099,7 +2099,7 @@ func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64,
2099 2099
 
2100 2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2101 2101
 
2102
-	err = XTReadDB().Where("status =1 and user_org_id =9990").Find(&list).Error
2102
+	err = XTReadDB().Where("status =1 and user_org_id =10567").Find(&list).Error
2103 2103
 
2104 2104
 	return list, err
2105 2105
 }
@@ -2141,3 +2141,62 @@ func UpdateDialysisSchedule(id int64, dialysis_machine_name string) error {
2141 2141
 	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
2142 2142
 	return err
2143 2143
 }
2144
+
2145
+func GetPrescriptionListOne(user_org_id int64) (prescription []*models.DialysisPrescription, err error) {
2146
+
2147
+	err = XTReadDB().Model(&prescription).Where("user_org_id = ? and status= 1 and record_date =? and status=1", 10579, 1701360000).Find(&prescription).Error
2148
+	return prescription, err
2149
+}
2150
+
2151
+func GetPatientScheduleById(patient_id int64, schedule_date int64) (models.XtSchedule, error) {
2152
+
2153
+	schedule := models.XtSchedule{}
2154
+
2155
+	err := XTReadDB().Where("patient_id= ? and schedule_date = ? and status =1 and user_org_id =10579", patient_id, schedule_date).First(&schedule).Error
2156
+
2157
+	return schedule, err
2158
+}
2159
+
2160
+func UpdateDialysisScheduleOne(id int64, mode_id int64, dialysis_machine_name string) error {
2161
+
2162
+	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name, "mode_id": mode_id}).Error
2163
+	return err
2164
+}
2165
+
2166
+func GetDialysisOrderTotalCount() (order []*models.XtDialysisOrderLost, err error) {
2167
+
2168
+	err = XTReadDB().Select("patient_id,Count(id) as count").Where("user_org_id = ? and status =1", 10265).Group("patient_id").Find(&order).Error
2169
+
2170
+	return order, err
2171
+}
2172
+
2173
+func ModifyPatient(patient_id int64, count int64) (models.XtPatients, error) {
2174
+
2175
+	patients := models.XtPatients{}
2176
+	err := XTReadDB().Model(&models.XtPatients{}).Where("id = ? and status =1", patient_id).Updates(map[string]interface{}{"total_dialysis": count}).Error
2177
+	return patients, err
2178
+}
2179
+
2180
+func UpdateDrugWarehouseInfoByDrug(drug_id int64, reatial_price float64, user_org_id int64) (models.DrugWarehouseInfo, error) {
2181
+
2182
+	drugWarehouseInfo := models.DrugWarehouseInfo{}
2183
+
2184
+	err := XTWriteDB().Model(&drugWarehouseInfo).Where("drug_id = ? and org_id =?", drug_id, user_org_id).Updates(map[string]interface{}{"retail_price": reatial_price}).Error
2185
+
2186
+	return drugWarehouseInfo, err
2187
+}
2188
+
2189
+func UpdasteGoodWarehouseInfoByGood(good_id int64, packing_price float64, org_id int64) (models.WarehousingInfo, error) {
2190
+
2191
+	info := models.WarehousingInfo{}
2192
+	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("good_id=? and org_id = ? and status =1", good_id, org_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
2193
+	return info, err
2194
+}
2195
+
2196
+func UpdateHisDoctorAdviceOne(drug_id int64, retail_price float64, user_org_id int64) (models.HisDoctorAdvice, error) {
2197
+
2198
+	advice := models.HisDoctorAdvice{}
2199
+
2200
+	err := XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("drug_id = ? and user_org_id = ?  and status=1", drug_id, user_org_id).Updates(map[string]interface{}{"price": retail_price}).Error
2201
+	return advice, err
2202
+}

+ 1 - 0
service/stock_service.go Ver arquivo

@@ -1770,6 +1770,7 @@ type DrugWarehouseOutInfo struct {
1770 1770
 	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1771 1771
 	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1772 1772
 	StockCount              string  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1773
+	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1773 1774
 }
1774 1775
 
1775 1776
 func (DrugWarehouseOutInfo) TableName() string {

+ 2 - 0
service/warhouse_service.go Ver arquivo

@@ -6011,6 +6011,7 @@ func AutoDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, warehous
6011 6011
 			RetailPrice:             drug_price, //手动出库出库价格
6012 6012
 			WarehousingId:           warehouse.ID,
6013 6013
 			SystemTime:              advice.SysRecordTime,
6014
+			PatientId:               advice.PatientId,
6014 6015
 		}
6015 6016
 		if warehouse.RetailPrice == 0 {
6016 6017
 			drugflow.Price = advice.Price
@@ -6080,6 +6081,7 @@ func AutoDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, warehous
6080 6081
 			WarehousingId:           warehouse.ID,
6081 6082
 			WarehousingDetailId:     warehouse.ID,
6082 6083
 			SystemTime:              advice.SysRecordTime,
6084
+			PatientId:               advice.PatientId,
6083 6085
 		}
6084 6086
 
6085 6087
 		CreateDrugFlowOne(drugflow)