Browse Source

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

陈少旭 1 year ago
parent
commit
59547725f0
40 changed files with 1032 additions and 185 deletions
  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 View File

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

+ 156 - 8
controllers/dialysis_api_controller.go View File

135
 	beego.Router("/api/patient/getmonitorloglist", &DialysisApiController{}, "Get:GetMonitorLogList")
135
 	beego.Router("/api/patient/getmonitorloglist", &DialysisApiController{}, "Get:GetMonitorLogList")
136
 
136
 
137
 	beego.Router("/api/patient/getafterloglist", &DialysisApiController{}, "Get:GetAfterLogList")
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
 func (c *DialysisApiController) GetQueueCall() {
146
 func (c *DialysisApiController) GetQueueCall() {
363
 	washing_time := c.GetString("washing_time")
369
 	washing_time := c.GetString("washing_time")
364
 	warsh_count := c.GetString("warsh_count")
370
 	warsh_count := c.GetString("warsh_count")
365
 	blood_access_part_id := c.GetString("blood_access_part_id")
371
 	blood_access_part_id := c.GetString("blood_access_part_id")
372
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
366
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
373
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
367
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
374
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
368
 
375
 
484
 		WarshCount:                 warsh_count,
491
 		WarshCount:                 warsh_count,
485
 		WashingTime:                washing_time,
492
 		WashingTime:                washing_time,
486
 		BloodAccessPartId:          blood_access_part_id,
493
 		BloodAccessPartId:          blood_access_part_id,
494
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
487
 	}
495
 	}
488
 
496
 
489
 	//长沙南雅医院,自动生成抗凝剂的临时处方
497
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1012
 	warsh_count := c.GetString("warsh_count")
1020
 	warsh_count := c.GetString("warsh_count")
1013
 	washing_time := c.GetString("washing_time")
1021
 	washing_time := c.GetString("washing_time")
1014
 	blood_access_part_id := c.GetString("blood_access_part_id")
1022
 	blood_access_part_id := c.GetString("blood_access_part_id")
1023
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1015
 	var prescription_doctor int64
1024
 	var prescription_doctor int64
1016
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1025
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1017
 
1026
 
1183
 		WarshCount:                 warsh_count,
1192
 		WarshCount:                 warsh_count,
1184
 		WashingTime:                washing_time,
1193
 		WashingTime:                washing_time,
1185
 		BloodAccessPartId:          blood_access_part_id,
1194
 		BloodAccessPartId:          blood_access_part_id,
1195
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1186
 	}
1196
 	}
1187
 
1197
 
1188
 	if prescription.Anticoagulant == 0 {
1198
 	if prescription.Anticoagulant == 0 {
1392
 		WarshCount:                 warsh_count,
1402
 		WarshCount:                 warsh_count,
1393
 		WashingTime:                washing_time,
1403
 		WashingTime:                washing_time,
1394
 		BloodAccessPartId:          blood_access_part_id,
1404
 		BloodAccessPartId:          blood_access_part_id,
1405
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1395
 	}
1406
 	}
1396
 
1407
 
1397
 	if solution.Anticoagulant == 0 {
1408
 	if solution.Anticoagulant == 0 {
2383
 
2394
 
2384
 	washing_time := c.GetString("washing_time")
2395
 	washing_time := c.GetString("washing_time")
2385
 
2396
 
2397
+	puncture_needle_direction := c.GetString("puncture_needle_direction")
2398
+
2386
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
2399
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
2387
 		DialysisCount:                  dialysis_count,
2400
 		DialysisCount:                  dialysis_count,
2388
 		EmergencyTreatment:             emergency_treatment,
2401
 		EmergencyTreatment:             emergency_treatment,
2465
 		BeforSymptoms:                  befor_symptoms,
2478
 		BeforSymptoms:                  befor_symptoms,
2466
 		WarshCount:                     warsh_count,
2479
 		WarshCount:                     warsh_count,
2467
 		WashingTime:                    washing_time,
2480
 		WashingTime:                    washing_time,
2481
+		PunctureNeedleDirection:        puncture_needle_direction,
2468
 	}
2482
 	}
2469
 
2483
 
2470
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2484
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
4392
 	}
4406
 	}
4393
 	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
4407
 	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
4394
 
4408
 
4395
-		if xttime <= 1672416000 {
4409
+		if xttime <= 1703952000 {
4396
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4410
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4397
 			patientInfo.TotalDialysis = dialysis_count
4411
 			patientInfo.TotalDialysis = dialysis_count
4398
 		}
4412
 		}
4399
 
4413
 
4400
-		if xttime >= 1672502400 {
4414
+		if xttime >= 1704038400 {
4401
 			dialysis_count, _ := service.GetDialysisOrderCountTwo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4415
 			dialysis_count, _ := service.GetDialysisOrderCountTwo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4402
 			patientInfo.TotalDialysis = dialysis_count
4416
 			patientInfo.TotalDialysis = dialysis_count
4403
 		}
4417
 		}
5900
 	//获取长期医嘱
5914
 	//获取长期医嘱
5901
 	adviceList, _ := service.GetAllLongAdviceList(orgId)
5915
 	adviceList, _ := service.GetAllLongAdviceList(orgId)
5902
 
5916
 
5917
+	longHisAdviceList, _ := service.GetHisLongAdviceList(orgId)
5918
+
5903
 	_, config := service.FindXTHisRecordByOrgId(orgId)
5919
 	_, config := service.FindXTHisRecordByOrgId(orgId)
5904
 
5920
 
5905
 	drugList, _ := service.GetAllBaseDrugListTwenty(orgId)
5921
 	drugList, _ := service.GetAllBaseDrugListTwenty(orgId)
5906
 	if err == nil {
5922
 	if err == nil {
5907
 		this.ServeSuccessJSON(map[string]interface{}{
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
 		return
5932
 		return
5916
 
5933
 
7463
 		return
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 View File

77
 	redis := service.RedisClient()
77
 	redis := service.RedisClient()
78
 	defer redis.Close()
78
 	defer redis.Close()
79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
80
+
80
 	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81
 	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81
 	scheduals_json_str, _ := redis.Get(key).Result()
82
 	scheduals_json_str, _ := redis.Get(key).Result()
82
 
83
 

+ 1 - 0
controllers/doctors_api_controller.go View File

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

+ 7 - 0
controllers/drug_stock_api_contorller.go View File

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

+ 16 - 22
controllers/mobile_api_controllers/check_weight_api_controller.go View File

283
 
283
 
284
 	schedual, _ := service.MobileGetSchedualDetail(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix())
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
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
286
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
304
 
287
 
305
 	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 {
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
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
386
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
404
 			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
387
 			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
405
 			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
388
 			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
389
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
406
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
390
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
407
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
391
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
408
 
392
 
444
 				newprescribe.Remark = lastDialysisPrescription.Remark
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
 			byterequest, _ := json.Marshal(newprescribe)
447
 			byterequest, _ := json.Marshal(newprescribe)
473
 			keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
469
 			keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
474
 			redis.Set(keyThree, "", time.Second)
470
 			redis.Set(keyThree, "", time.Second)
475
 			defer redis.Close()
471
 			defer redis.Close()
476
-			if err != nil {
477
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
478
-			}
479
 		}
472
 		}
480
 
473
 
481
 		if dialysisPrescribe == nil && dialysisSolution == nil {
474
 		if dialysisPrescribe == nil && dialysisSolution == nil {
520
 				newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
513
 				newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
521
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
514
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
522
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
515
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
516
+				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
523
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
517
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
524
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
518
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
525
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
519
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId

+ 137 - 46
controllers/mobile_api_controllers/dialysis_api_controller.go View File

1815
 	washing_time := c.GetString("washing_time")
1815
 	washing_time := c.GetString("washing_time")
1816
 	warsh_count := c.GetString("warsh_count")
1816
 	warsh_count := c.GetString("warsh_count")
1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1818
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1818
 
1819
 
1819
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820
 
1821
 
1979
 		WashingTime:                washing_time,
1980
 		WashingTime:                washing_time,
1980
 		WarshCount:                 warsh_count,
1981
 		WarshCount:                 warsh_count,
1981
 		BloodAccessPartId:          blood_access_part_id,
1982
 		BloodAccessPartId:          blood_access_part_id,
1983
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1982
 	}
1984
 	}
1983
 
1985
 
1984
 	//查询最近透析准备表里是否存在 透析器 灌流器
1986
 	//查询最近透析准备表里是否存在 透析器 灌流器
3352
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3354
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3353
 
3355
 
3354
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
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
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
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
 			if adminUserInfo.Org.Id == 10121 {
3366
 			if adminUserInfo.Org.Id == 10121 {
3361
 				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
3367
 				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
3706
 	washing_time := c.GetString("washing_time")
3712
 	washing_time := c.GetString("washing_time")
3707
 	warsh_count := c.GetString("warsh_count")
3713
 	warsh_count := c.GetString("warsh_count")
3708
 	blood_access_part_id := c.GetString("blood_access_part_id")
3714
 	blood_access_part_id := c.GetString("blood_access_part_id")
3715
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
3709
 	if mode_id > 0 {
3716
 	if mode_id > 0 {
3710
 
3717
 
3711
 		var str string
3718
 		var str string
3867
 		WashingTime:                washing_time,
3874
 		WashingTime:                washing_time,
3868
 		WarshCount:                 warsh_count,
3875
 		WarshCount:                 warsh_count,
3869
 		BloodAccessPartId:          blood_access_part_id,
3876
 		BloodAccessPartId:          blood_access_part_id,
3877
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3870
 	}
3878
 	}
3871
 
3879
 
3872
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3880
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3994
 		WashingTime:                washing_time,
4002
 		WashingTime:                washing_time,
3995
 		WarshCount:                 warsh_count,
4003
 		WarshCount:                 warsh_count,
3996
 		BloodAccessPartId:          blood_access_part_id,
4004
 		BloodAccessPartId:          blood_access_part_id,
4005
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3997
 	}
4006
 	}
3998
 
4007
 
3999
 	//针对河间咸的
4008
 	//针对河间咸的
4359
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4368
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4360
 
4369
 
4361
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
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
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4372
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4364
 				record.UltrafiltrationRate = ultrafiltration_rate
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
 			if adminInfo.Org.Id == 10510 {
4382
 			if adminInfo.Org.Id == 10510 {
4369
 				record.UltrafiltrationRate = 0
4383
 				record.UltrafiltrationRate = 0
4370
 			}
4384
 			}
4435
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
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
 			//if template.TemplateId == 47 {
4455
 			//if template.TemplateId == 47 {
4439
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
4456
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
4440
 			//	record.UltrafiltrationRate = ultrafiltration_rate
4457
 			//	record.UltrafiltrationRate = ultrafiltration_rate
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
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
4473
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
4457
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4474
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4458
 			record.UltrafiltrationVolume = ultrafiltration_volume
4475
 			record.UltrafiltrationVolume = ultrafiltration_volume
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
 	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 {
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
 	if adminInfo.Org.Id == 10510 {
4524
 	if adminInfo.Org.Id == 10510 {
4503
 		record.UltrafiltrationVolume = 0
4525
 		record.UltrafiltrationVolume = 0
4504
 	}
4526
 	}
4527
+	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
4505
 
4528
 
4506
 	this.ServeSuccessJSON(map[string]interface{}{
4529
 	this.ServeSuccessJSON(map[string]interface{}{
4507
-		"monitor": record,
4530
+		"monitor":               record,
4531
+		"lastMonitorRecordList": lastMonitorRecordList,
4508
 	})
4532
 	})
4509
 
4533
 
4510
 }
4534
 }
5260
 	for _, adviceNameMap := range adviceNames {
5284
 	for _, adviceNameMap := range adviceNames {
5261
 		adviceNameM := adviceNameMap.(map[string]interface{})
5285
 		adviceNameM := adviceNameMap.(map[string]interface{})
5262
 		var advice models.GroupAdvice
5286
 		var advice models.GroupAdvice
5287
+
5263
 		advice.Remark = Remark
5288
 		advice.Remark = Remark
5264
 		advice.AdviceType = adviceType
5289
 		advice.AdviceType = adviceType
5290
+
5265
 		advice.StartTime = StartTime
5291
 		advice.StartTime = StartTime
5292
+
5266
 		advice.AdviceDate = AdviceDate
5293
 		advice.AdviceDate = AdviceDate
5267
 
5294
 
5268
 		advice.RecordDate = RecordDate
5295
 		advice.RecordDate = RecordDate
5372
 			advice.DrugNameId = drug_name_id
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
 		if adviceNameM["template_id"] != nil && reflect.TypeOf(adviceNameM["template_id"]).String() == "string" {
5407
 		if adviceNameM["template_id"] != nil && reflect.TypeOf(adviceNameM["template_id"]).String() == "string" {
5376
 			template_id, _ := adviceNameM["template_id"].(string)
5408
 			template_id, _ := adviceNameM["template_id"].(string)
5377
 			advice.TemplateId = template_id
5409
 			advice.TemplateId = template_id
5448
 						child.PrescribingNumberUnit = childPrescribingNumberUnit
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
 					child.DeliveryWay = advice.DeliveryWay
5488
 					child.DeliveryWay = advice.DeliveryWay
5452
 					child.ExecutionFrequency = advice.ExecutionFrequency
5489
 					child.ExecutionFrequency = advice.ExecutionFrequency
5453
 					advice.Children = append(advice.Children, &child)
5490
 					advice.Children = append(advice.Children, &child)
5475
 			PatientId:  patient,
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
 		if dialysisFinish.ID == 0 {
5516
 		if dialysisFinish.ID == 0 {
5480
 			service.CreateDialysisFinish(finish)
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
 	} else {
5602
 	} else {
5525
 		c.ServeSuccessJSON(map[string]interface{}{
5603
 		c.ServeSuccessJSON(map[string]interface{}{
8091
 
8169
 
8092
 	start_time := c.GetString("start_time")
8170
 	start_time := c.GetString("start_time")
8093
 	end_time := c.GetString("end_time")
8171
 	end_time := c.GetString("end_time")
8172
+	schedule_type, _ := c.GetInt64("schedule_type")
8173
+	partion_id, _ := c.GetInt64("partion_id")
8094
 	orgId := c.GetMobileAdminUserInfo().Org.Id
8174
 	orgId := c.GetMobileAdminUserInfo().Org.Id
8095
 	timeLayout := "2006-01-02"
8175
 	timeLayout := "2006-01-02"
8096
 	loc, _ := time.LoadLocation("Local")
8176
 	loc, _ := time.LoadLocation("Local")
8113
 		}
8193
 		}
8114
 		endTime = theTime.Unix()
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
 	fmt.Println("schedulelist22222222", schedulelist)
8198
 	fmt.Println("schedulelist22222222", schedulelist)
8119
 	c.ServeSuccessJSON(map[string]interface{}{
8199
 	c.ServeSuccessJSON(map[string]interface{}{
8157
 
8237
 
8158
 	end_time := c.GetString("end_time")
8238
 	end_time := c.GetString("end_time")
8159
 
8239
 
8160
-	fmt.Println("start_timeo2o2o2o2o2o", start_time)
8161
-	fmt.Println("end_Time2o2o2o2ooo22", end_time)
8162
 	var startdateunix int64
8240
 	var startdateunix int64
8163
 	if len(start_time) > 0 {
8241
 	if len(start_time) > 0 {
8164
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8242
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8165
-		fmt.Println("theTim3333333333333333333333e", theTime)
8166
 		if err != nil {
8243
 		if err != nil {
8167
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8244
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8168
 			return
8245
 			return
8190
 
8267
 
8191
 	org_id := c.GetMobileAdminUserInfo().Org.Id
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
 		c.ServeSuccessJSON(map[string]interface{}{
8285
 		c.ServeSuccessJSON(map[string]interface{}{
8196
 			"list": list,
8286
 			"list": list,
8197
 		})
8287
 		})
8198
 		return
8288
 		return
8199
 	} else {
8289
 	} else {
8200
-		list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
8290
+		list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
8201
 		c.ServeSuccessJSON(map[string]interface{}{
8291
 		c.ServeSuccessJSON(map[string]interface{}{
8202
 			"list": list,
8292
 			"list": list,
8203
 		})
8293
 		})
8204
-		return
8205
 	}
8294
 	}
8206
 
8295
 
8296
+	return
8297
+
8207
 }
8298
 }
8208
 
8299
 
8209
 func (c *DialysisAPIController) BathDeleteAdviceList() {
8300
 func (c *DialysisAPIController) BathDeleteAdviceList() {

+ 32 - 4
controllers/mobile_api_controllers/patient_api_controller.go View File

716
 			return
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
 		advices := models.DoctorAdvice{
727
 		advices := models.DoctorAdvice{
2701
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2704
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2702
 		newprescribe.Remark = lastDialysisPrescription.Remark
2705
 		newprescribe.Remark = lastDialysisPrescription.Remark
2703
 		newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2706
 		newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2707
+
2704
 		_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2708
 		_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2705
 		newprescribe.ID = dialysisPrescription.ID
2709
 		newprescribe.ID = dialysisPrescription.ID
2706
 
2710
 
3818
 
3822
 
3819
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3823
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3820
 		is_infect, _ := dataBody["is_infect"].(string)
3824
 		is_infect, _ := dataBody["is_infect"].(string)
3821
-		fmt.Println("is_infect================", is_infect)
3822
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3825
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3823
 		evaluation.IsInfect = infect
3826
 		evaluation.IsInfect = infect
3824
 	}
3827
 	}
4040
 		warsh_count, _ := dataBody["warsh_count"].(string)
4043
 		warsh_count, _ := dataBody["warsh_count"].(string)
4041
 		evaluation.WarshCount = warsh_count
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
 	return
4056
 	return
4044
 }
4057
 }
4045
 
4058
 
4404
 			//获取所有的患者
4417
 			//获取所有的患者
4405
 			patients, _ := service.GetAllPatientListByListOne(orgID)
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
 			treatments, _ := service.GetAllTreatModeByList(orgID)
4436
 			treatments, _ := service.GetAllTreatModeByList(orgID)
4409
 
4437
 

+ 2 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

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

508
 			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
508
 			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
509
 		}
509
 		}
510
 		service.CreateScheduleLog(xtScheduleLog)
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
 		redis := service.RedisClient()
519
 		redis := service.RedisClient()
512
 		//处方
520
 		//处方
513
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
521
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"

+ 6 - 1
controllers/patient_api_controller.go View File

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
 	byterequest, _ := json.Marshal(advice)
3691
 	byterequest, _ := json.Marshal(advice)
3692
 	doctorAdviceLog := models.XtDoctorAdviceLog{
3692
 	doctorAdviceLog := models.XtDoctorAdviceLog{
4607
 		chaptalization := dataBody["chaptalization"].(string)
4607
 		chaptalization := dataBody["chaptalization"].(string)
4608
 		solution.Chaptalization = chaptalization
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
 	return
4615
 	return
4611
 }
4616
 }
4612
 
4617
 

+ 70 - 50
controllers/pharmacy_controller.go View File

348
 
348
 
349
 // 发药按钮点击
349
 // 发药按钮点击
350
 func (this *PharmacyController) DispensingMedicine() {
350
 func (this *PharmacyController) DispensingMedicine() {
351
+
351
 	var err error
352
 	var err error
352
 	defer func() {
353
 	defer func() {
353
 		if rec := recover(); rec != nil {
354
 		if rec := recover(); rec != nil {
379
 		for _, item := range advicelist {
380
 		for _, item := range advicelist {
380
 			//查询改药品信息
381
 			//查询改药品信息
381
 			medical, _ := service.GetBaseDrugMedical(item.DrugId)
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
 		}
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
 		return
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 View File

38
 	adminUserInfo := this.GetAdminUserInfo()
38
 	adminUserInfo := this.GetAdminUserInfo()
39
 
39
 
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 {
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
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
43
 		for _, item := range schedules {
43
 		for _, item := range schedules {
44
 
44
 
99
 
99
 
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 {
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
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
103
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
104
 
104
 
105
 					item.Patient.TotalDialysis = listOne.Count
105
 					item.Patient.TotalDialysis = listOne.Count
106
 					item.Count = listOne.Count
106
 					item.Count = listOne.Count
107
 				}
107
 				}
108
 
108
 
109
-				if item.ScheduleDate >= 1672502400 {
109
+				if item.ScheduleDate >= 1704038400 {
110
 
110
 
111
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
111
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
112
 
112
 
145
 	}
145
 	}
146
 
146
 
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 {
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
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
149
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
149
 		for _, item := range schedules {
150
 		for _, item := range schedules {
151
+
150
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
152
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
151
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
153
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
152
 				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
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
 				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
169
 				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
157
 					item.Count = list.Count
170
 					item.Count = list.Count
162
 
175
 
163
 			item.Schedule = &lastSchedule
176
 			item.Schedule = &lastSchedule
164
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
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
 				if item.ScheduleDate <= 1640966400 {
179
 				if item.ScheduleDate <= 1640966400 {
171
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
180
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)

+ 8 - 0
controllers/schedule_api_controller.go View File

1968
 
1968
 
1969
 	service.CreateScheduleLog(scheduleLog)
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
 	redis := service.RedisClient()
1979
 	redis := service.RedisClient()
1972
 
1980
 
1973
 	//处方
1981
 	//处方

+ 51 - 4
controllers/sign_api_controller.go View File

91
 
91
 
92
 	beego.Router("/api/device/toautodiagnose", &SignApiController{}, "Get:ToAutoDiagnose")
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
 
665
 
663
 func (this *SignApiController) UploadPrintOrder() {
666
 func (this *SignApiController) UploadPrintOrder() {
664
 
667
 
665
-	fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
666
 	list, _ := service.GetAllPatientNew(10587)
668
 	list, _ := service.GetAllPatientNew(10587)
667
 	for _, item := range list {
669
 	for _, item := range list {
668
 
670
 
1214
 func (this *SignApiController) ToAutoDiagnose() {
1216
 func (this *SignApiController) ToAutoDiagnose() {
1215
 
1217
 
1216
 	orgId := this.GetAdminUserInfo().CurrentOrgId
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
 	list, _ := service.GetNewAllpatient(orgId)
1227
 	list, _ := service.GetNewAllpatient(orgId)
1218
 
1228
 
1219
 	for _, item := range list {
1229
 	for _, item := range list {
1224
 	//for _, item := range list {
1234
 	//for _, item := range list {
1225
 	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
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 View File

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

+ 14 - 0
models/dialysis.go View File

329
 	BeforSymptoms                  string  `gorm:"column:befor_symptoms" json:"befor_symptoms" form:"befor_symptoms"`
329
 	BeforSymptoms                  string  `gorm:"column:befor_symptoms" json:"befor_symptoms" form:"befor_symptoms"`
330
 	WashingTime                    string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
330
 	WashingTime                    string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
331
 	WarshCount                     string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
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
 func (PredialysisEvaluation) TableName() string {
335
 func (PredialysisEvaluation) TableName() string {
1623
 func (NoHisPrescriptionProject) TableName() string {
1624
 func (NoHisPrescriptionProject) TableName() string {
1624
 	return "his_prescription_project"
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 View File

136
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
136
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
137
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
137
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
138
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
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
 func (DialysisPrescriptionParameter) TableName() string {
142
 func (DialysisPrescriptionParameter) TableName() string {

+ 5 - 0
models/drug.go View File

115
 	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
115
 	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
116
 	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
116
 	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
117
 	ManufacturerName string `gorm:"column:manufacturer_name" json:"manufacturer_name"`
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
 func (BaseDrugLibEleven) TableName() string {
125
 func (BaseDrugLibEleven) TableName() string {

+ 1 - 0
models/new_monitor.go View File

34
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
34
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
35
 	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
35
 	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
36
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
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
 func (VMMonitorPatients) TableName() string {
40
 func (VMMonitorPatients) TableName() string {

+ 27 - 11
models/patient_models.go View File

380
 	WarshCount                 string        `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
380
 	WarshCount                 string        `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
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
 func (DialysisPrescription) TableName() string {
386
 func (DialysisPrescription) TableName() string {
487
 	MaxUltrafiltrationRate     string  `gorm:"column:max_ultrafiltration_rate" json:"max_ultrafiltration_rate" form:"max_ultrafiltration_rate"`
488
 	MaxUltrafiltrationRate     string  `gorm:"column:max_ultrafiltration_rate" json:"max_ultrafiltration_rate" form:"max_ultrafiltration_rate"`
488
 	WaterMachine               string  `gorm:"column:water_machine" json:"water_machine" form:"water_machine"`
489
 	WaterMachine               string  `gorm:"column:water_machine" json:"water_machine" form:"water_machine"`
489
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
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
 func (DialysisPrescriptionList) TableName() string {
494
 func (DialysisPrescriptionList) TableName() string {
617
 	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
619
 	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
618
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
620
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
619
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
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
 func (DialysisSolution) TableName() string {
625
 func (DialysisSolution) TableName() string {
1632
 	ModeId                     int64                 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1635
 	ModeId                     int64                 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1633
 	Anticoagulant              int64                 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1636
 	Anticoagulant              int64                 `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1634
 	DialysisSolution           VmDialysisSolutionOne `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"solution"`
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
 func (VmDialysisSolution) TableName() string {
1641
 func (VmDialysisSolution) TableName() string {
1670
 }
1674
 }
1671
 
1675
 
1672
 type XtScheduleList struct {
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
 func (XtScheduleList) TableName() string {
1691
 func (XtScheduleList) TableName() string {
2358
 func (XtDeviceValusalMapVrr) TableName() string {
2363
 func (XtDeviceValusalMapVrr) TableName() string {
2359
 	return "xt_device_valusal_map_vrr"
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 View File

153
 func (Roles) TableName() string {
153
 func (Roles) TableName() string {
154
 	return "sgj_user_role"
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 View File

392
 	ReceiveTreatmentAsses      ReceiveTreatmentAsses      `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_receive_treatment_asses"`
392
 	ReceiveTreatmentAsses      ReceiveTreatmentAsses      `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_receive_treatment_asses"`
393
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
393
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
394
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
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
 func (VmBloodSchedule) TableName() string {
398
 func (VmBloodSchedule) TableName() string {
423
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
424
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
424
 	TrobleShoot        int64  `gorm:"column:troble_shoot" json:"troble_shoot" form:"troble_shoot"`
425
 	TrobleShoot        int64  `gorm:"column:troble_shoot" json:"troble_shoot" form:"troble_shoot"`
425
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
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
 func (NewMSchedualPatientVMList) TableName() string {
430
 func (NewMSchedualPatientVMList) TableName() string {

+ 3 - 0
models/user_models.go View File

351
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
351
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
352
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
352
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
353
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
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
 func (XtDialysisSolution) TableName() string {
359
 func (XtDialysisSolution) TableName() string {

+ 7 - 0
service/dialysis_parameter_service.go View File

452
 
452
 
453
 	return vms, err
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 View File

222
 	return errors
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
 func AddSigleSummaryRecord(summary *models.TreatmentSummary) (err error) {
231
 func AddSigleSummaryRecord(summary *models.TreatmentSummary) (err error) {
226
 	tx := writeDb.Begin()
232
 	tx := writeDb.Begin()
227
 	errors := tx.Model(&models.TreatmentSummary{}).Create(&summary).Error
233
 	errors := tx.Model(&models.TreatmentSummary{}).Create(&summary).Error

+ 62 - 0
service/dialysis_solution_service.go View File

120
 	return advice, err
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
 func GetAllHisAdviceTemplateList(user_org_id int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
129
 func GetAllHisAdviceTemplateList(user_org_id int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
124
 
130
 
125
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&advice).Error
131
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&advice).Error
586
 	return schedule, err
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 View File

510
 	return
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
 	db := XTReadDB().Model(&schedulelist).Where("status =1 and user_org_id =?", org_id)
515
 	db := XTReadDB().Model(&schedulelist).Where("status =1 and user_org_id =?", org_id)
516
 	if start_time > 0 {
516
 	if start_time > 0 {
519
 	if end_time > 0 {
519
 	if end_time > 0 {
520
 		db = db.Where("schedule_date<=?", end_time)
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
 	return schedulelist, err
530
 	return schedulelist, err
525
 
531
 
629
 	if orgid > 0 {
635
 	if orgid > 0 {
630
 		db = db.Where("x.org_id =?", orgid)
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
 	return drug, err
639
 	return drug, err
634
 }
640
 }
635
 
641
 
1322
 
1328
 
1323
 	return afterlist, total, err
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 View File

169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
170
 
170
 
171
 	var projectCount models.UserInspectionProjectCount
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
 	if err != nil {
174
 	if err != nil {
175
 		return
175
 		return
181
 	}
181
 	}
182
 
182
 
183
 	var Id models.InspectionDate
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
 	if err != nil {
185
 	if err != nil {
186
 		return
186
 		return
187
 	}
187
 	}

+ 5 - 0
service/manage_service.go View File

915
 	return patients, err
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
 func GetAllpatientThirty(orgid int64) (patients []*models.PatientsThirty, err error) {
923
 func GetAllpatientThirty(orgid int64) (patients []*models.PatientsThirty, err error) {
919
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
924
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
920
 	return patients, err
925
 	return patients, err

+ 5 - 2
service/mobile_dialysis_service.go View File

2340
 
2340
 
2341
 	// cur_date := time.Now().Format("2006-01-02")
2341
 	// cur_date := time.Now().Format("2006-01-02")
2342
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
2342
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
2343
+
2343
 	dialysis_solution_str, _ := redis.Get(key).Result()
2344
 	dialysis_solution_str, _ := redis.Get(key).Result()
2344
 
2345
 
2345
 	if len(dialysis_solution_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2346
 	if len(dialysis_solution_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2809
 }
2810
 }
2810
 
2811
 
2811
 func GetDialysisOrderCountTwo(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
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
 	return
2814
 	return
2814
 }
2815
 }
2815
 
2816
 
8112
 	order := models.BloodDialysisOrderCount{}
8113
 	order := models.BloodDialysisOrderCount{}
8113
 	db := XTReadDB().Table("xt_dialysis_order as o")
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
 	return order, err
8118
 	return order, err
8118
 }
8119
 }
8167
 			db = db.Where("partition_id = ?", partitionType)
8168
 			db = db.Where("partition_id = ?", partitionType)
8168
 		}
8169
 		}
8169
 		if patient_id > 0 {
8170
 		if patient_id > 0 {
8171
+
8170
 			if execution_state > 0 {
8172
 			if execution_state > 0 {
8171
 				if cost_type > 0 {
8173
 				if cost_type > 0 {
8172
 					if len(execution_frequency) > 0 {
8174
 					if len(execution_frequency) > 0 {
8444
 		}
8446
 		}
8445
 		if patient_id > 0 {
8447
 		if patient_id > 0 {
8446
 			if execution_state > 0 {
8448
 			if execution_state > 0 {
8449
+				fmt.Println("execution_state---------------------", execution_state)
8447
 				if cost_type > 0 {
8450
 				if cost_type > 0 {
8448
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8451
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8449
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
8452
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).

+ 59 - 2
service/patient_service.go View File

79
 
79
 
80
 	}
80
 	}
81
 	if lapseto != 2 && lapseto != 3 {
81
 	if lapseto != 2 && lapseto != 3 {
82
-		if orgID != 10579 {
82
+		if orgID != 10579 && orgID != 10600 {
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
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
 			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
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
 	return
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
 func UpdateDoctorAdvice(m *models.DoctorAdvice) (err error) {
1154
 func UpdateDoctorAdvice(m *models.DoctorAdvice) (err error) {
1118
 	return writeDb.Save(m).Error
1155
 	return writeDb.Save(m).Error
1119
 }
1156
 }
1194
 	return
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
 func FindDoctorAdvice(orgID, id int64) (advice models.DoctorAdvice, err error) {
1242
 func FindDoctorAdvice(orgID, id int64) (advice models.DoctorAdvice, err error) {
1198
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? and user_org_id=? and status = 1", id, orgID).First(&advice).Error
1243
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? and user_org_id=? and status = 1", id, orgID).First(&advice).Error
1199
 	return
1244
 	return
3340
 	fmt.Println("err2330230320202023", err)
3385
 	fmt.Println("err2330230320202023", err)
3341
 	return schedule, err
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 View File

640
 }
640
 }
641
 
641
 
642
 func GetlongDialysisrecord(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (prescription []*models.XtDialysisSolution, total int64, err error) {
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
 	if patientid > 0 {
644
 	if patientid > 0 {
645
 		db = db.Where("x.patient_id = ?", patientid)
645
 		db = db.Where("x.patient_id = ?", patientid)
646
 	}
646
 	}

+ 138 - 0
service/pharmacy_service.go View File

678
 
678
 
679
 	if orgid != 10480 {
679
 	if orgid != 10480 {
680
 		for _, v := range advice_info {
680
 		for _, v := range advice_info {
681
+
681
 			tmp_bool := IsPharmacyConfig(orgid)
682
 			tmp_bool := IsPharmacyConfig(orgid)
682
 			if tmp_bool {
683
 			if tmp_bool {
683
 				if PettyCash(v.DrugId) {
684
 				if PettyCash(v.DrugId) {
779
 	return
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
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
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 View File

308
 	WhetherUnobstructed            int64   `gorm:"column:whether_unobstructed" json:"whether_unobstructed" form:"whether_unobstructed"`
308
 	WhetherUnobstructed            int64   `gorm:"column:whether_unobstructed" json:"whether_unobstructed" form:"whether_unobstructed"`
309
 	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
309
 	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
310
 	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
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
 func (AssessmentBeforeDislysisVM) TableName() string {
314
 func (AssessmentBeforeDislysisVM) TableName() string {

+ 2 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

229
 
229
 
230
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
230
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
231
 	order := models.VmDialysisOrder{}
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
 	return order, err
233
 	return order, err
234
 }
234
 }
235
 
235
 
236
 func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
236
 func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
237
 	order := models.VmDialysisOrder{}
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
 	return order, err
239
 	return order, err
240
 }
240
 }
241
 
241
 

+ 13 - 1
service/schedule_service.go View File

243
 func GetNextScheduleByList(patient_id int64, schedule_date int64, user_org_id int64) (models.SchedulePatientsOne, error) {
243
 func GetNextScheduleByList(patient_id int64, schedule_date int64, user_org_id int64) (models.SchedulePatientsOne, error) {
244
 
244
 
245
 	patientsOne := models.SchedulePatientsOne{}
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
 	return patientsOne, err
247
 	return patientsOne, err
248
 }
248
 }
249
 
249
 
1763
 	return err
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
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1778
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1767
 
1779
 
1768
 	schedule := models.XtSchedule{}
1780
 	schedule := models.XtSchedule{}

+ 60 - 1
service/sign_service.go View File

2099
 
2099
 
2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
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
 	return list, err
2104
 	return list, err
2105
 }
2105
 }
2141
 	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
2141
 	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
2142
 	return err
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 View File

1770
 	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1770
 	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1771
 	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1771
 	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1772
 	StockCount              string  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
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
 func (DrugWarehouseOutInfo) TableName() string {
1776
 func (DrugWarehouseOutInfo) TableName() string {

+ 2 - 0
service/warhouse_service.go View File

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