Quellcode durchsuchen

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

陈少旭 vor 1 Jahr
Ursprung
Commit
1aca593219
46 geänderte Dateien mit 3463 neuen und 205 gelöschten Zeilen
  1. 1 1
      conf/app.conf
  2. 6 6
      controllers/base_api_controller.go
  3. 1 1
      controllers/data_api_controller.go
  4. 633 6
      controllers/dialysis_api_controller.go
  5. 205 0
      controllers/dialysis_record_api_controller.go
  6. 3 1
      controllers/drug_stock_api_contorller.go
  7. 12 2
      controllers/his_api_controller.go
  8. 3 4
      controllers/manage_api_controller.go
  9. 101 1
      controllers/manager_center_api_controller.go
  10. 723 17
      controllers/mobile_api_controllers/dialysis_api_controller.go
  11. 90 1
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  12. 8 3
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  13. 9 0
      controllers/mobile_api_controllers/mobile_api_router_register.go
  14. 630 3
      controllers/mobile_api_controllers/patient_api_controller.go
  15. 245 4
      controllers/patient_api_controller.go
  16. 53 1
      controllers/patient_dataconfig_api_controller.go
  17. 1 1
      controllers/pharmacy_controller.go
  18. 2 2
      controllers/print_data_api_controller.go
  19. 15 0
      controllers/schedule_api_controller.go
  20. 2 1
      controllers/stock_in_api_controller.go
  21. 1 1
      controllers/supply_order_api_contorller.go
  22. 4 0
      enums/error_code.go
  23. 17 12
      go.mod
  24. 44 14
      go.sum
  25. 25 10
      models/data_models.go
  26. 22 0
      models/device_models.go
  27. 79 9
      models/dialysis.go
  28. 1 0
      models/drug_stock.go
  29. 1 0
      models/his_models.go
  30. 36 0
      models/patient_models.go
  31. 4 3
      models/schedule_models.go
  32. 1 0
      models/stock_models.go
  33. 169 2
      service/dialysis_service.go
  34. 58 0
      service/gobal_config_service.go
  35. 7 0
      service/his_service.go
  36. 44 0
      service/manage_center_service.go
  37. 3 3
      service/manage_service.go
  38. 6 5
      service/mobile_dialysis_service.go
  39. 96 71
      service/new_warehouse_service.go
  40. 44 2
      service/patient_service.go
  41. 1 1
      service/patientmanage_service.go
  42. 1 2
      service/pharmacy_service.go
  43. 7 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  44. 18 0
      service/schedule_service.go
  45. 6 5
      service/stock_service.go
  46. 25 10
      service/warhouse_service.go

+ 1 - 1
conf/app.conf Datei anzeigen

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = prod
3
+runmode = dev
4 4
 #dev/prod
5 5
 
6 6
 #

+ 6 - 6
controllers/base_api_controller.go Datei anzeigen

@@ -82,7 +82,7 @@ func (this *BaseAuthAPIController) Prepare() {
82 82
 		userAdmin.ModifyTime = 1530786071
83 83
 		var subscibe models.ServeSubscibe
84 84
 		subscibe.ID = 11
85
-		subscibe.OrgId = 10394 //机构id
85
+		subscibe.OrgId = 9671 //机构id
86 86
 		subscibe.PeriodStart = 1547447814
87 87
 		subscibe.PeriodEnd = 1550039814
88 88
 		subscibe.State = 1
@@ -92,8 +92,8 @@ func (this *BaseAuthAPIController) Prepare() {
92 92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93 93
 		subscibes[4] = &subscibe
94 94
 		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 10394 //机构id小英9675或4
96
-		adminUserInfo.CurrentAppId = 3295  //4
95
+		adminUserInfo.CurrentOrgId = 9671  //机构id小英9675或4
96
+		adminUserInfo.CurrentAppId = 15993 //4
97 97
 		adminUserInfo.AdminUser = &userAdmin
98 98
 		adminUserInfo.Subscibes = subscibes
99 99
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -328,7 +328,7 @@ func (this *BaseServeAPIController) Prepare() {
328 328
 		userAdmin.ModifyTime = 1530786071
329 329
 		var subscibe models.ServeSubscibe
330 330
 		subscibe.ID = 11
331
-		subscibe.OrgId = 10394 //机构id小英9675或4
331
+		subscibe.OrgId = 9671 //机构id小英9675或4
332 332
 		subscibe.PeriodStart = 1538035409
333 333
 		subscibe.PeriodEnd = 1569571409
334 334
 		subscibe.State = 1
@@ -338,8 +338,8 @@ func (this *BaseServeAPIController) Prepare() {
338 338
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339 339
 		subscibes[4] = &subscibe
340 340
 		var adminUserInfo service.AdminUserInfo
341
-		adminUserInfo.CurrentOrgId = 10394 //机构id小英9675或4
342
-		adminUserInfo.CurrentAppId = 3295  //4
341
+		adminUserInfo.CurrentOrgId = 9671  //机构id小英9675或4
342
+		adminUserInfo.CurrentAppId = 15993 //4
343 343
 		adminUserInfo.AdminUser = &userAdmin
344 344
 		adminUserInfo.Subscibes = subscibes
345 345
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 1
controllers/data_api_controller.go Datei anzeigen

@@ -400,7 +400,7 @@ func configFormData(dataconfig *models.Dataconfig, data []byte) (code int) {
400 400
 	}
401 401
 	dataconfig.Module = module
402 402
 
403
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" || module == "sick_history" {
403
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" || module == "sick_history" || module == "befor_symptoms" {
404 404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405 405
 			utils.ErrorLog("title")
406 406
 			code = enums.ErrorCodeParamWrong

+ 633 - 6
controllers/dialysis_api_controller.go Datei anzeigen

@@ -112,9 +112,15 @@ func DialysisApiRegistRouters() {
112 112
 
113 113
 	beego.Router("/api/schedule/getmobileschedulelist", &DialysisApiController{}, "Get:GetMobileScheduleList")
114 114
 
115
+	beego.Router("/api/patient/saveinformation", &DialysisApiController{}, "Get:SaveInformation")
116
+
115 117
 	beego.Router("/api/patient/savedialysisInformationsetting", &DialysisApiController{}, "Get:SaveDialysisInformationSetting")
116 118
 
117 119
 	beego.Router("/api/patient/getdialyisinformationsetting", &DialysisApiController{}, "Get:GetDialysisInformationSetting")
120
+
121
+	beego.Router("/api/patient/checkdialysisinformation", &DialysisApiController{}, "Get:CheckDialysisInformation")
122
+
123
+	beego.Router("/api/dialysis/patientsflow", &DialysisApiController{}, "Get:GetDialysisPatientsFlow")
118 124
 }
119 125
 
120 126
 func (c *DialysisApiController) GetQueueCall() {
@@ -339,6 +345,7 @@ func (c *DialysisApiController) PostPrescription() {
339 345
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
340 346
 	prescription_water, _ := c.GetFloat("prescription_water")
341 347
 	dialysis_strainer := c.GetString("dialysis_strainer")
348
+	chaptalization := c.GetString("chaptalization")
342 349
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
343 350
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
344 351
 
@@ -456,6 +463,7 @@ func (c *DialysisApiController) PostPrescription() {
456 463
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
457 464
 		PrescriptionWater:          prescription_water,
458 465
 		DialysisStrainer:           dialysis_strainer,
466
+		Chaptalization:             chaptalization,
459 467
 	}
460 468
 
461 469
 	//长沙南雅医院,自动生成抗凝剂的临时处方
@@ -612,8 +620,51 @@ func (c *DialysisApiController) PostPrescription() {
612 620
 			prescription.AdminUserId = adminUserInfo.AdminUser.Id
613 621
 		}
614 622
 
623
+		// 查询信息规挡的设置天数
624
+
625
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
626
+		if infor.ID > 0 {
627
+
628
+			var cha_time int64
629
+
630
+			timeNowStr := time.Now().Format("2006-01-02")
631
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
632
+
633
+			//今日的日期减去设置的日期
634
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
635
+
636
+			if cha_time >= recordDate.Unix() {
637
+				//查询审核是否允许
638
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
639
+				//申请状态不允许的情况 拒绝修改
640
+				if infor.ApplicationStatus != 1 {
641
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
642
+					return
643
+				}
644
+
645
+			}
646
+		}
647
+
615 648
 		err := service.AddSigleRecord(&prescription)
616 649
 
650
+		//创建步骤表
651
+		finish := models.XtDialysisFinish{
652
+			IsFinish:   1,
653
+			UserOrgId:  adminUserInfo.CurrentOrgId,
654
+			Status:     1,
655
+			Ctime:      time.Now().Unix(),
656
+			Mtime:      0,
657
+			Module:     1,
658
+			RecordDate: recordDate.Unix(),
659
+			Sourse:     1,
660
+			PatientId:  patient,
661
+		}
662
+
663
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 1, patient)
664
+		if dialysisFinish.ID == 0 {
665
+			service.CreateDialysisFinish(finish)
666
+		}
667
+
617 668
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
618 669
 		redis := service.RedisClient()
619 670
 		//清空key 值
@@ -640,6 +691,7 @@ func (c *DialysisApiController) PostPrescription() {
640 691
 
641 692
 	} else { //修改
642 693
 		if mode_id > 0 {
694
+
643 695
 			var str string
644 696
 			//查找该机构用的是什么透析器
645 697
 			filedConfig, _ := service.GetFiledConfig(adminUserInfo.CurrentOrgId)
@@ -683,6 +735,31 @@ func (c *DialysisApiController) PostPrescription() {
683 735
 		prescription.Modifier = adminUserInfo.AdminUser.Id
684 736
 		prescription.ID = dialysisPrescription.ID
685 737
 
738
+		// 查询信息规挡的设置天数
739
+
740
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
741
+		if infor.ID > 0 {
742
+
743
+			var cha_time int64
744
+
745
+			timeNowStr := time.Now().Format("2006-01-02")
746
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
747
+
748
+			//今日的日期减去设置的日期
749
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
750
+
751
+			if cha_time >= recordDate.Unix() {
752
+				//查询审核是否允许
753
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
754
+				//申请状态不允许的情况 拒绝修改
755
+				if infor.ApplicationStatus != 1 {
756
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
757
+					return
758
+				}
759
+
760
+			}
761
+		}
762
+
686 763
 		updateErr := service.UpDateDialysisPrescription(&prescription)
687 764
 
688 765
 		//修改处方
@@ -855,6 +932,7 @@ func (c *DialysisApiController) PostSoulution() {
855 932
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
856 933
 	prescription_water, _ := c.GetFloat("prescription_water")
857 934
 	dialysis_strainer := c.GetString("dialysis_strainer")
935
+	chaptalization := c.GetString("chaptalization")
858 936
 	var prescription_doctor int64
859 937
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
860 938
 
@@ -895,6 +973,30 @@ func (c *DialysisApiController) PostSoulution() {
895 973
 	//	}
896 974
 	//}
897 975
 
976
+	// 查询信息规挡的设置天数
977
+
978
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
979
+	if infor.ID > 0 {
980
+		var cha_time int64
981
+
982
+		timeNowStr := time.Now().Format("2006-01-02")
983
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
984
+
985
+		//今日的日期减去设置的日期
986
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
987
+
988
+		if cha_time >= recordDate.Unix() {
989
+			//查询审核是否允许
990
+			infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
991
+			//申请状态不允许的情况 拒绝修改
992
+			if infor.ApplicationStatus != 1 {
993
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
994
+				return
995
+			}
996
+
997
+		}
998
+	}
999
+
898 1000
 	prescription := models.DialysisPrescription{
899 1001
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
900 1002
 		PatientId:                 patient,
@@ -998,6 +1100,7 @@ func (c *DialysisApiController) PostSoulution() {
998 1100
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
999 1101
 		PrescriptionWater:          prescription_water,
1000 1102
 		DialysisStrainer:           dialysis_strainer,
1103
+		Chaptalization:             chaptalization,
1001 1104
 	}
1002 1105
 
1003 1106
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1064,6 +1167,24 @@ func (c *DialysisApiController) PostSoulution() {
1064 1167
 	//  }
1065 1168
 	//}
1066 1169
 
1170
+	//创建步骤表
1171
+	finish := models.XtDialysisFinish{
1172
+		IsFinish:   1,
1173
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1174
+		Status:     1,
1175
+		Ctime:      time.Now().Unix(),
1176
+		Mtime:      0,
1177
+		Module:     1,
1178
+		RecordDate: recordDate.Unix(),
1179
+		Sourse:     1,
1180
+		PatientId:  patient,
1181
+	}
1182
+
1183
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 1, patient)
1184
+	if dialysisFinish.ID == 0 {
1185
+		service.CreateDialysisFinish(finish)
1186
+	}
1187
+
1067 1188
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1068 1189
 	if dialysisPrescription.ID == 0 { //新增
1069 1190
 		if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -1178,6 +1299,7 @@ func (c *DialysisApiController) PostSoulution() {
1178 1299
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1179 1300
 		PrescriptionWater:          prescribing_number,
1180 1301
 		DialysisStrainer:           dialysis_strainer,
1302
+		Chaptalization:             chaptalization,
1181 1303
 	}
1182 1304
 
1183 1305
 	//针对河间咸得
@@ -1446,6 +1568,31 @@ func (c *DialysisApiController) PostDouleCheck() {
1446 1568
 		NeedleBatchNumber:          needle_batch_number,
1447 1569
 	}
1448 1570
 
1571
+	// 查询信息规挡的设置天数
1572
+
1573
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1574
+	if infor.ID > 0 {
1575
+
1576
+		var cha_time int64
1577
+
1578
+		timeNowStr := time.Now().Format("2006-01-02")
1579
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1580
+
1581
+		//今日的日期减去设置的日期
1582
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1583
+
1584
+		if cha_time >= recordDate.Unix() {
1585
+			//查询审核是否允许
1586
+			infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1587
+			//申请状态不允许的情况 拒绝修改
1588
+			if infor.ApplicationStatus != 1 {
1589
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1590
+				return
1591
+			}
1592
+
1593
+		}
1594
+	}
1595
+
1449 1596
 	_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1450 1597
 	if check.ID == 0 { //新增
1451 1598
 		doubleCheck.FirstCheckTime = firstCheckTimeDate
@@ -1454,6 +1601,48 @@ func (c *DialysisApiController) PostDouleCheck() {
1454 1601
 		doubleCheck.Modifier = modifier
1455 1602
 
1456 1603
 		err := service.AddSigleDoubleCheck(&doubleCheck)
1604
+		//创建步骤表
1605
+		finish := models.XtDialysisFinish{
1606
+			IsFinish:   1,
1607
+			UserOrgId:  adminUserInfo.CurrentOrgId,
1608
+			Status:     1,
1609
+			Ctime:      time.Now().Unix(),
1610
+			Mtime:      0,
1611
+			Module:     5,
1612
+			RecordDate: recordDate.Unix(),
1613
+			Sourse:     1,
1614
+			PatientId:  id,
1615
+		}
1616
+
1617
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 5, id)
1618
+		if dialysisFinish.ID == 0 {
1619
+			service.CreateDialysisFinish(finish)
1620
+		}
1621
+
1622
+		// 查询信息规挡的设置天数
1623
+
1624
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1625
+		if infor.ID > 0 {
1626
+
1627
+			var cha_time int64
1628
+
1629
+			timeNowStr := time.Now().Format("2006-01-02")
1630
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1631
+
1632
+			//今日的日期减去设置的日期
1633
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1634
+
1635
+			if cha_time >= recordDate.Unix() {
1636
+				//查询审核是否允许
1637
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1638
+				//申请状态不允许的情况 拒绝修改
1639
+				if infor.ApplicationStatus != 1 {
1640
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1641
+					return
1642
+				}
1643
+
1644
+			}
1645
+		}
1457 1646
 		redis := service.RedisClient()
1458 1647
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1459 1648
 
@@ -1585,9 +1774,51 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1585 1774
 		Diacrisis:                    diacrisis,
1586 1775
 	}
1587 1776
 
1777
+	// 查询信息规挡的设置天数
1778
+
1779
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1780
+	if infor.ID > 0 {
1781
+
1782
+		var cha_time int64
1783
+
1784
+		timeNowStr := time.Now().Format("2006-01-02")
1785
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1786
+
1787
+		//今日的日期减去设置的日期
1788
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1789
+
1790
+		if cha_time >= recordDate.Unix() {
1791
+			//查询审核是否允许
1792
+			infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1793
+			//申请状态不允许的情况 拒绝修改
1794
+			if infor.ApplicationStatus != 1 {
1795
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1796
+				return
1797
+			}
1798
+
1799
+		}
1800
+	}
1801
+
1588 1802
 	if receiveTreatment.ID == 0 { //新增
1589 1803
 		receiveTreatmentAsses.Creater = adminUserInfo.AdminUser.Id
1590 1804
 		err := service.AddSigleReceiveTreatmentAssesRecord(&receiveTreatmentAsses)
1805
+		//创建步骤表
1806
+		finish := models.XtDialysisFinish{
1807
+			IsFinish:   1,
1808
+			UserOrgId:  adminUserInfo.CurrentOrgId,
1809
+			Status:     1,
1810
+			Ctime:      time.Now().Unix(),
1811
+			Mtime:      0,
1812
+			Module:     2,
1813
+			RecordDate: recordDate.Unix(),
1814
+			Sourse:     1,
1815
+			PatientId:  id,
1816
+		}
1817
+
1818
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 2, id)
1819
+		if dialysisFinish.ID == 0 {
1820
+			service.CreateDialysisFinish(finish)
1821
+		}
1591 1822
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":receive_treatment_asses"
1592 1823
 		redis := service.RedisClient()
1593 1824
 		//清空key 值
@@ -1767,7 +1998,33 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1767 1998
 		}
1768 1999
 
1769 2000
 		assessment.UpdatedTime = time.Now().Unix()
2001
+
2002
+		// 查询信息规挡的设置天数
2003
+
2004
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2005
+		if infor.ID > 0 {
2006
+
2007
+			var cha_time int64
2008
+
2009
+			timeNowStr := time.Now().Format("2006-01-02")
2010
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2011
+
2012
+			//今日的日期减去设置的日期
2013
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2014
+
2015
+			if cha_time >= recordDate.Unix() {
2016
+				//查询审核是否允许
2017
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
2018
+				//申请状态不允许的情况 拒绝修改
2019
+				if infor.ApplicationStatus != 1 {
2020
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2021
+					return
2022
+				}
2023
+
2024
+			}
2025
+		}
1770 2026
 		err = service.UpdateAssessmentAfterDislysisRecord(&assessment)
2027
+
1771 2028
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
1772 2029
 		redis := service.RedisClient()
1773 2030
 		//清空key 值
@@ -1791,6 +2048,22 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1791 2048
 		assessment.AssessmentDate = recordDate.Unix()
1792 2049
 
1793 2050
 		err = service.AddSigleAssessmentAfterDislysisRecord(&assessment)
2051
+		finish := models.XtDialysisFinish{
2052
+			IsFinish:   1,
2053
+			UserOrgId:  adminUserInfo.CurrentOrgId,
2054
+			Status:     1,
2055
+			Ctime:      time.Now().Unix(),
2056
+			Mtime:      0,
2057
+			Module:     9,
2058
+			RecordDate: recordDate.Unix(),
2059
+			Sourse:     1,
2060
+			PatientId:  patient,
2061
+		}
2062
+
2063
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 9, patient)
2064
+		if dialysisFinish.ID == 0 {
2065
+			service.CreateDialysisFinish(finish)
2066
+		}
1794 2067
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
1795 2068
 		redis := service.RedisClient()
1796 2069
 		//清空key 值
@@ -1911,6 +2184,23 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1911 2184
 	his_department := c.GetString("his_department")
1912 2185
 	his_bed := c.GetString("his_bed")
1913 2186
 	point_puncture := c.GetString("point_puncture")
2187
+
2188
+	catheter_evaluation_program := c.GetString("catheter_evaluation_program")
2189
+	skin_site_catheterization := c.GetString("skin_site_catheterization")
2190
+	pathway_formation_time := c.GetString("pathway_formation_time")
2191
+	timeLayout := "2006-01-02"
2192
+	loc, _ := time.LoadLocation("Local")
2193
+	var startTime int64
2194
+	if len(pathway_formation_time) > 0 {
2195
+		theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", pathway_formation_time+" 00:00:00", loc)
2196
+		startTime = theTime.Unix()
2197
+	}
2198
+	whether_unobstructed, _ := c.GetInt64("whether_unobstructed")
2199
+
2200
+	lien_necessary, _ := c.GetInt64("lien_necessary")
2201
+
2202
+	befor_symptoms := c.GetString("befor_symptoms")
2203
+
1914 2204
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1915 2205
 		DialysisCount:                  dialysis_count,
1916 2206
 		EmergencyTreatment:             emergency_treatment,
@@ -1985,6 +2275,12 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1985 2275
 		HisDepartment:                  his_department,
1986 2276
 		HisBed:                         his_bed,
1987 2277
 		PointPuncture:                  point_puncture,
2278
+		CatheterEvaluationProgram:      catheter_evaluation_program,
2279
+		SkinSiteCatheterization:        skin_site_catheterization,
2280
+		PathwayFormationTime:           startTime,
2281
+		WhetherUnobstructed:            whether_unobstructed,
2282
+		LienNecessary:                  lien_necessary,
2283
+		BeforSymptoms:                  befor_symptoms,
1988 2284
 	}
1989 2285
 
1990 2286
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -1999,8 +2295,49 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1999 2295
 
2000 2296
 		}
2001 2297
 
2002
-		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
2298
+		// 查询信息规挡的设置天数
2299
+
2300
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2301
+		if infor.ID > 0 {
2003 2302
 
2303
+			var cha_time int64
2304
+
2305
+			timeNowStr := time.Now().Format("2006-01-02")
2306
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2307
+
2308
+			//今日的日期减去设置的日期
2309
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2310
+
2311
+			if cha_time >= recordDate.Unix() {
2312
+				//查询审核是否允许
2313
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
2314
+				//申请状态不允许的情况 拒绝修改
2315
+				if infor.ApplicationStatus != 1 {
2316
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2317
+					return
2318
+				}
2319
+
2320
+			}
2321
+		}
2322
+
2323
+		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
2324
+		//创建步骤表
2325
+		finish := models.XtDialysisFinish{
2326
+			IsFinish:   1,
2327
+			UserOrgId:  adminUserInfo.CurrentOrgId,
2328
+			Status:     1,
2329
+			Ctime:      time.Now().Unix(),
2330
+			Mtime:      0,
2331
+			Module:     3,
2332
+			RecordDate: recordDate.Unix(),
2333
+			Sourse:     1,
2334
+			PatientId:  patient,
2335
+		}
2336
+
2337
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 3, patient)
2338
+		if dialysisFinish.ID == 0 {
2339
+			service.CreateDialysisFinish(finish)
2340
+		}
2004 2341
 		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 {
2005 2342
 			var dewater_amount float64
2006 2343
 			dewater_amount = 0
@@ -2451,6 +2788,31 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2451 2788
 			}
2452 2789
 		}
2453 2790
 
2791
+		// 查询信息规挡的设置天数
2792
+
2793
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2794
+		if infor.ID > 0 {
2795
+
2796
+			var cha_time int64
2797
+
2798
+			timeNowStr := time.Now().Format("2006-01-02")
2799
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2800
+
2801
+			//今日的日期减去设置的日期
2802
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2803
+
2804
+			if cha_time >= recordDate.Unix() {
2805
+				//查询审核是否允许
2806
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
2807
+				//申请状态不允许的情况 拒绝修改
2808
+				if infor.ApplicationStatus != 1 {
2809
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2810
+					return
2811
+				}
2812
+
2813
+			}
2814
+		}
2815
+
2454 2816
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
2455 2817
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
2456 2818
 		redis := service.RedisClient()
@@ -2529,7 +2891,48 @@ func (c *DialysisApiController) PostTreatmentSummary() {
2529 2891
 	_, tempTreatmentSummary := service.FindTreatmentSummaryByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
2530 2892
 	if tempTreatmentSummary.ID == 0 { //新增
2531 2893
 		treatmentSummary.Creater = adminUserInfo.AdminUser.Id
2894
+
2895
+		// 查询信息规挡的设置天数
2896
+
2897
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2898
+		if infor.ID > 0 {
2899
+
2900
+			var cha_time int64
2901
+
2902
+			timeNowStr := time.Now().Format("2006-01-02")
2903
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2904
+
2905
+			//今日的日期减去设置的日期
2906
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2907
+
2908
+			if cha_time >= recordDate.Unix() {
2909
+				//查询审核是否允许
2910
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
2911
+				//申请状态不允许的情况 拒绝修改
2912
+				if infor.ApplicationStatus != 1 {
2913
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2914
+					return
2915
+				}
2916
+
2917
+			}
2918
+		}
2532 2919
 		err := service.AddSigleSummaryRecord(&treatmentSummary)
2920
+		finish := models.XtDialysisFinish{
2921
+			IsFinish:   1,
2922
+			UserOrgId:  adminUserInfo.CurrentOrgId,
2923
+			Status:     1,
2924
+			Ctime:      time.Now().Unix(),
2925
+			Mtime:      0,
2926
+			Module:     10,
2927
+			RecordDate: recordDate.Unix(),
2928
+			Sourse:     1,
2929
+			PatientId:  patient,
2930
+		}
2931
+
2932
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 10, patient)
2933
+		if dialysisFinish.ID == 0 {
2934
+			service.CreateDialysisFinish(finish)
2935
+		}
2533 2936
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summary"
2534 2937
 		redis := service.RedisClient()
2535 2938
 		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summarys_list_all"
@@ -3059,8 +3462,33 @@ func (this *DialysisApiController) DelMonitor() {
3059 3462
 	//		}
3060 3463
 	//	}
3061 3464
 	//}
3465
+	// 查询信息规挡的设置天数
3466
+
3467
+	infor, _ := service.GetDialysisInformationSetting(adminInfo.CurrentOrgId)
3468
+	if infor.ID > 0 {
3469
+
3470
+		var cha_time int64
3471
+
3472
+		timeNowStr := time.Now().Format("2006-01-02")
3473
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
3474
+
3475
+		//今日的日期减去设置的日期
3476
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3477
+
3478
+		if cha_time >= monitor.MonitoringDate {
3479
+			//查询审核是否允许
3480
+			infor, _ := service.GetDialysisInformationByRecordDate(patientID, monitor.MonitoringDate, adminInfo.CurrentOrgId)
3481
+			//申请状态不允许的情况 拒绝修改
3482
+			if infor.ApplicationStatus != 1 {
3483
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3484
+				return
3485
+			}
3486
+
3487
+		}
3488
+	}
3062 3489
 
3063 3490
 	err := service.DisableMonitor(adminInfo.CurrentOrgId, patientID, recordID, adminInfo.AdminUser.Id)
3491
+
3064 3492
 	key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(monitor.MonitoringDate, 10) + ":monitor_records"
3065 3493
 	redis := service.RedisClient()
3066 3494
 	//清空key 值
@@ -3181,7 +3609,49 @@ func (c *DialysisApiController) CreateMonitor() {
3181 3609
 		Dicarbonate:               dicarbonate,
3182 3610
 	}
3183 3611
 
3612
+	// 查询信息规挡的设置天数
3613
+
3614
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3615
+	if infor.ID > 0 {
3616
+
3617
+		var cha_time int64
3618
+
3619
+		timeNowStr := time.Now().Format("2006-01-02")
3620
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
3621
+
3622
+		//今日的日期减去设置的日期
3623
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3624
+
3625
+		if cha_time >= monitoring_date {
3626
+			//查询审核是否允许
3627
+			infor, _ := service.GetDialysisInformationByRecordDate(patient, monitoring_date, adminUserInfo.CurrentOrgId)
3628
+			//申请状态不允许的情况 拒绝修改
3629
+			if infor.ApplicationStatus != 1 {
3630
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3631
+				return
3632
+			}
3633
+
3634
+		}
3635
+	}
3636
+
3184 3637
 	err := service.CreateMonitor(&monitorRecord)
3638
+	finish := models.XtDialysisFinish{
3639
+		IsFinish:   1,
3640
+		UserOrgId:  adminUserInfo.CurrentOrgId,
3641
+		Status:     1,
3642
+		Ctime:      time.Now().Unix(),
3643
+		Mtime:      0,
3644
+		Module:     7,
3645
+		RecordDate: monitoring_date,
3646
+		Sourse:     1,
3647
+		PatientId:  patient,
3648
+	}
3649
+
3650
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, monitoring_date, 7, patient)
3651
+	if dialysisFinish.ID == 0 {
3652
+		service.CreateDialysisFinish(finish)
3653
+	}
3654
+
3185 3655
 	redis := service.RedisClient()
3186 3656
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(monitoring_date, 10) + ":monitor_record_list_all"
3187 3657
 
@@ -3579,6 +4049,11 @@ func (c *DialysisApiController) GetDialysisOrder() {
3579 4049
 
3580 4050
 	project_config, _ := service.GetHisProjectConfig(adminUserInfo.CurrentOrgId)
3581 4051
 	projects, _ := service.FindAllHisProjectById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4052
+
4053
+	//获取诊断
4054
+	prescriptionInfo, _ := service.GetPrescriptionInfo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4055
+
4056
+	patientDiagnose, _ := service.FindPatientDianose(adminUserInfo.CurrentOrgId)
3582 4057
 	//if config.IsOpen == 1 && project_config.IsOpen == 1 && len(projects) > 0 {
3583 4058
 	//	for _, item := range projects {
3584 4059
 	//		var advice *models.HisDoctorAdviceInfo
@@ -3634,6 +4109,8 @@ func (c *DialysisApiController) GetDialysisOrder() {
3634 4109
 			"last_order":                lastOrder,
3635 4110
 			"project_config":            project_config,
3636 4111
 			"projects":                  projects,
4112
+			"prescriptionInfo":          prescriptionInfo,
4113
+			"patientDiagnose":           patientDiagnose,
3637 4114
 		})
3638 4115
 
3639 4116
 	}
@@ -3671,6 +4148,8 @@ func (c *DialysisApiController) GetDialysisOrder() {
3671 4148
 			"last_order":                lastOrder,
3672 4149
 			"project_config":            project_config,
3673 4150
 			"projects":                  projects,
4151
+			"prescriptionInfo":          prescriptionInfo,
4152
+			"patientDiagnose":           patientDiagnose,
3674 4153
 		})
3675 4154
 	}
3676 4155
 
@@ -4035,10 +4514,12 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
4035 4514
 		return
4036 4515
 	}
4037 4516
 	theTimeUnix, err := time.ParseInLocation(timeLayout, startTime, loc)
4038
-	if err != nil {
4039
-		utils.ErrorLog(err.Error())
4040
-		return
4041
-	}
4517
+
4518
+	fmt.Println("theTimeUnix", theTimeUnix.Unix())
4519
+	//if err != nil {
4520
+	//	utils.ErrorLog(err.Error())
4521
+	//	return
4522
+	//}
4042 4523
 	StartTime := theTimeUnix.Unix()
4043 4524
 	fmt.Println("startTIME", StartTime)
4044 4525
 	Remark := ""
@@ -4058,7 +4539,11 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
4058 4539
 		var advice models.GroupAdvice
4059 4540
 		advice.Remark = Remark
4060 4541
 		advice.AdviceType = adviceType
4542
+
4061 4543
 		advice.StartTime = StartTime
4544
+		if StartTime < 0 {
4545
+			advice.StartTime = time.Now().Unix()
4546
+		}
4062 4547
 		advice.AdviceDate = AdviceDate
4063 4548
 
4064 4549
 		advice.RecordDate = RecordDate
@@ -4271,6 +4756,24 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
4271 4756
 	}
4272 4757
 
4273 4758
 	list, err := service.CreateMGroupAdvice(adminUserInfo.CurrentOrgId, advices, groupNo)
4759
+
4760
+	//创建步骤表
4761
+	finish := models.XtDialysisFinish{
4762
+		IsFinish:   1,
4763
+		UserOrgId:  adminUserInfo.CurrentOrgId,
4764
+		Status:     1,
4765
+		Ctime:      time.Now().Unix(),
4766
+		Mtime:      0,
4767
+		Module:     4,
4768
+		RecordDate: AdviceDate,
4769
+		Sourse:     1,
4770
+		PatientId:  patient,
4771
+	}
4772
+
4773
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, AdviceDate, 4, patient)
4774
+	if dialysisFinish.ID == 0 {
4775
+		service.CreateDialysisFinish(finish)
4776
+	}
4274 4777
 	redis := service.RedisClient()
4275 4778
 	formatAdviceDate := theTime.Format("2006-01-02")
4276 4779
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
@@ -6147,10 +6650,134 @@ func (this *DialysisApiController) GetDialysisInformationSetting() {
6147 6650
 
6148 6651
 	orgId := this.GetAdminUserInfo().CurrentOrgId
6149 6652
 
6150
-	informationSetting, _ := service.GetDialysisInformationSetting(orgId)
6653
+	limit, _ := this.GetInt64("limit")
6654
+	page, _ := this.GetInt64("page")
6655
+	informationSetting, _ := service.GetDialysisInformationSettingList(orgId)
6656
+
6657
+	//未审核
6658
+	infor, total, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 2)
6659
+
6660
+	//全部
6661
+	inforList, totalOne, _ := service.GetDialysisInformationIsNoCheckOne(orgId, limit, page, 1)
6662
+
6663
+	patients, _ := service.GetAllpatientThirty(orgId)
6664
+
6665
+	appId := this.GetAdminUserInfo().CurrentAppId
6666
+	role, _ := service.GetAllDoctorListSix(orgId, appId)
6151 6667
 
6152 6668
 	this.ServeSuccessJSON(map[string]interface{}{
6153 6669
 		"informaitonSetting": informationSetting,
6670
+		"infor":              infor,
6671
+		"total":              total,
6672
+		"totalOne":           totalOne,
6673
+		"inforList":          inforList,
6674
+		"patients":           patients,
6675
+		"adminList":          role,
6154 6676
 	})
6155 6677
 	return
6156 6678
 }
6679
+
6680
+func (this *DialysisApiController) CheckDialysisInformation() {
6681
+
6682
+	id, _ := this.GetInt64("id")
6683
+	application_status, _ := this.GetInt64("application_status")
6684
+	timeNow := time.Now().Unix()
6685
+	checker := this.GetAdminUserInfo().AdminUser.Id
6686
+	information, _ := service.CheckDialysisInformation(id, application_status, timeNow, checker)
6687
+	this.ServeSuccessJSON(map[string]interface{}{
6688
+		"information": information,
6689
+	})
6690
+	return
6691
+}
6692
+
6693
+func (this *DialysisApiController) GetDialysisPatientsFlow() {
6694
+
6695
+	page, _ := this.GetInt64("page", 1)
6696
+	limit, _ := this.GetInt64("limit", 10)
6697
+	schedulType, _ := this.GetInt64("schedul_type", 0)
6698
+	startTime, _ := this.GetInt64("schedul_time", 0)
6699
+	partitionType, _ := this.GetInt64("partition_type", 0)
6700
+	keywords := this.GetString("keywords")
6701
+	start_time, _ := this.GetInt64("start_time")
6702
+	end_time, _ := this.GetInt64("end_time")
6703
+	adminUserInfo := this.GetAdminUserInfo()
6704
+	if len(keywords) > 0 {
6705
+
6706
+		dialysisSchedule, err, total := service.GetDialysisWatchByKeywordFlow(adminUserInfo.CurrentOrgId, keywords, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6707
+		if err == nil {
6708
+			this.ServeSuccessJSON(map[string]interface{}{
6709
+				"schedule": dialysisSchedule,
6710
+				"total":    total,
6711
+			})
6712
+		} else {
6713
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6714
+		}
6715
+
6716
+	} else {
6717
+		dialysisSchedule, err, total := service.GetDialysisWatchFlow(adminUserInfo.CurrentOrgId, startTime/1000, schedulType, partitionType, page, limit, start_time/1000, end_time/1000)
6718
+		fmt.Println("dialysisSchedule-----------------------", dialysisSchedule)
6719
+		if err == nil {
6720
+			this.ServeSuccessJSON(map[string]interface{}{
6721
+				"schedule": dialysisSchedule,
6722
+				"total":    total,
6723
+			})
6724
+		} else {
6725
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6726
+		}
6727
+	}
6728
+}
6729
+
6730
+func (this *DialysisApiController) SaveInformation() {
6731
+
6732
+	patient_id, _ := this.GetInt64("patient_id")
6733
+	record_date, _ := this.GetInt64("record_date")
6734
+	adviceDate := this.GetString("selected_date")
6735
+	timeLayout2 := "2006-01-02"
6736
+	loc2, _ := time.LoadLocation("Local")
6737
+	theTime, _ := time.ParseInLocation(timeLayout2, adviceDate, loc2)
6738
+	AdviceDate := theTime.Unix()
6739
+
6740
+	module, _ := this.GetInt64("module")
6741
+
6742
+	remark := this.GetString("remark")
6743
+
6744
+	orgId := this.GetAdminUserInfo().CurrentOrgId
6745
+	creater := this.GetAdminUserInfo().AdminUser.Id
6746
+
6747
+	information := models.XtDialysisInformation{
6748
+		Module:            module,
6749
+		PatientId:         patient_id,
6750
+		RecordDate:        record_date,
6751
+		ApplicationDate:   AdviceDate,
6752
+		Creater:           creater,
6753
+		ApplicationStatus: 2,
6754
+		Checker:           0,
6755
+		CheckTime:         0,
6756
+		Remark:            remark,
6757
+		UserOrgId:         orgId,
6758
+		Ctime:             time.Now().Unix(),
6759
+		Status:            1,
6760
+		Mtime:             0,
6761
+	}
6762
+
6763
+	infor, _ := service.GetDialysisInoformationById(patient_id, record_date, orgId, module)
6764
+	if infor.ID == 0 {
6765
+		err := service.CreatedDialysisInformation(information)
6766
+		if err == nil {
6767
+			this.ServeSuccessJSON(map[string]interface{}{
6768
+				"information": information,
6769
+			})
6770
+			return
6771
+		}
6772
+	}
6773
+	if infor.ID > 0 {
6774
+		err := service.UpdateDialysisInformationById(patient_id, record_date, orgId, module, AdviceDate, remark)
6775
+		if err == nil {
6776
+			this.ServeSuccessJSON(map[string]interface{}{
6777
+				"information": information,
6778
+			})
6779
+			return
6780
+		}
6781
+	}
6782
+
6783
+}

+ 205 - 0
controllers/dialysis_record_api_controller.go Datei anzeigen

@@ -635,6 +635,31 @@ func (this *DialysisRecordAPIController) EditMonitor() {
635 635
 		orderID = dialysisOrder.ID
636 636
 	}
637 637
 
638
+	// 查询信息规挡的设置天数
639
+
640
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
641
+	if infor.ID > 0 {
642
+
643
+		var cha_time int64
644
+
645
+		timeNowStr := time.Now().Format("2006-01-02")
646
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
647
+
648
+		//今日的日期减去设置的日期
649
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
650
+
651
+		if cha_time >= scheduleDate {
652
+			//查询审核是否允许
653
+			infor, _ := service.GetDialysisInformationByRecordDate(patientID, scheduleDate, adminUserInfo.CurrentOrgId)
654
+			//申请状态不允许的情况 拒绝修改
655
+			if infor.ApplicationStatus != 1 {
656
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
657
+				return
658
+			}
659
+
660
+		}
661
+	}
662
+
638 663
 	if monitorParam.ID <= 0 { // 新建记录
639 664
 		monitor := models.MonitoringRecord{
640 665
 			UserOrgId:       adminUserInfo.CurrentOrgId,
@@ -693,6 +718,22 @@ func (this *DialysisRecordAPIController) EditMonitor() {
693 718
 			Dicarbonate:                 monitorParam.Dicarbonate,
694 719
 		}
695 720
 		createErr := service.CreateMonitor(&monitor)
721
+		finish := models.XtDialysisFinish{
722
+			IsFinish:   1,
723
+			UserOrgId:  adminUserInfo.CurrentOrgId,
724
+			Status:     1,
725
+			Ctime:      time.Now().Unix(),
726
+			Mtime:      0,
727
+			Module:     7,
728
+			RecordDate: monitorParam.MonitoringDate,
729
+			Sourse:     1,
730
+			PatientId:  patientID,
731
+		}
732
+
733
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, monitorParam.MonitoringDate, 7, patientID)
734
+		if dialysisFinish.ID == 0 {
735
+			service.CreateDialysisFinish(finish)
736
+		}
696 737
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":monitor_records"
697 738
 		redis := service.RedisClient()
698 739
 		//清空key 值
@@ -1011,6 +1052,30 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1011 1052
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1012 1053
 		return
1013 1054
 	}
1055
+	// 查询信息规挡的设置天数
1056
+
1057
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1058
+	if infor.ID > 0 {
1059
+
1060
+		var cha_time int64
1061
+
1062
+		timeNowStr := time.Now().Format("2006-01-02")
1063
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1064
+
1065
+		//今日的日期减去设置的日期
1066
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1067
+
1068
+		if cha_time >= recordDate.Unix() {
1069
+			//查询审核是否允许
1070
+			infor, _ := service.GetDialysisInformationByRecordDate(patientID, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1071
+			//申请状态不允许的情况 拒绝修改
1072
+			if infor.ApplicationStatus != 1 {
1073
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1074
+				return
1075
+			}
1076
+
1077
+		}
1078
+	}
1014 1079
 
1015 1080
 	dialysisRecord = &models.DialysisOrder{
1016 1081
 		DialysisDate:           recordDate.Unix(),
@@ -1044,6 +1109,23 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1044 1109
 	}
1045 1110
 
1046 1111
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
1112
+
1113
+	finish := models.XtDialysisFinish{
1114
+		IsFinish:   1,
1115
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1116
+		Status:     1,
1117
+		Ctime:      time.Now().Unix(),
1118
+		Mtime:      0,
1119
+		Module:     6,
1120
+		RecordDate: recordDate.Unix(),
1121
+		Sourse:     1,
1122
+		PatientId:  patientID,
1123
+	}
1124
+
1125
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 6, patientID)
1126
+	if dialysisFinish.ID == 0 {
1127
+		service.CreateDialysisFinish(finish)
1128
+	}
1047 1129
 	//更新患者表排班备注
1048 1130
 	service.UpdateMobilePatient(adminUserInfo.CurrentOrgId, patientID, schedule_remark)
1049 1131
 
@@ -1218,6 +1300,23 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1218 1300
 			}
1219 1301
 
1220 1302
 			err := service.CreateMonitor(&record)
1303
+
1304
+			finish := models.XtDialysisFinish{
1305
+				IsFinish:   1,
1306
+				UserOrgId:  adminUserInfo.CurrentOrgId,
1307
+				Status:     1,
1308
+				Ctime:      time.Now().Unix(),
1309
+				Mtime:      0,
1310
+				Module:     7,
1311
+				RecordDate: recordDate.Unix(),
1312
+				Sourse:     1,
1313
+				PatientId:  patientID,
1314
+			}
1315
+
1316
+			dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 7, patientID)
1317
+			if dialysisFinish.ID == 0 {
1318
+				service.CreateDialysisFinish(finish)
1319
+			}
1221 1320
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
1222 1321
 
1223 1322
 			redis := service.RedisClient()
@@ -1491,6 +1590,23 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1491 1590
 
1492 1591
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1493 1592
 
1593
+	finishS := models.XtDialysisFinish{
1594
+		IsFinish:   1,
1595
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1596
+		Status:     1,
1597
+		Ctime:      time.Now().Unix(),
1598
+		Mtime:      0,
1599
+		Module:     9,
1600
+		RecordDate: recordDate.Unix(),
1601
+		Sourse:     1,
1602
+		PatientId:  patientID,
1603
+	}
1604
+
1605
+	dialysisFinishs, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 9, patientID)
1606
+	if dialysisFinishs.ID == 0 {
1607
+		service.CreateDialysisFinish(finishS)
1608
+	}
1609
+
1494 1610
 	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 9829 || adminUserInfo.CurrentOrgId == 10440 {
1495 1611
 
1496 1612
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
@@ -1572,8 +1688,49 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1572 1688
 		http.PostForm(api, values)
1573 1689
 	}()
1574 1690
 
1691
+	// 查询信息规挡的设置天数
1692
+
1693
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1694
+	if infor.ID > 0 {
1695
+
1696
+		var cha_time int64
1697
+
1698
+		timeNowStr := time.Now().Format("2006-01-02")
1699
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1700
+
1701
+		//今日的日期减去设置的日期
1702
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1703
+
1704
+		if cha_time >= recordDate.Unix() {
1705
+			//查询审核是否允许
1706
+			infor, _ := service.GetDialysisInformationByRecordDate(patientID, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1707
+			//申请状态不允许的情况 拒绝修改
1708
+			if infor.ApplicationStatus != 1 {
1709
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1710
+				return
1711
+			}
1712
+
1713
+		}
1714
+	}
1715
+
1575 1716
 	//执行下机
1576 1717
 	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
1718
+	finish := models.XtDialysisFinish{
1719
+		IsFinish:   1,
1720
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1721
+		Status:     1,
1722
+		Ctime:      time.Now().Unix(),
1723
+		Mtime:      0,
1724
+		Module:     8,
1725
+		RecordDate: recordDate.Unix(),
1726
+		Sourse:     1,
1727
+		PatientId:  patientID,
1728
+	}
1729
+
1730
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 8, patientID)
1731
+	if dialysisFinish.ID == 0 {
1732
+		service.CreateDialysisFinish(finish)
1733
+	}
1577 1734
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1578 1735
 	redis := service.RedisClient()
1579 1736
 	defer redis.Close()
@@ -1794,6 +1951,29 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1794 1951
 		CatheterOperation:      catheter_operation,
1795 1952
 	}
1796 1953
 
1954
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1955
+	if infor.ID > 0 {
1956
+
1957
+		var cha_time int64
1958
+
1959
+		timeNowStr := time.Now().Format("2006-01-02")
1960
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1961
+
1962
+		//今日的日期减去设置的日期
1963
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1964
+
1965
+		if cha_time >= tempDialysisRecord.DialysisDate {
1966
+			//查询审核是否允许
1967
+			infor, _ := service.GetDialysisInformationByRecordDate(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate, adminUserInfo.CurrentOrgId)
1968
+			//申请状态不允许的情况 拒绝修改
1969
+			if infor.ApplicationStatus != 1 {
1970
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1971
+				return
1972
+			}
1973
+
1974
+		}
1975
+	}
1976
+
1797 1977
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
1798 1978
 
1799 1979
 	order, _ := service.GetLastPatientOrder(record_id)
@@ -1926,6 +2106,31 @@ func (c *DialysisRecordAPIController) ModifyFinishDialysis() {
1926 2106
 	}
1927 2107
 
1928 2108
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)
2109
+
2110
+	// 查询信息规挡的设置天数
2111
+
2112
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2113
+	if infor.ID > 0 {
2114
+
2115
+		var cha_time int64
2116
+
2117
+		timeNowStr := time.Now().Format("2006-01-02")
2118
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2119
+
2120
+		//今日的日期减去设置的日期
2121
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2122
+
2123
+		if cha_time >= tempDialysisRecords.DialysisDate {
2124
+			//查询审核是否允许
2125
+			infor, _ := service.GetDialysisInformationByRecordDate(tempDialysisRecords.PatientId, tempDialysisRecords.DialysisDate, adminUserInfo.CurrentOrgId)
2126
+			//申请状态不允许的情况 拒绝修改
2127
+			if infor.ApplicationStatus != 1 {
2128
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2129
+				return
2130
+			}
2131
+
2132
+		}
2133
+	}
1929 2134
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(tempDialysisRecords.PatientId, 10) + ":" + strconv.FormatInt(tempDialysisRecords.DialysisDate, 10) + ":dialysis_order"
1930 2135
 	redis := service.RedisClient()
1931 2136
 	defer redis.Close()

+ 3 - 1
controllers/drug_stock_api_contorller.go Datei anzeigen

@@ -3538,8 +3538,10 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3538 3538
 	warehousing_id, _ := c.GetInt64("warehousing_id")
3539 3539
 	orgId := c.GetAdminUserInfo().CurrentOrgId
3540 3540
 	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
3541
+
3542
+	checker := c.GetAdminUserInfo().AdminUser.Id
3541 3543
 	//更改核对状态
3542
-	err := service.CheckWarehousingInfo(warehousing_id, orgId)
3544
+	err := service.CheckWarehousingInfo(warehousing_id, orgId, checker)
3543 3545
 
3544 3546
 	if err == nil {
3545 3547
 		list, _ := service.GetWarehousingInfoByList(warehousing_id, orgId)

+ 12 - 2
controllers/his_api_controller.go Datei anzeigen

@@ -1461,6 +1461,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1461 1461
 		diagnose, _ := service.FindAllDiagnose(adminInfo.CurrentOrgId)
1462 1462
 		additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
1463 1463
 
1464
+		patientDiagnose, _ := service.FindPatientDianose(adminInfo.CurrentOrgId)
1464 1465
 		//获取是否开启保存耗材出库的开关
1465 1466
 		goodOutOpen, _ := service.GetGoodOutOpenConfigOne(adminInfo.CurrentOrgId)
1466 1467
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -1475,6 +1476,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1475 1476
 			"diagnose":         diagnose,
1476 1477
 			"manufacturers":    manufacturers,
1477 1478
 			"goodOutOpen":      goodOutOpen,
1479
+			"patientDiagnose":  patientDiagnose,
1478 1480
 		})
1479 1481
 	}
1480 1482
 	if adminInfo.CurrentOrgId != 9675 && adminInfo.CurrentOrgId != 9671 && adminInfo.CurrentOrgId != 10215 {
@@ -1507,7 +1509,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1507 1509
 		additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
1508 1510
 		//获取是否开启保存耗材出库的开关
1509 1511
 		goodOutOpen, _ := service.GetGoodOutOpenConfigOne(adminInfo.CurrentOrgId)
1510
-
1512
+		patientDiagnose, _ := service.FindPatientDianose(adminInfo.CurrentOrgId)
1511 1513
 		c.ServeSuccessJSON(map[string]interface{}{
1512 1514
 			"drugs":            drugs,
1513 1515
 			"advices_template": advices,
@@ -1520,6 +1522,7 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
1520 1522
 			"diagnose":         diagnose,
1521 1523
 			"manufacturers":    manufacturers,
1522 1524
 			"goodOutOpen":      goodOutOpen,
1525
+			"patientDiagnose":  patientDiagnose,
1523 1526
 		})
1524 1527
 	}
1525 1528
 }
@@ -1536,6 +1539,8 @@ func (c *HisApiController) CreateHisPrescription() {
1536 1539
 	his_patient_id, _ := c.GetInt64("his_patient_id")
1537 1540
 
1538 1541
 	p_type, _ := c.GetInt64("p_type")
1542
+	patient_diagnose := c.GetString("patient_diagnose")
1543
+
1539 1544
 	dataBody := make(map[string]interface{}, 0)
1540 1545
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1541 1546
 	if err != nil {
@@ -2628,6 +2633,7 @@ func (c *HisApiController) CreateHisPrescription() {
2628 2633
 			DoctorId:           doctor_id,
2629 2634
 			SickType:           sick_type,
2630 2635
 			PType:              p_type,
2636
+			PatientDiagnosis:   patient_diagnose,
2631 2637
 		}
2632 2638
 		service.SavePatientPrescriptionInfo(hpInfo)
2633 2639
 		redis := service.RedisClient()
@@ -2660,6 +2666,7 @@ func (c *HisApiController) CreateHisPrescription() {
2660 2666
 			SickType:           sick_type,
2661 2667
 			PType:              info.PType,
2662 2668
 			HisPatientId:       info.HisPatientId,
2669
+			PatientDiagnosis:   patient_diagnose,
2663 2670
 		}
2664 2671
 		service.SavePatientPrescriptionInfo(hpInfo)
2665 2672
 		redis := service.RedisClient()
@@ -3004,6 +3011,8 @@ func (c *HisApiController) CreateHisPrescription() {
3004 3011
 
3005 3012
 		//查询今日该患者开的药品处方
3006 3013
 		hisdoctorlist, _ := service.GetHisAdviceListByDrugIdTwo(patient_id, recordDateTime, adminInfo.CurrentOrgId)
3014
+
3015
+		fmt.Println("今日出库2333333333333333333333333333333333333333")
3007 3016
 		drugOutConfig, _ := service.GetDrugOpenConfigOne(adminInfo.CurrentOrgId)
3008 3017
 		//药品出库
3009 3018
 		if drugOutConfig.IsOpen == 1 {
@@ -3012,7 +3021,7 @@ func (c *HisApiController) CreateHisPrescription() {
3012 3021
 
3013 3022
 				// 查询该药品最后一次出库记录
3014 3023
 				druginfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(item.DrugId, patient_id, recordDateTime, item.ID)
3015
-
3024
+				fmt.Println("今日最后出库2333333333333333333333333333333333333333", druginfo)
3016 3025
 				if len(druginfo) > 0 {
3017 3026
 					//回退库存
3018 3027
 					for _, it := range druginfo {
@@ -3023,6 +3032,7 @@ func (c *HisApiController) CreateHisPrescription() {
3023 3032
 
3024 3033
 						}
3025 3034
 						if it.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
3035
+
3026 3036
 							service.ModifyDrugWarehouseInfoStockMinNumber(it.Count, it.DrugId, it.OrgId, it.WarehouseInfoId)
3027 3037
 
3028 3038
 						}

+ 3 - 4
controllers/manage_api_controller.go Datei anzeigen

@@ -957,16 +957,16 @@ func (this *MachineApiController) GetPatient() {
957 957
 func (this *MachineApiController) GetAllOrganization() {
958 958
 	adminUserInfo := this.GetAdminUserInfo()
959 959
 	orgid := adminUserInfo.CurrentOrgId
960
-	//fmt.Println("orgid", orgid)
961 960
 	appid := adminUserInfo.CurrentAppId
962
-	//fmt.Println("appid", appid)
963 961
 	approle, err := service.GetAllOrganization(orgid, appid)
962
+	operators, err := service.GetAdminUserEsOne(adminUserInfo.CurrentOrgId)
964 963
 	if err != nil {
965 964
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
966 965
 		return
967 966
 	}
968 967
 	this.ServeSuccessJSON(map[string]interface{}{
969
-		"approle": approle,
968
+		"approle":   approle,
969
+		"operators": operators,
970 970
 	})
971 971
 }
972 972
 
@@ -2670,7 +2670,6 @@ func (this *MachineApiController) GetBedForm() {
2670 2670
 	fmt.Println("id", id)
2671 2671
 	addmacher, err := service.GetZoneForm(id)
2672 2672
 	bed, err := service.GetZoneId(addmacher.BedId, orgId)
2673
-	fmt.Println("bed--------------------", bed.ZoneID)
2674 2673
 	number, err := service.GetBedForm(bed.ZoneID)
2675 2674
 	if err != nil {
2676 2675
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")

+ 101 - 1
controllers/manager_center_api_controller.go Datei anzeigen

@@ -83,6 +83,11 @@ func ManagerCenterRegistRouters() {
83 83
 	beego.Router("/api/drug/getalldruglist", &ManagerCenterApiController{}, "get:GetAllDrugList")
84 84
 	beego.Router("/api/drug/postsearchdruglist", &ManagerCenterApiController{}, "get:GetSearchDrugList")
85 85
 
86
+	beego.Router("/api/patient/addpatientdiagnose", &ManagerCenterApiController{}, "Post:AddPatientDiagnos")
87
+	beego.Router("/api/patient/getpatientdiagnose", &ManagerCenterApiController{}, "Get:GetPatientDiagnose")
88
+	beego.Router("/api/patient/getpatientdiagnosedetail", &ManagerCenterApiController{}, "Get:GetPatientDiagnoseDetail")
89
+	beego.Router("/api/patient/updatepatientcase", &ManagerCenterApiController{}, "Post:UpdatePatientCase")
90
+	beego.Router("/api/patient/deletepatientdiagnose", &ManagerCenterApiController{}, "Get:DeletePatientDiagnose")
86 91
 }
87 92
 
88 93
 func (c *ManagerCenterApiController) CreateBaseDrugLib() {
@@ -825,7 +830,7 @@ func (c *ManagerCenterApiController) UpdateChildConfig() {
825 830
 	dataconfig.Remark = string(dataBody["remark"].(string))
826 831
 	dataconfig.Order = int64(dataBody["orders"].(float64))
827 832
 	dataconfig.Code = string(dataBody["code"].(string))
828
-	fmt.Println("dataconfitg------", dataconfig.Order)
833
+
829 834
 	//if dataBody["orders"] != nil {
830 835
 	//	dataconfig.Order = int64(dataBody["orders"].(float64))
831 836
 	//	fmt.Println("dataconfig",dataconfig.Order)
@@ -2314,3 +2319,98 @@ func (c *ManagerCenterApiController) GetSearchDrugList() {
2314 2319
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2315 2320
 	}
2316 2321
 }
2322
+
2323
+func (c *ManagerCenterApiController) AddPatientDiagnos() {
2324
+
2325
+	dataBody := make(map[string]interface{}, 0)
2326
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
2327
+
2328
+	class_name := dataBody["class_name"].(string)
2329
+	sort := int64(dataBody["sort"].(float64))
2330
+
2331
+	orgId := c.GetAdminUserInfo().CurrentOrgId
2332
+	diagnose := models.XtPatientDiagnose{
2333
+		ClassName: class_name,
2334
+		Sort:      sort,
2335
+		UserOrgId: orgId,
2336
+		Status:    1,
2337
+		Ctime:     time.Now().Unix(),
2338
+		Mtime:     0,
2339
+	}
2340
+
2341
+	err = service.CreatePatientDiagnose(diagnose)
2342
+
2343
+	if err == nil {
2344
+		c.ServeSuccessJSON(map[string]interface{}{
2345
+			"diagnose": diagnose,
2346
+		})
2347
+	} else {
2348
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2349
+	}
2350
+}
2351
+
2352
+func (c *ManagerCenterApiController) GetPatientDiagnose() {
2353
+
2354
+	limit, _ := c.GetInt64("limit")
2355
+	page, _ := c.GetInt64("page")
2356
+	orgId := c.GetAdminUserInfo().CurrentOrgId
2357
+
2358
+	list, total, err := service.GetPatientDiagnose(limit, page, orgId)
2359
+
2360
+	if err == nil {
2361
+		c.ServeSuccessJSON(map[string]interface{}{
2362
+			"list":  list,
2363
+			"total": total,
2364
+		})
2365
+	} else {
2366
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2367
+	}
2368
+}
2369
+
2370
+func (c *ManagerCenterApiController) GetPatientDiagnoseDetail() {
2371
+
2372
+	id, _ := c.GetInt64("id")
2373
+
2374
+	detail, err := service.GetPatientDiagnoseDetail(id)
2375
+
2376
+	if err == nil {
2377
+		c.ServeSuccessJSON(map[string]interface{}{
2378
+			"detail": detail,
2379
+		})
2380
+	} else {
2381
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2382
+	}
2383
+}
2384
+
2385
+func (c *ManagerCenterApiController) UpdatePatientCase() {
2386
+
2387
+	dataBody := make(map[string]interface{}, 0)
2388
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
2389
+
2390
+	class_name := dataBody["class_name"].(string)
2391
+	sort := int64(dataBody["sort"].(float64))
2392
+
2393
+	id := int64(dataBody["id"].(float64))
2394
+
2395
+	err = service.UpdatePatientCase(class_name, sort, id)
2396
+
2397
+	if err == nil {
2398
+		c.ServeSuccessJSON(map[string]interface{}{
2399
+			"msg": "msg",
2400
+		})
2401
+	} else {
2402
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2403
+	}
2404
+}
2405
+
2406
+func (c *ManagerCenterApiController) DeletePatientDiagnose() {
2407
+
2408
+	id, _ := c.GetInt64("id")
2409
+
2410
+	service.DeletePatientDiagnose(id)
2411
+
2412
+	returnData := make(map[string]interface{}, 0)
2413
+	returnData["msg"] = "ok"
2414
+	c.ServeSuccessJSON(returnData)
2415
+	return
2416
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 723 - 17
controllers/mobile_api_controllers/dialysis_api_controller.go


+ 90 - 1
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Datei anzeigen

@@ -119,6 +119,30 @@ func (this *DialysisAPIController) AddMonitorRecord() {
119 119
 		return
120 120
 	}
121 121
 
122
+	// 查询信息规挡的设置天数
123
+
124
+	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
125
+	if infor.ID > 0 {
126
+
127
+		var cha_time int64
128
+
129
+		timeNowStr := time.Now().Format("2006-01-02")
130
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
131
+
132
+		//今日的日期减去设置的日期
133
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
134
+
135
+		if cha_time >= date {
136
+			//查询审核是否允许
137
+			infor, _ := service.GetDialysisInformationByRecordDate(patientID, date, adminInfo.Org.Id)
138
+			//申请状态不允许的情况 拒绝修改
139
+			if infor.ApplicationStatus != 1 {
140
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
141
+				return
142
+			}
143
+
144
+		}
145
+	}
122 146
 	record := models.MonitoringRecord{
123 147
 		UserOrgId:       adminInfo.Org.Id,
124 148
 		PatientId:       patientID,
@@ -179,6 +203,22 @@ func (this *DialysisAPIController) AddMonitorRecord() {
179 203
 	}
180 204
 
181 205
 	err := service.CreateMonitor(&record)
206
+	finish := models.XtDialysisFinish{
207
+		IsFinish:   1,
208
+		UserOrgId:  record.UserOrgId,
209
+		Status:     1,
210
+		Ctime:      time.Now().Unix(),
211
+		Mtime:      0,
212
+		Module:     7,
213
+		RecordDate: record.MonitoringDate,
214
+		Sourse:     1,
215
+		PatientId:  patientID,
216
+	}
217
+
218
+	dialysisFinish, err := service.GetDialysisFinish(record.UserOrgId, record.MonitoringDate, 7, patientID)
219
+	if dialysisFinish.ID == 0 {
220
+		service.CreateDialysisFinish(finish)
221
+	}
182 222
 	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_records"
183 223
 	redis := service.RedisClient()
184 224
 	//清空key 值
@@ -351,6 +391,31 @@ func (this *DialysisAPIController) EditMonitorRecord() {
351 391
 	monitor.HeparinAmount = heparin_amount
352 392
 	monitor.Dehydration = dehydration
353 393
 	monitor.FilterPressure = filter_pressure
394
+
395
+	// 查询信息规挡的设置天数
396
+
397
+	infor, _ := service.GetDialysisInformationSetting(monitor.MonitoringDate)
398
+	if infor.ID > 0 {
399
+
400
+		var cha_time int64
401
+
402
+		timeNowStr := time.Now().Format("2006-01-02")
403
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
404
+
405
+		//今日的日期减去设置的日期
406
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
407
+
408
+		if cha_time >= monitor.MonitoringDate {
409
+			//查询审核是否允许
410
+			infor, _ := service.GetDialysisInformationByRecordDate(id, monitor.MonitoringDate, monitor.UserOrgId)
411
+			//申请状态不允许的情况 拒绝修改
412
+			if infor.ApplicationStatus != 1 {
413
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
414
+				return
415
+			}
416
+
417
+		}
418
+	}
354 419
 	monitor.ReplacementSpeed = replacement_speed
355 420
 	monitor.Dicarbonate = dicarbonate
356 421
 	err = service.UpdateMonitor(monitor)
@@ -399,6 +464,31 @@ func (this *DialysisAPIController) DeleteMonitor() {
399 464
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
400 465
 		return
401 466
 	}
467
+
468
+	// 查询信息规挡的设置天数
469
+
470
+	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
471
+	if infor.ID > 0 {
472
+
473
+		var cha_time int64
474
+
475
+		timeNowStr := time.Now().Format("2006-01-02")
476
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
477
+
478
+		//今日的日期减去设置的日期
479
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
480
+
481
+		if cha_time >= monitor.MonitoringDate {
482
+			//查询审核是否允许
483
+			infor, _ := service.GetDialysisInformationByRecordDate(monitor.PatientId, monitor.MonitoringDate, monitor.UserOrgId)
484
+			//申请状态不允许的情况 拒绝修改
485
+			if infor.ApplicationStatus != 1 {
486
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
487
+				return
488
+			}
489
+
490
+		}
491
+	}
402 492
 	err := service.DisableMonitor(adminInfo.Org.Id, patientID, recordID, adminInfo.AdminUser.Id)
403 493
 	orgid := this.GetMobileAdminUserInfo().Org.Id
404 494
 	redis := service.RedisClient()
@@ -406,7 +496,6 @@ func (this *DialysisAPIController) DeleteMonitor() {
406 496
 	redis.Set(key, "", time.Second)
407 497
 	keyOne := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(monitor.MonitoringDate, 10) + ":monitor_records"
408 498
 	redis.Set(keyOne, "", time.Second)
409
-	fmt.Println("keyo呢32332322332332232332", keyOne)
410 499
 	redis.Close()
411 500
 
412 501
 	if err != nil {

+ 8 - 3
controllers/mobile_api_controllers/mobile_api_base_controller.go Datei anzeigen

@@ -143,19 +143,23 @@ func (this *MobileBaseAPIAuthController) Prepare() {
143 143
 
144 144
 			//redis key值
145 145
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
146
+			fmt.Println("ket--------------------", key)
147
+
148
+			redis.Set(key, "", time.Second)
146 149
 			purviews_json_str, _ := redis.Get(key).Result()
147 150
 			//获取该用户下所有角色的权限总集
148 151
 			var userRolePurviews string
149 152
 			var userRolePurviewsArr []string
150 153
 
151
-			fmt.Println("----redis 开始----")
152
-			fmt.Println(purviews_json_str)
153
-			fmt.Println("----redis 结束----")
154
+			//fmt.Println("----redis 开始----")
155
+			//fmt.Println(purviews_json_str)
156
+			//fmt.Println("----redis 结束----")
154 157
 
155 158
 			if len(purviews_json_str) == 0 {
156 159
 				for _, item := range roles {
157 160
 					role_id, _ := strconv.ParseInt(item, 10, 64)
158 161
 					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
162
+
159 163
 					if len(userRolePurviews) == 0 {
160 164
 						userRolePurviews = purviews
161 165
 					} else {
@@ -183,6 +187,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
183 187
 
184 188
 			//系统所记录的权限列表
185 189
 			allPermission, _ := service.GetAllFunctionPurview()
190
+
186 191
 			for _, item := range allPermission {
187 192
 				//判断当前路由是否在权限路由列表里面
188 193
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {

+ 9 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Datei anzeigen

@@ -190,4 +190,13 @@ func MobileAPIControllersRegisterRouters() {
190 190
 	beego.Router("/m/api/checkmobileadvice", &DialysisAPIController{}, "Get:GetCheckMobileAdvice")
191 191
 
192 192
 	beego.Router("/m/api/getnewdoctorlisttoday", &DialysisAPIController{}, "Get:GetNewDoctorListToday")
193
+
194
+	beego.Router("/m/api/savemobileinformation", &DialysisAPIController{}, "Get:SaveMobileInformation")
195
+
196
+	beego.Router("/m/api/getmobileinformation", &DialysisAPIController{}, "Get:GetMobileInformation")
197
+
198
+	beego.Router("/m/api/getmobileinformationone", &DialysisAPIController{}, "Get:GetMobileInformationOne")
199
+
200
+	beego.Router("/m/api/checkmobileinformation", &DialysisAPIController{}, "Get:CheckMobileInformation")
201
+
193 202
 }

+ 630 - 3
controllers/mobile_api_controllers/patient_api_controller.go Datei anzeigen

@@ -310,6 +310,31 @@ func (c *PatientApiController) EditDoctorAdvice() {
310 310
 		adviceSlice, _ := service.FindAdviceByGoroupNo(adminUserInfo.Org.Id, advice.GroupNo)
311 311
 		sourceAdvice, _ := service.FindOldDoctorAdvice(adminUserInfo.Org.Id, advice.ID)
312 312
 		if len(adviceSlice) == 1 {
313
+
314
+			// 查询信息规挡的设置天数
315
+
316
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
317
+			if infor.ID > 0 {
318
+
319
+				var cha_time int64
320
+
321
+				timeNowStr := time.Now().Format("2006-01-02")
322
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
323
+
324
+				//今日的日期减去设置的日期
325
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
326
+
327
+				if cha_time >= sourceAdvice.AdviceDate {
328
+					//查询审核是否允许
329
+					infor, _ := service.GetDialysisInformationByRecordDate(id, sourceAdvice.AdviceDate, adminUserInfo.Org.Id)
330
+					//申请状态不允许的情况 拒绝修改
331
+					if infor.ApplicationStatus != 1 {
332
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
333
+						return
334
+					}
335
+
336
+				}
337
+			}
313 338
 			//判断前端上传上来的开始时间和数据库中想要修改的那条医嘱的开始时间是否相同,如果不同,需要修改子医嘱的开始时间,如果相同直接修改,不需要修改子医嘱的开始时间
314 339
 			if advice.StartTime == sourceAdvice.StartTime {
315 340
 				err = service.UpdateDoctorAdvice(&advice)
@@ -331,7 +356,28 @@ func (c *PatientApiController) EditDoctorAdvice() {
331 356
 				redis.Set(keyOne, "", time.Second)
332 357
 			}
333 358
 		} else if len(adviceSlice) > 1 {
359
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
360
+			if infor.ID > 0 {
361
+
362
+				var cha_time int64
363
+
364
+				timeNowStr := time.Now().Format("2006-01-02")
365
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
366
+
367
+				//今日的日期减去设置的日期
368
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
369
+
370
+				if cha_time >= sourceAdvice.AdviceDate {
371
+					//查询审核是否允许
372
+					infor, _ := service.GetDialysisInformationByRecordDate(id, sourceAdvice.AdviceDate, adminUserInfo.Org.Id)
373
+					//申请状态不允许的情况 拒绝修改
374
+					if infor.ApplicationStatus != 1 {
375
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
376
+						return
377
+					}
334 378
 
379
+				}
380
+			}
335 381
 			//判断前端上传上来的开始时间和数据库中想要修改的那条医嘱的开始时间是否相同,如果不同,需要重新分配组,如果相同直接修改,不需要分配组
336 382
 			if advice.StartTime == sourceAdvice.StartTime {
337 383
 				err = service.UpdateDoctorAdvice(&advice)
@@ -359,6 +405,28 @@ func (c *PatientApiController) EditDoctorAdvice() {
359 405
 			}
360 406
 		}
361 407
 	} else {
408
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
409
+		if infor.ID > 0 {
410
+
411
+			var cha_time int64
412
+
413
+			timeNowStr := time.Now().Format("2006-01-02")
414
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
415
+
416
+			//今日的日期减去设置的日期
417
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
418
+
419
+			if cha_time >= advice.AdviceDate {
420
+				//查询审核是否允许
421
+				infor, _ := service.GetDialysisInformationByRecordDate(id, advice.AdviceDate, adminUserInfo.Org.Id)
422
+				//申请状态不允许的情况 拒绝修改
423
+				if infor.ApplicationStatus != 1 {
424
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
425
+					return
426
+				}
427
+
428
+			}
429
+		}
362 430
 		isChangeGroup = false
363 431
 		err = service.UpdateDoctorAdvice(&advice)
364 432
 		redis := service.RedisClient()
@@ -382,6 +450,7 @@ func (c *PatientApiController) EditDoctorAdvice() {
382 450
 		})
383 451
 
384 452
 	} else {
453
+
385 454
 		newGroupAdvice, err := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, advice.GroupNo)
386 455
 		if err != nil {
387 456
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -552,6 +621,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
552 621
 	origin, _ := c.GetInt64("origin", 0)
553 622
 	groupno, _ := c.GetInt64("groupno", -1)
554 623
 
624
+	record_date, _ := c.GetInt64("record_date")
625
+
555 626
 	if origin != 2 {
556 627
 		adminUserInfo := c.GetMobileAdminUserInfo()
557 628
 		execution_staff := adminUserInfo.AdminUser.Id
@@ -619,7 +690,34 @@ func (c *PatientApiController) ExecDoctorAdvice() {
619 690
 			UpdatedTime:    time.Now().Unix(),
620 691
 		}
621 692
 		var err error
693
+
622 694
 		if groupno > 0 {
695
+
696
+			// 查询信息规挡的设置天数
697
+
698
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
699
+			if infor.ID > 0 {
700
+
701
+				var cha_time int64
702
+
703
+				timeNowStr := time.Now().Format("2006-01-02")
704
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
705
+
706
+				//今日的日期减去设置的日期
707
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
708
+				fmt.Println("cha_time----------------", cha_time)
709
+				fmt.Println("advices.232323232222", record_date)
710
+				if cha_time >= record_date {
711
+					//查询审核是否允许
712
+					infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id)
713
+					//申请状态不允许的情况 拒绝修改
714
+					if infor.ApplicationStatus != 1 {
715
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
716
+						return
717
+					}
718
+
719
+				}
720
+			}
623 721
 			err = service.ExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
624 722
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
625 723
 			redis := service.RedisClient()
@@ -642,7 +740,30 @@ func (c *PatientApiController) ExecDoctorAdvice() {
642 740
 
643 741
 			defer redis.Close()
644 742
 		} else {
743
+			// 查询信息规挡的设置天数
744
+
745
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
746
+			if infor.ID > 0 {
747
+
748
+				var cha_time int64
749
+
750
+				timeNowStr := time.Now().Format("2006-01-02")
751
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
752
+
753
+				//今日的日期减去设置的日期
754
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
755
+
756
+				if cha_time >= record_date {
757
+					//查询审核是否允许
758
+					infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id)
759
+					//申请状态不允许的情况 拒绝修改
760
+					if infor.ApplicationStatus != 1 {
761
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
762
+						return
763
+					}
645 764
 
765
+				}
766
+			}
646 767
 			err = service.BatchExceOldDoctorAdvice(&advices, ids)
647 768
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
648 769
 			redis := service.RedisClient()
@@ -1132,6 +1253,31 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1132 1253
 			item.ExecutionStaff = adminInfo.AdminUser.Id
1133 1254
 			item.ExecutionTime = theTime.Unix()
1134 1255
 			item.IsMobile = 1
1256
+
1257
+			// 查询信息规挡的设置天数
1258
+
1259
+			infor, _ := service.GetDialysisInformationSetting(item.UserOrgId)
1260
+			if infor.ID > 0 {
1261
+
1262
+				var cha_time int64
1263
+
1264
+				timeNowStr := time.Now().Format("2006-01-02")
1265
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1266
+
1267
+				//今日的日期减去设置的日期
1268
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1269
+
1270
+				if cha_time >= item.AdviceDate {
1271
+					//查询审核是否允许
1272
+					infor, _ := service.GetDialysisInformationByRecordDate(item.PatientId, item.AdviceDate, item.UserOrgId)
1273
+					//申请状态不允许的情况 拒绝修改
1274
+					if infor.ApplicationStatus != 1 {
1275
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1276
+						return
1277
+					}
1278
+
1279
+				}
1280
+			}
1135 1281
 			err = service.SaveHisDoctorAdvice(item)
1136 1282
 			if err == nil {
1137 1283
 				drugError := models.XtDrugError{
@@ -1445,7 +1591,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1445 1591
 					}
1446 1592
 
1447 1593
 					//
1448
-					//if config.IsOpen == 1 && item.UserOrgId == 10088 {
1594
+					//if config.IsOpen == 1 && item.UserOrgId == 10188 {
1449 1595
 					//
1450 1596
 					//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1451 1597
 					//	//更新字典里面的库存
@@ -1556,6 +1702,30 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1556 1702
 	var err error
1557 1703
 	if groupno > 0 {
1558 1704
 
1705
+		// 查询信息规挡的设置天数
1706
+
1707
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1708
+		if infor.ID > 0 {
1709
+
1710
+			var cha_time int64
1711
+
1712
+			timeNowStr := time.Now().Format("2006-01-02")
1713
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1714
+
1715
+			//今日的日期减去设置的日期
1716
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1717
+
1718
+			if cha_time >= advices.AdviceDate {
1719
+				//查询审核是否允许
1720
+				infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advices.AdviceDate, adminUserInfo.Org.Id)
1721
+				//申请状态不允许的情况 拒绝修改
1722
+				if infor.ApplicationStatus != 1 {
1723
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1724
+					return
1725
+				}
1726
+
1727
+			}
1728
+		}
1559 1729
 		err = service.ModifyExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1560 1730
 		redis := service.RedisClient()
1561 1731
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -1567,6 +1737,28 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1567 1737
 		defer redis.Close()
1568 1738
 
1569 1739
 	} else {
1740
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1741
+		if infor.ID > 0 {
1742
+
1743
+			var cha_time int64
1744
+
1745
+			timeNowStr := time.Now().Format("2006-01-02")
1746
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1747
+
1748
+			//今日的日期减去设置的日期
1749
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1750
+
1751
+			if cha_time >= advices.AdviceDate {
1752
+				//查询审核是否允许
1753
+				infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advices.AdviceDate, adminUserInfo.Org.Id)
1754
+				//申请状态不允许的情况 拒绝修改
1755
+				if infor.ApplicationStatus != 1 {
1756
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1757
+					return
1758
+				}
1759
+
1760
+			}
1761
+		}
1570 1762
 		err = service.BatchModifyExceOldDoctorAdvice(&advices, ids)
1571 1763
 
1572 1764
 		err = service.ModifyExceDoctorAdviceByGroupNoOne(&advices, ids)
@@ -1637,7 +1829,8 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1637 1829
 
1638 1830
 func (c *PatientApiController) CheckDoctorAdvice() {
1639 1831
 	origin, _ := c.GetInt64("origin", 0)
1640
-
1832
+	record_date, _ := c.GetInt64("record_date")
1833
+	patient_id, _ := c.GetInt64("patient_id")
1641 1834
 	if origin != 2 {
1642 1835
 		groupno, _ := c.GetInt64("groupno", -1)
1643 1836
 		var ids []string
@@ -1707,6 +1900,31 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1707 1900
 		}
1708 1901
 		var err error
1709 1902
 		if groupno > 0 {
1903
+
1904
+			// 查询信息规挡的设置天数
1905
+
1906
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1907
+			if infor.ID > 0 {
1908
+
1909
+				var cha_time int64
1910
+
1911
+				timeNowStr := time.Now().Format("2006-01-02")
1912
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1913
+
1914
+				//今日的日期减去设置的日期
1915
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1916
+
1917
+				if cha_time >= record_date {
1918
+					//查询审核是否允许
1919
+					infor, _ := service.GetDialysisInformationByRecordDate(patient_id, record_date, adminUserInfo.Org.Id)
1920
+					//申请状态不允许的情况 拒绝修改
1921
+					if infor.ApplicationStatus != 1 {
1922
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1923
+						return
1924
+					}
1925
+
1926
+				}
1927
+			}
1710 1928
 			err = service.CheckDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1711 1929
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1712 1930
 			redis := service.RedisClient()
@@ -1733,6 +1951,30 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1733 1951
 				//timeLayout2 := "2006-01-02"
1734 1952
 				//loc, _ := time.LoadLocation("Local")
1735 1953
 				//theTime, _ := time.ParseInLocation(timeLayout2, t, loc)
1954
+				// 查询信息规挡的设置天数
1955
+
1956
+				infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1957
+				if infor.ID > 0 {
1958
+
1959
+					var cha_time int64
1960
+
1961
+					timeNowStr := time.Now().Format("2006-01-02")
1962
+					timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1963
+
1964
+					//今日的日期减去设置的日期
1965
+					cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1966
+
1967
+					if cha_time >= advices.AdviceDate {
1968
+						//查询审核是否允许
1969
+						infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id)
1970
+						//申请状态不允许的情况 拒绝修改
1971
+						if infor.ApplicationStatus != 1 {
1972
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1973
+							return
1974
+						}
1975
+
1976
+					}
1977
+				}
1736 1978
 				err = service.BatchCheckOldDoctorAdvice(&advices, ids, adminUserInfo.Org.Id, advice.AdviceDate)
1737 1979
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1738 1980
 				redis := service.RedisClient()
@@ -1783,6 +2025,30 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1783 2025
 			item.Checker = adminInfo.AdminUser.Id
1784 2026
 			item.CheckTime = time.Now().Unix()
1785 2027
 			item.CheckState = 1
2028
+			// 查询信息规挡的设置天数
2029
+
2030
+			infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
2031
+			if infor.ID > 0 {
2032
+
2033
+				var cha_time int64
2034
+
2035
+				timeNowStr := time.Now().Format("2006-01-02")
2036
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2037
+
2038
+				//今日的日期减去设置的日期
2039
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2040
+
2041
+				if cha_time >= record_date {
2042
+					//查询审核是否允许
2043
+					infor, _ := service.GetDialysisInformationByRecordDate(patient_id, record_date, adminInfo.Org.Id)
2044
+					//申请状态不允许的情况 拒绝修改
2045
+					if infor.ApplicationStatus != 1 {
2046
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2047
+						return
2048
+					}
2049
+
2050
+				}
2051
+			}
1786 2052
 			err = service.SaveHisDoctorAdvice(item)
1787 2053
 			redis := service.RedisClient()
1788 2054
 			key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
@@ -2384,8 +2650,48 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2384 2650
 	// 	}
2385 2651
 	// }
2386 2652
 
2387
-	err = service.UpadatePredialysisEvaluation(&evaluation)
2653
+	// 查询信息规挡的设置天数
2654
+
2655
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
2656
+	if infor.ID > 0 {
2657
+
2658
+		var cha_time int64
2659
+
2660
+		timeNowStr := time.Now().Format("2006-01-02")
2661
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2662
+
2663
+		//今日的日期减去设置的日期
2664
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2665
+
2666
+		if cha_time >= evaluation.AssessmentDate {
2667
+			//查询审核是否允许
2668
+			infor, _ := service.GetDialysisInformationByRecordDate(id, evaluation.AssessmentDate, adminUserInfo.Org.Id)
2669
+			//申请状态不允许的情况 拒绝修改
2670
+			if infor.ApplicationStatus != 1 {
2671
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2672
+				return
2673
+			}
2674
+
2675
+		}
2676
+	}
2388 2677
 
2678
+	err = service.UpadatePredialysisEvaluation(&evaluation)
2679
+	finish := models.XtDialysisFinish{
2680
+		IsFinish:   1,
2681
+		UserOrgId:  adminUserInfo.Org.Id,
2682
+		Status:     1,
2683
+		Ctime:      time.Now().Unix(),
2684
+		Mtime:      0,
2685
+		Module:     3,
2686
+		RecordDate: evaluation.AssessmentDate,
2687
+		Sourse:     1,
2688
+		PatientId:  id,
2689
+	}
2690
+
2691
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.Org.Id, evaluation.AssessmentDate, 3, id)
2692
+	if dialysisFinish.ID == 0 {
2693
+		service.CreateDialysisFinish(finish)
2694
+	}
2389 2695
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_before_dislysis"
2390 2696
 	redis := service.RedisClient()
2391 2697
 	defer redis.Close()
@@ -3071,6 +3377,49 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
3071 3377
 
3072 3378
 		evaluation.PointPuncture = point_puncture
3073 3379
 	}
3380
+
3381
+	if dataBody["catheter_evaluation_program"] != nil && reflect.TypeOf(dataBody["catheter_evaluation_program"]).String() == "string" {
3382
+		catheter_evaluation_program := dataBody["catheter_evaluation_program"].(string)
3383
+
3384
+		evaluation.CatheterEvaluationProgram = catheter_evaluation_program
3385
+	}
3386
+
3387
+	if dataBody["skin_site_catheterization"] != nil && reflect.TypeOf(dataBody["skin_site_catheterization"]).String() == "string" {
3388
+		skin_site_catheterization := dataBody["skin_site_catheterization"].(string)
3389
+
3390
+		evaluation.SkinSiteCatheterization = skin_site_catheterization
3391
+	}
3392
+
3393
+	if dataBody["whether_unobstructed"] != nil && reflect.TypeOf(dataBody["whether_unobstructed"]).String() == "float64" {
3394
+		whether_unobstructed := int64(dataBody["whether_unobstructed"].(float64))
3395
+		evaluation.WhetherUnobstructed = whether_unobstructed
3396
+	}
3397
+
3398
+	if dataBody["lien_necessary"] != nil && reflect.TypeOf(dataBody["lien_necessary"]).String() == "float64" {
3399
+		lien_necessary := int64(dataBody["lien_necessary"].(float64))
3400
+		evaluation.LienNecessary = lien_necessary
3401
+	}
3402
+
3403
+	if dataBody["pathway_formation_time"] != nil && reflect.TypeOf(dataBody["pathway_formation_time"]).String() == "string" {
3404
+		pathway_formation_time := dataBody["pathway_formation_time"].(string)
3405
+		timeLayout := "2006-01-02"
3406
+		loc, _ := time.LoadLocation("Local")
3407
+		var startTime int64
3408
+		if len(pathway_formation_time) > 0 {
3409
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", pathway_formation_time+" 00:00:00", loc)
3410
+
3411
+			startTime = theTime.Unix()
3412
+		}
3413
+
3414
+		evaluation.PathwayFormationTime = startTime
3415
+	}
3416
+
3417
+	if dataBody["befor_symptoms"] != nil && reflect.TypeOf(dataBody["befor_symptoms"]).String() == "string" {
3418
+		befor_symptoms := dataBody["befor_symptoms"].(string)
3419
+		evaluation.BeforSymptoms = befor_symptoms
3420
+
3421
+		fmt.Println("befor_symptomsss23333333333333333333333333", befor_symptoms)
3422
+	}
3074 3423
 	return
3075 3424
 }
3076 3425
 
@@ -3918,6 +4267,8 @@ func (c *PatientApiController) CreateGroupAdvice() {
3918 4267
 			Remark = remark
3919 4268
 		}
3920 4269
 
4270
+		Startdate := int64(dataBody["record_date"].(float64))
4271
+
3921 4272
 		var advices []*models.GroupAdvice
3922 4273
 		// utils.TraceLog("%+v", dataBody["adviceNames"])
3923 4274
 		if dataBody["adviceNames"] == nil || reflect.TypeOf(dataBody["adviceNames"]).String() != "[]interface {}" {
@@ -4004,7 +4355,48 @@ func (c *PatientApiController) CreateGroupAdvice() {
4004 4355
 			advices = append(advices, &advice)
4005 4356
 		}
4006 4357
 
4358
+		// 查询信息规挡的设置天数
4359
+
4360
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4361
+		if infor.ID > 0 {
4362
+
4363
+			var cha_time int64
4364
+
4365
+			timeNowStr := time.Now().Format("2006-01-02")
4366
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4367
+
4368
+			//今日的日期减去设置的日期
4369
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
4370
+
4371
+			if cha_time >= Startdate {
4372
+				//查询审核是否允许
4373
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, Startdate, adminUserInfo.Org.Id)
4374
+				//申请状态不允许的情况 拒绝修改
4375
+				if infor.ApplicationStatus != 1 {
4376
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
4377
+					return
4378
+				}
4379
+
4380
+			}
4381
+		}
4382
+
4007 4383
 		newAdvices, createErr := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, group_no)
4384
+		finish := models.XtDialysisFinish{
4385
+			IsFinish:   1,
4386
+			UserOrgId:  adminUserInfo.Org.Id,
4387
+			Status:     1,
4388
+			Ctime:      time.Now().Unix(),
4389
+			Mtime:      0,
4390
+			Module:     4,
4391
+			RecordDate: advicedateunix,
4392
+			Sourse:     1,
4393
+			PatientId:  patient,
4394
+		}
4395
+
4396
+		dialysisFinish, err := service.GetDialysisFinish(adminUserInfo.Org.Id, advicedateunix, 4, patient)
4397
+		if dialysisFinish.ID == 0 {
4398
+			service.CreateDialysisFinish(finish)
4399
+		}
4008 4400
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":doctor_advices"
4009 4401
 		redis := service.RedisClient()
4010 4402
 		//清空key 值
@@ -4091,6 +4483,29 @@ func (c *PatientApiController) CreateGroupAdvice() {
4091 4483
 				advice.CheckTime = time.Now().Unix()
4092 4484
 			}
4093 4485
 		}
4486
+
4487
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4488
+		if infor.ID > 0 {
4489
+
4490
+			var cha_time int64
4491
+
4492
+			timeNowStr := time.Now().Format("2006-01-02")
4493
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4494
+
4495
+			//今日的日期减去设置的日期
4496
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
4497
+
4498
+			if cha_time >= advice.RecordDate {
4499
+				//查询审核是否允许
4500
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, advice.RecordDate, adminUserInfo.Org.Id)
4501
+				//申请状态不允许的情况 拒绝修改
4502
+				if infor.ApplicationStatus != 1 {
4503
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
4504
+					return
4505
+				}
4506
+
4507
+			}
4508
+		}
4094 4509
 		err := service.CreateDoctorAdvice(&advice)
4095 4510
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
4096 4511
 		redis := service.RedisClient()
@@ -4229,6 +4644,30 @@ func (c *PatientApiController) DelDoctorAdvice() {
4229 4644
 		advice.UpdatedTime = time.Now().Unix()
4230 4645
 		advice.Modifier = adminUserInfo.AdminUser.Id
4231 4646
 
4647
+		// 查询信息规挡的设置天数
4648
+
4649
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4650
+		if infor.ID > 0 {
4651
+
4652
+			var cha_time int64
4653
+
4654
+			timeNowStr := time.Now().Format("2006-01-02")
4655
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4656
+
4657
+			//今日的日期减去设置的日期
4658
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
4659
+
4660
+			if cha_time >= advice.AdviceDate {
4661
+				//查询审核是否允许
4662
+				infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advice.AdviceDate, adminUserInfo.Org.Id)
4663
+				//申请状态不允许的情况 拒绝修改
4664
+				if infor.ApplicationStatus != 1 {
4665
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
4666
+					return
4667
+				}
4668
+
4669
+			}
4670
+		}
4232 4671
 		err := service.DeleteDoctorAdvice(&advice)
4233 4672
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
4234 4673
 
@@ -4291,7 +4730,30 @@ func (c *PatientApiController) DelDoctorAdvice() {
4291 4730
 
4292 4731
 		var err error
4293 4732
 		if groupno > 0 {
4733
+			// 查询信息规挡的设置天数
4734
+
4735
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4736
+			if infor.ID > 0 {
4737
+
4738
+				var cha_time int64
4739
+
4740
+				timeNowStr := time.Now().Format("2006-01-02")
4741
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4742
+
4743
+				//今日的日期减去设置的日期
4744
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
4745
+
4746
+				if cha_time >= advice.AdviceDate {
4747
+					//查询审核是否允许
4748
+					infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advice.AdviceDate, adminUserInfo.Org.Id)
4749
+					//申请状态不允许的情况 拒绝修改
4750
+					if infor.ApplicationStatus != 1 {
4751
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
4752
+						return
4753
+					}
4294 4754
 
4755
+				}
4756
+			}
4295 4757
 			err = service.DeleteDoctorAdviceByGroupNo(&advice)
4296 4758
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
4297 4759
 
@@ -4303,7 +4765,30 @@ func (c *PatientApiController) DelDoctorAdvice() {
4303 4765
 			keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":his_doctor_advice"
4304 4766
 			redis.Set(keyThree, "", time.Second)
4305 4767
 		} else {
4768
+			// 查询信息规挡的设置天数
4769
+
4770
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4771
+			if infor.ID > 0 {
4772
+
4773
+				var cha_time int64
4774
+
4775
+				timeNowStr := time.Now().Format("2006-01-02")
4776
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4777
+
4778
+				//今日的日期减去设置的日期
4779
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
4306 4780
 
4781
+				if cha_time >= advice.AdviceDate {
4782
+					//查询审核是否允许
4783
+					infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advice.AdviceDate, adminUserInfo.Org.Id)
4784
+					//申请状态不允许的情况 拒绝修改
4785
+					if infor.ApplicationStatus != 1 {
4786
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
4787
+						return
4788
+					}
4789
+
4790
+				}
4791
+			}
4307 4792
 			err = service.BatchDeleteDoctorAdvice(ids, adminUserInfo.AdminUser.Id)
4308 4793
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
4309 4794
 
@@ -4505,7 +4990,30 @@ func (c *PatientApiController) ExecProject() {
4505 4990
 	project.ExecutionStaff = adminInfo.AdminUser.Id
4506 4991
 	project.ExecutionTime = theTime.Unix()
4507 4992
 	if team_id == 0 {
4993
+		// 查询信息规挡的设置天数
4994
+
4995
+		infor, _ := service.GetDialysisInformationSetting(project.RecordDate)
4996
+		if infor.ID > 0 {
4997
+
4998
+			var cha_time int64
4999
+
5000
+			timeNowStr := time.Now().Format("2006-01-02")
5001
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4508 5002
 
5003
+			//今日的日期减去设置的日期
5004
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
5005
+
5006
+			if cha_time >= project.RecordDate {
5007
+				//查询审核是否允许
5008
+				infor, _ := service.GetDialysisInformationByRecordDate(project.PatientId, project.PatientId, project.UserOrgId)
5009
+				//申请状态不允许的情况 拒绝修改
5010
+				if infor.ApplicationStatus != 1 {
5011
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
5012
+					return
5013
+				}
5014
+
5015
+			}
5016
+		}
4509 5017
 		err := service.SaveHisProject(&project)
4510 5018
 		if err == nil {
4511 5019
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -4518,7 +5026,30 @@ func (c *PatientApiController) ExecProject() {
4518 5026
 		}
4519 5027
 	} else {
4520 5028
 		if is_check_team == 2 { //虽然是组套数据,但不是检验项目
5029
+			// 查询信息规挡的设置天数
5030
+
5031
+			infor, _ := service.GetDialysisInformationSetting(project.RecordDate)
5032
+			if infor.ID > 0 {
5033
+
5034
+				var cha_time int64
4521 5035
 
5036
+				timeNowStr := time.Now().Format("2006-01-02")
5037
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5038
+
5039
+				//今日的日期减去设置的日期
5040
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
5041
+
5042
+				if cha_time >= project.RecordDate {
5043
+					//查询审核是否允许
5044
+					infor, _ := service.GetDialysisInformationByRecordDate(project.PatientId, project.PatientId, project.UserOrgId)
5045
+					//申请状态不允许的情况 拒绝修改
5046
+					if infor.ApplicationStatus != 1 {
5047
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
5048
+						return
5049
+					}
5050
+
5051
+				}
5052
+			}
4522 5053
 			err := service.SaveHisProject(&project)
4523 5054
 			if err == nil {
4524 5055
 				c.ServeSuccessJSON(map[string]interface{}{
@@ -4530,6 +5061,30 @@ func (c *PatientApiController) ExecProject() {
4530 5061
 
4531 5062
 			}
4532 5063
 		} else {
5064
+			// 查询信息规挡的设置天数
5065
+
5066
+			infor, _ := service.GetDialysisInformationSetting(project.RecordDate)
5067
+			if infor.ID > 0 {
5068
+
5069
+				var cha_time int64
5070
+
5071
+				timeNowStr := time.Now().Format("2006-01-02")
5072
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5073
+
5074
+				//今日的日期减去设置的日期
5075
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
5076
+
5077
+				if cha_time >= project.RecordDate {
5078
+					//查询审核是否允许
5079
+					infor, _ := service.GetDialysisInformationByRecordDate(project.PatientId, project.PatientId, project.UserOrgId)
5080
+					//申请状态不允许的情况 拒绝修改
5081
+					if infor.ApplicationStatus != 1 {
5082
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
5083
+						return
5084
+					}
5085
+
5086
+				}
5087
+			}
4533 5088
 			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
4534 5089
 			var ids []int64
4535 5090
 			for _, items := range ps {
@@ -4571,6 +5126,30 @@ func (c *PatientApiController) CheckProject() {
4571 5126
 	project.CheckTime = time.Now().Unix()
4572 5127
 	project.CheckState = 1
4573 5128
 	if team_id == 0 {
5129
+		// 查询信息规挡的设置天数
5130
+
5131
+		infor, _ := service.GetDialysisInformationSetting(project.RecordDate)
5132
+		if infor.ID > 0 {
5133
+
5134
+			var cha_time int64
5135
+
5136
+			timeNowStr := time.Now().Format("2006-01-02")
5137
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5138
+
5139
+			//今日的日期减去设置的日期
5140
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
5141
+
5142
+			if cha_time >= project.RecordDate {
5143
+				//查询审核是否允许
5144
+				infor, _ := service.GetDialysisInformationByRecordDate(project.PatientId, project.PatientId, project.UserOrgId)
5145
+				//申请状态不允许的情况 拒绝修改
5146
+				if infor.ApplicationStatus != 1 {
5147
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
5148
+					return
5149
+				}
5150
+
5151
+			}
5152
+		}
4574 5153
 		err := service.SaveHisProject(&project)
4575 5154
 		if err == nil {
4576 5155
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -4586,6 +5165,30 @@ func (c *PatientApiController) CheckProject() {
4586 5165
 
4587 5166
 	} else {
4588 5167
 		if is_check_team == 2 { //虽然是组套数据,但不是检验项目
5168
+			// 查询信息规挡的设置天数
5169
+
5170
+			infor, _ := service.GetDialysisInformationSetting(project.RecordDate)
5171
+			if infor.ID > 0 {
5172
+
5173
+				var cha_time int64
5174
+
5175
+				timeNowStr := time.Now().Format("2006-01-02")
5176
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5177
+
5178
+				//今日的日期减去设置的日期
5179
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
5180
+
5181
+				if cha_time >= project.RecordDate {
5182
+					//查询审核是否允许
5183
+					infor, _ := service.GetDialysisInformationByRecordDate(project.PatientId, project.PatientId, project.UserOrgId)
5184
+					//申请状态不允许的情况 拒绝修改
5185
+					if infor.ApplicationStatus != 1 {
5186
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
5187
+						return
5188
+					}
5189
+
5190
+				}
5191
+			}
4589 5192
 			err := service.SaveHisProject(&project)
4590 5193
 			if err == nil {
4591 5194
 				c.ServeSuccessJSON(map[string]interface{}{
@@ -4600,6 +5203,30 @@ func (c *PatientApiController) CheckProject() {
4600 5203
 			}
4601 5204
 
4602 5205
 		} else {
5206
+			// 查询信息规挡的设置天数
5207
+
5208
+			infor, _ := service.GetDialysisInformationSetting(project.RecordDate)
5209
+			if infor.ID > 0 {
5210
+
5211
+				var cha_time int64
5212
+
5213
+				timeNowStr := time.Now().Format("2006-01-02")
5214
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5215
+
5216
+				//今日的日期减去设置的日期
5217
+				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
5218
+
5219
+				if cha_time >= project.RecordDate {
5220
+					//查询审核是否允许
5221
+					infor, _ := service.GetDialysisInformationByRecordDate(project.PatientId, project.PatientId, project.UserOrgId)
5222
+					//申请状态不允许的情况 拒绝修改
5223
+					if infor.ApplicationStatus != 1 {
5224
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
5225
+						return
5226
+					}
5227
+
5228
+				}
5229
+			}
4603 5230
 			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
4604 5231
 			var ids []int64
4605 5232
 			for _, items := range ps {

+ 245 - 4
controllers/patient_api_controller.go Datei anzeigen

@@ -366,6 +366,7 @@ func (c *PatientApiController) CreatePatient() {
366 366
 		TrobleShoot:                  patient.TrobleShoot,
367 367
 		TreatmentPlan:                patient.TreatmentPlan,
368 368
 		Doctor:                       patient.Doctor,
369
+		RecordNumber:                 patient.RecordNumber,
369 370
 	}
370 371
 
371 372
 	err = service.CreatePatientsNew(&patientsNew)
@@ -582,6 +583,7 @@ func (c *PatientApiController) EditPatient() {
582 583
 		TrobleShoot:               patient.TrobleShoot,
583 584
 		SchRemark:                 patient.SchRemark,
584 585
 		TreatmentPlan:             patient.TreatmentPlan,
586
+		RecordNumber:              patient.RecordNumber,
585 587
 	}
586 588
 	//	//更新病人ID获取新表病人ID
587 589
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -939,6 +941,7 @@ func (c *PatientApiController) UpdateDialysisSolution() {
939 941
 			MaxUltrafiltrationRate:     solution.MaxUltrafiltrationRate,
940 942
 			Amylaceum:                  solution.Amylaceum,
941 943
 			DialysisStrainer:           solution.DialysisStrainer,
944
+			Chaptalization:             solution.Chaptalization,
942 945
 		}
943 946
 		service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
944 947
 	}
@@ -1300,6 +1303,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
1300 1303
 	}
1301 1304
 	adviceNames := dataBody["adviceNames"].([]interface{})
1302 1305
 	for _, adviceNameMap := range adviceNames {
1306
+
1303 1307
 		adviceNameM := adviceNameMap.(map[string]interface{})
1304 1308
 		var advice models.GroupAdvice
1305 1309
 		advice.Remark = Remark
@@ -1317,6 +1321,50 @@ func (c *PatientApiController) CreateGroupAdvice() {
1317 1321
 		advice.PatientId = patientInfo.ID
1318 1322
 		advice.AdviceDoctor = adminUserInfo.AdminUser.Id
1319 1323
 		advice.IsSettle = 2
1324
+
1325
+		//创建步骤表
1326
+		finish := models.XtDialysisFinish{
1327
+			IsFinish:   1,
1328
+			UserOrgId:  adminUserInfo.CurrentOrgId,
1329
+			Status:     1,
1330
+			Ctime:      time.Now().Unix(),
1331
+			Mtime:      0,
1332
+			Module:     4,
1333
+			RecordDate: advice.RecordDate,
1334
+			Sourse:     1,
1335
+			PatientId:  patient,
1336
+		}
1337
+
1338
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, advice.RecordDate, 4, patient)
1339
+		if dialysisFinish.ID == 0 {
1340
+			service.CreateDialysisFinish(finish)
1341
+		}
1342
+
1343
+		// 查询信息规挡的设置天数
1344
+
1345
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1346
+		if infor.ID > 0 {
1347
+
1348
+			var cha_time int64
1349
+
1350
+			timeNowStr := time.Now().Format("2006-01-02")
1351
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1352
+
1353
+			//今日的日期减去设置的日期
1354
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1355
+
1356
+			if cha_time >= advice.AdviceDate {
1357
+				//查询审核是否允许
1358
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, advice.AdviceDate, adminUserInfo.CurrentOrgId)
1359
+				//申请状态不允许的情况 拒绝修改
1360
+				if infor.ApplicationStatus != 1 {
1361
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1362
+					return
1363
+				}
1364
+
1365
+			}
1366
+		}
1367
+
1320 1368
 		if adviceNameM["advice_name"] == nil || reflect.TypeOf(adviceNameM["advice_name"]).String() != "string" {
1321 1369
 			utils.ErrorLog("advice_name")
1322 1370
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1666,7 +1714,62 @@ func (c *PatientApiController) CreateDoctorAdvice() {
1666 1714
 	advice.PatientId = patient
1667 1715
 	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
1668 1716
 
1717
+	// 查询信息规挡的设置天数
1718
+
1719
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1720
+	if infor.ID > 0 {
1721
+
1722
+		var cha_time int64
1723
+
1724
+		timeNowStr := time.Now().Format("2006-01-02")
1725
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1726
+
1727
+		//今日的日期减去设置的日期
1728
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1729
+
1730
+		if cha_time >= advice.AdviceDate {
1731
+			//查询审核是否允许
1732
+			infor, _ := service.GetDialysisInformationByRecordDate(patient, advice.AdviceDate, adminUserInfo.CurrentOrgId)
1733
+			//申请状态不允许的情况 拒绝修改
1734
+			if infor.ApplicationStatus != 1 {
1735
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1736
+				return
1737
+			}
1738
+
1739
+		}
1740
+	}
1741
+
1742
+	if advice.UserOrgId == 3877 || advice.UserOrgId == 10340 || advice.UserOrgId == 9671 {
1743
+		if advice.PrescribingNumber == 0 {
1744
+			advice.PrescribingNumber = 1
1745
+		}
1746
+		//查询该患者今日有没有双人核对
1747
+		check, _ := service.MobileGetDoubleCheckSix(advice.UserOrgId, patientInfo.ID, advice.AdviceDate)
1748
+
1749
+		if check.ID > 0 {
1750
+			advice.Checker = check.Modifier
1751
+			advice.CheckState = 1
1752
+			advice.CheckTime = time.Now().Unix()
1753
+		}
1754
+	}
1669 1755
 	err := service.CreateDoctorAdvice(&advice)
1756
+	//创建步骤表
1757
+	finish := models.XtDialysisFinish{
1758
+		IsFinish:   1,
1759
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1760
+		Status:     1,
1761
+		Ctime:      time.Now().Unix(),
1762
+		Mtime:      0,
1763
+		Module:     4,
1764
+		RecordDate: advice.AdviceDate,
1765
+		Sourse:     1,
1766
+		PatientId:  patient,
1767
+	}
1768
+
1769
+	dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, advice.AdviceDate, 4, patient)
1770
+	if dialysisFinish.ID == 0 {
1771
+		service.CreateDialysisFinish(finish)
1772
+	}
1670 1773
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1671 1774
 	redis := service.RedisClient()
1672 1775
 	defer redis.Close()
@@ -1946,6 +2049,31 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1946 2049
 			ExecutionTime:  theTime.Unix(),
1947 2050
 			UpdatedTime:    time.Now().Unix(),
1948 2051
 		}
2052
+
2053
+		// 查询信息规挡的设置天数
2054
+
2055
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2056
+		if infor.ID > 0 {
2057
+
2058
+			var cha_time int64
2059
+
2060
+			timeNowStr := time.Now().Format("2006-01-02")
2061
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2062
+
2063
+			//今日的日期减去设置的日期
2064
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2065
+
2066
+			if cha_time >= advice.AdviceDate {
2067
+				//查询审核是否允许
2068
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, advice.AdviceDate, adminUserInfo.CurrentOrgId)
2069
+				//申请状态不允许的情况 拒绝修改
2070
+				if infor.ApplicationStatus != 1 {
2071
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2072
+					return
2073
+				}
2074
+
2075
+			}
2076
+		}
1949 2077
 		if advice.ParentId > 0 {
1950 2078
 			err = service.ExceDoctorAdviceById(&exceAdvice, advice.ParentId, patient)
1951 2079
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -2712,6 +2840,30 @@ func (c *PatientApiController) CheckDoctorAdvice() {
2712 2840
 			UpdatedTime: time.Now().Unix(),
2713 2841
 		}
2714 2842
 		var err error
2843
+		// 查询信息规挡的设置天数
2844
+
2845
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2846
+		if infor.ID > 0 {
2847
+
2848
+			var cha_time int64
2849
+
2850
+			timeNowStr := time.Now().Format("2006-01-02")
2851
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2852
+
2853
+			//今日的日期减去设置的日期
2854
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
2855
+
2856
+			if cha_time >= advice.AdviceDate {
2857
+				//查询审核是否允许
2858
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, advice.AdviceDate, adminUserInfo.CurrentOrgId)
2859
+				//申请状态不允许的情况 拒绝修改
2860
+				if infor.ApplicationStatus != 1 {
2861
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
2862
+					return
2863
+				}
2864
+
2865
+			}
2866
+		}
2715 2867
 		if advice.ParentId > 0 {
2716 2868
 			err = service.CheckDoctorAdviceById(&exceAdvice, advice.ParentId, patient)
2717 2869
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -2903,6 +3055,31 @@ func (c *PatientApiController) UpdateDoctorAdvice() {
2903 3055
 	advice.UpdatedTime = time.Now().Unix()
2904 3056
 	advice.Modifier = adminUserInfo.AdminUser.Id
2905 3057
 
3058
+	// 查询信息规挡的设置天数
3059
+
3060
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3061
+	if infor.ID > 0 {
3062
+
3063
+		var cha_time int64
3064
+
3065
+		timeNowStr := time.Now().Format("2006-01-02")
3066
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
3067
+
3068
+		//今日的日期减去设置的日期
3069
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3070
+
3071
+		if cha_time >= advice.AdviceDate {
3072
+			//查询审核是否允许
3073
+			infor, _ := service.GetDialysisInformationByRecordDate(patient, advice.AdviceDate, adminUserInfo.CurrentOrgId)
3074
+			//申请状态不允许的情况 拒绝修改
3075
+			if infor.ApplicationStatus != 1 {
3076
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3077
+				return
3078
+			}
3079
+
3080
+		}
3081
+	}
3082
+
2906 3083
 	err := service.UpdateDoctorAdvice(&advice)
2907 3084
 	redis := service.RedisClient()
2908 3085
 
@@ -3115,6 +3292,30 @@ func (c *PatientApiController) DeleteDoctorAdvice() {
3115 3292
 	advice.Status = 0
3116 3293
 	advice.Modifier = adminUserInfo.AdminUser.Id
3117 3294
 
3295
+	// 查询信息规挡的设置天数
3296
+
3297
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3298
+	if infor.ID > 0 {
3299
+
3300
+		var cha_time int64
3301
+
3302
+		timeNowStr := time.Now().Format("2006-01-02")
3303
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
3304
+
3305
+		//今日的日期减去设置的日期
3306
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3307
+
3308
+		if cha_time >= advice.AdviceDate {
3309
+			//查询审核是否允许
3310
+			infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advice.AdviceDate, adminUserInfo.CurrentOrgId)
3311
+			//申请状态不允许的情况 拒绝修改
3312
+			if infor.ApplicationStatus != 1 {
3313
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3314
+				return
3315
+			}
3316
+
3317
+		}
3318
+	}
3118 3319
 	err := service.DeleteDoctorAdvice(&advice)
3119 3320
 	redis := service.RedisClient()
3120 3321
 	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -3162,6 +3363,31 @@ func (c *PatientApiController) DeleteGroupAdvice() {
3162 3363
 	//	}
3163 3364
 	//}
3164 3365
 
3366
+	// 查询信息规挡的设置天数
3367
+
3368
+	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3369
+	if infor.ID > 0 {
3370
+
3371
+		var cha_time int64
3372
+
3373
+		timeNowStr := time.Now().Format("2006-01-02")
3374
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
3375
+
3376
+		//今日的日期减去设置的日期
3377
+		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3378
+
3379
+		if cha_time >= advice.AdviceDate {
3380
+			//查询审核是否允许
3381
+			infor, _ := service.GetDialysisInformationByRecordDate(advice.PatientId, advice.AdviceDate, adminUserInfo.CurrentOrgId)
3382
+			//申请状态不允许的情况 拒绝修改
3383
+			if infor.ApplicationStatus != 1 {
3384
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3385
+				return
3386
+			}
3387
+
3388
+		}
3389
+	}
3390
+
3165 3391
 	err := service.DeleteGroupAdvice(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
3166 3392
 
3167 3393
 	key := strconv.FormatInt(advice.UserOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -3249,11 +3475,15 @@ func (c *PatientApiController) GetDoctorAdvices() {
3249 3475
 		//相关操作对应的操作人
3250 3476
 		operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
3251 3477
 
3478
+		//获取长期医嘱
3479
+		longAdvice, _, _ := service.GetLongDoctorAdviceList(adminUserInfo.CurrentOrgId, id, 1, stopType, theStartTIme, theEndtTIme, keywords, page, limit)
3252 3480
 		c.ServeSuccessJSON(map[string]interface{}{
3253
-			"advices":   advices,
3254
-			"operators": operators,
3255
-			"total":     total,
3256
-			"advicetwo": advicestwo,
3481
+			"advices":    advices,
3482
+			"operators":  operators,
3483
+			"total":      total,
3484
+			"advicetwo":  advicestwo,
3485
+			"longAdvice": longAdvice,
3486
+			"is_open":    hisconfig.IsOpen,
3257 3487
 		})
3258 3488
 		return
3259 3489
 	} else {
@@ -3285,6 +3515,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
3285 3515
 			"operators": operators,
3286 3516
 			"total":     total,
3287 3517
 			"advicetwo": advicestwo,
3518
+			"is_open":   hisconfig.IsOpen,
3288 3519
 		})
3289 3520
 		return
3290 3521
 	}
@@ -4058,6 +4289,11 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
4058 4289
 		amylaceum := dataBody["amylaceum"].(string)
4059 4290
 		solution.Amylaceum = amylaceum
4060 4291
 	}
4292
+
4293
+	if dataBody["chaptalization"] != nil && reflect.TypeOf(dataBody["chaptalization"]).String() == "string" {
4294
+		chaptalization := dataBody["chaptalization"].(string)
4295
+		solution.Chaptalization = chaptalization
4296
+	}
4061 4297
 	return
4062 4298
 }
4063 4299
 
@@ -4669,6 +4905,11 @@ func patientFormData(patient *models.Patients, data []byte, method string) (cont
4669 4905
 		doctor := int64(patientBody["doctor"].(float64))
4670 4906
 		patient.Doctor = doctor
4671 4907
 	}
4908
+
4909
+	if patientBody["record_number"] != nil && reflect.TypeOf(patientBody["record_number"]).String() == "string" {
4910
+		record_number := patientBody["record_number"].(string)
4911
+		patient.RecordNumber = record_number
4912
+	}
4672 4913
 	return
4673 4914
 }
4674 4915
 

+ 53 - 1
controllers/patient_dataconfig_api_controller.go Datei anzeigen

@@ -36,6 +36,8 @@ func PatientDataConfigAPIControllerRegistRouters() {
36 36
 	beego.Router("/api/patient/sickhistory/print", &PatientDataConfigAPIController{}, "get:GetSickhistoryPrints")
37 37
 	beego.Router("/api/patient/physiquecheck/print", &PatientDataConfigAPIController{}, "get:GetPhysiquecheckPrints")
38 38
 
39
+	beego.Router("/api/patient/getpatientdialysisinforlist", &PatientDataConfigAPIController{}, "get:GetPatientDialysisInforList")
40
+
39 41
 }
40 42
 
41 43
 type PatientDataConfigAPIController struct {
@@ -1000,7 +1002,6 @@ func (this *PatientDataConfigAPIController) ModifyCourse() {
1000 1002
 	//loc, _ := time.LoadLocation("Local")
1001 1003
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
1002 1004
 
1003
-	fmt.Println("checkDate--------------", checkDate)
1004 1005
 	adminUserInfo := this.GetAdminUserInfo()
1005 1006
 	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
1006 1007
 	if getPatientErr != nil {
@@ -1038,3 +1039,54 @@ func (this *PatientDataConfigAPIController) ModifyCourse() {
1038 1039
 		"record": record,
1039 1040
 	})
1040 1041
 }
1042
+
1043
+func (this *PatientDataConfigAPIController) GetPatientDialysisInforList() {
1044
+
1045
+	patientID, _ := this.GetInt64("patient_id")
1046
+	record_date := this.GetString("record_date")
1047
+
1048
+	timeLayout := "2006-01-02"
1049
+	loc, _ := time.LoadLocation("Local")
1050
+	var startTime int64
1051
+	if len(record_date) > 0 {
1052
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
1053
+		if err != nil {
1054
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1055
+			return
1056
+		}
1057
+		startTime = theTime.Unix()
1058
+	}
1059
+	fmt.Println("startTime0000000000000000", startTime)
1060
+
1061
+	//获取患者姓名
1062
+	patient, _ := service.GetPatientName(patientID)
1063
+
1064
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1065
+	//获取透析处方
1066
+	prescription, _ := service.GetDialysisPrescription(patientID, orgId, startTime)
1067
+
1068
+	//获取透前评估
1069
+	assessmentBefor, _ := service.GetAssessmentBefor(orgId, patientID, startTime)
1070
+
1071
+	//透析上机
1072
+	order, _ := service.GetDialysisOrder(orgId, patientID, startTime)
1073
+
1074
+	//透析监测
1075
+	monitor, _ := service.GetFistMonitorSix(orgId, patientID, startTime)
1076
+
1077
+	//透析医嘱
1078
+	advice, _ := service.GetBloodDoctorAdvice(startTime, orgId, patientID)
1079
+
1080
+	//透后评估
1081
+	afterDislysis, _ := service.GetAssessmentAfterDissData(patientID, orgId, startTime)
1082
+
1083
+	this.ServeSuccessJSON(map[string]interface{}{
1084
+		"patient":         patient,
1085
+		"prescription":    prescription,
1086
+		"assessmentBefor": assessmentBefor,
1087
+		"order":           order,
1088
+		"monitor":         monitor,
1089
+		"advice":          advice,
1090
+		"afterDislysis":   afterDislysis,
1091
+	})
1092
+}

+ 1 - 1
controllers/pharmacy_controller.go Datei anzeigen

@@ -438,7 +438,7 @@ func (this *PharmacyController) DispensingMedicine() {
438 438
 
439 439
 // 退药按钮点击
440 440
 func (this *PharmacyController) DrugWithdrawal() {
441
-	fmt.Println("寄哪里2333333333333333333333333333333")
441
+
442 442
 	var err error
443 443
 	defer func() {
444 444
 		if rec := recover(); rec != nil {

+ 2 - 2
controllers/print_data_api_controller.go Datei anzeigen

@@ -37,7 +37,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
37 37
 	idStrs := strings.Split(schIDStr, ",")
38 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 {
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 {
41 41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42 42
 		for _, item := range schedules {
43 43
 
@@ -136,7 +136,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
136 136
 		})
137 137
 	}
138 138
 
139
-	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 {
139
+	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 {
140 140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141 141
 		for _, item := range schedules {
142 142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)

+ 15 - 0
controllers/schedule_api_controller.go Datei anzeigen

@@ -4394,6 +4394,18 @@ func (c *ScheduleApiController) GetScheduleOne() {
4394 4394
 		weekEndPoint = theEndTime.Unix()
4395 4395
 	}
4396 4396
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4397
+
4398
+	if adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10346 {
4399
+
4400
+		if len(schdules) > 0 {
4401
+			//获取长期医嘱里面的透析器灌流器
4402
+			for _, item := range schdules {
4403
+				solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
4404
+				service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, solution.DialyzerPerfusionApparatus, item.ScheduleType)
4405
+			}
4406
+
4407
+		}
4408
+	}
4397 4409
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4398 4410
 	c.ServeSuccessJSON(map[string]interface{}{
4399 4411
 		"days":           days,
@@ -4408,6 +4420,8 @@ func (c *ScheduleApiController) GetScheduleOne() {
4408 4420
 func (c *ScheduleApiController) GetScheduleTwo() {
4409 4421
 
4410 4422
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4423
+
4424
+	fmt.Println("weekwoowowowowowowowowowo", week)
4411 4425
 	patitionIdStr := c.GetString("patitionid")
4412 4426
 
4413 4427
 	ids := strings.Split(patitionIdStr, ",")
@@ -4416,6 +4430,7 @@ func (c *ScheduleApiController) GetScheduleTwo() {
4416 4430
 
4417 4431
 	adminInfo := c.GetAdminUserInfo()
4418 4432
 	weekDateStr := c.GetString("week_date")
4433
+	fmt.Println("weekDateStr--------------------", weekDateStr)
4419 4434
 	WeekDayIds := strings.Split(weekDateStr, ",")
4420 4435
 
4421 4436
 	thisTime := time.Now()

+ 2 - 1
controllers/stock_in_api_controller.go Datei anzeigen

@@ -7433,8 +7433,9 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7433 7433
 	//查询默认仓库
7434 7434
 	storeHouseConfig, _ := service.GetAllStoreHouseConfig(orgId)
7435 7435
 
7436
+	checker := this.GetAdminUserInfo().AdminUser.Id
7436 7437
 	//更改审核状态
7437
-	err := service.UpdateCheckWarehouseInfo(warehousing_info_id)
7438
+	err := service.UpdateCheckWarehouseInfo(warehousing_info_id, checker)
7438 7439
 	if err == nil {
7439 7440
 		list, _ := service.GetWarehouseInfoList(warehousing_info_id, orgId)
7440 7441
 

+ 1 - 1
controllers/supply_order_api_contorller.go Datei anzeigen

@@ -2403,7 +2403,7 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
2403 2403
 			sum_in_count += item.WarehousingCount
2404 2404
 		}
2405 2405
 		service.UpdateGoodByGoodId(item.GoodId, sum_count, sum_in_count, item.OrgId)
2406
-		fmt.Println("入库数量23333333333333333333333wo", item.WarehousingCount)
2406
+
2407 2407
 		//查询是否有该耗材
2408 2408
 		goodStock, _ := service.GetGoodSumCount(storeConfig.StorehouseOutInfo, item.GoodId, item.OrgId)
2409 2409
 		if goodStock.ID > 0 {

+ 4 - 0
enums/error_code.go Datei anzeigen

@@ -277,6 +277,8 @@ const ( // ErrorCode
277 277
 	ErrorCodeSyncWrong = 60000006
278 278
 
279 279
 	AdviceCodeParamWrong = 600000007
280
+
281
+	ErrorCodeInformationExist = 600000008
280 282
 )
281 283
 
282 284
 var ErrCodeMsgs = map[int]string{
@@ -536,6 +538,8 @@ var ErrCodeMsgs = map[int]string{
536 538
 	ErrorCodePatientScheduleRepeat:        "一天只能存在一次排班",
537 539
 	ErrorCodeDelScheduleFailByDialysisTwo: "已经上机透析,不能操作排班",
538 540
 	AdviceCodeParamWrong:                  "医嘱核对人和执行人不能为同一人,请更换第二核对人!",
541
+
542
+	ErrorCodeInformationExist: "已经超过归档天数,不予编辑,请提交申请",
539 543
 }
540 544
 
541 545
 type SGJError struct {

+ 17 - 12
go.mod Datei anzeigen

@@ -3,28 +3,33 @@ module XT_New
3 3
 go 1.19
4 4
 
5 5
 require (
6
-	github.com/astaxie/beego v1.12.3 // indirect
6
+	github.com/astaxie/beego v1.12.3
7
+	github.com/go-redis/redis v6.15.9+incompatible
8
+	github.com/jinzhu/gorm v1.9.16
9
+	github.com/robfig/cron v1.2.0
10
+	github.com/shopspring/decimal v1.3.1
11
+	golang.org/x/sync v0.1.0
12
+)
13
+
14
+require (
7 15
 	github.com/beorn7/perks v1.0.1 // indirect
8 16
 	github.com/cespare/xxhash/v2 v2.1.1 // indirect
9
-	github.com/go-redis/redis v6.15.9+incompatible // indirect
10 17
 	github.com/go-sql-driver/mysql v1.7.0 // indirect
11
-	github.com/golang/protobuf v1.4.2 // indirect
18
+	github.com/golang/protobuf v1.5.0 // indirect
12 19
 	github.com/hashicorp/golang-lru v0.5.4 // indirect
13
-	github.com/jinzhu/gorm v1.9.16 // indirect
14 20
 	github.com/jinzhu/inflection v1.0.0 // indirect
21
+	github.com/kr/text v0.2.0 // indirect
15 22
 	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
16 23
 	github.com/prometheus/client_golang v1.7.0 // indirect
17 24
 	github.com/prometheus/client_model v0.2.0 // indirect
18 25
 	github.com/prometheus/common v0.10.0 // indirect
19 26
 	github.com/prometheus/procfs v0.1.3 // indirect
20
-	github.com/robfig/cron v1.2.0 // indirect
21 27
 	github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
22
-	github.com/shopspring/decimal v1.3.1 // indirect
23
-	golang.org/x/crypto v0.7.0 // indirect
24
-	golang.org/x/net v0.8.0 // indirect
25
-	golang.org/x/sync v0.1.0 // indirect
26
-	golang.org/x/sys v0.6.0 // indirect
27
-	golang.org/x/text v0.8.0 // indirect
28
-	google.golang.org/protobuf v1.23.0 // indirect
28
+	github.com/stretchr/testify v1.8.2 // indirect
29
+	golang.org/x/crypto v0.9.0 // indirect
30
+	golang.org/x/net v0.10.0 // indirect
31
+	golang.org/x/sys v0.8.0 // indirect
32
+	golang.org/x/text v0.9.0 // indirect
33
+	google.golang.org/protobuf v1.30.0 // indirect
29 34
 	gopkg.in/yaml.v2 v2.2.8 // indirect
30 35
 )

+ 44 - 14
go.sum Datei anzeigen

@@ -24,13 +24,18 @@ github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h
24 24
 github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
25 25
 github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
26 26
 github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
27
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
27 28
 github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
28 29
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
30
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
29 31
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
32
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
30 33
 github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
31 34
 github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
32 35
 github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
36
+github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
33 37
 github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
38
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
34 39
 github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
35 40
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
36 41
 github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
@@ -46,6 +51,7 @@ github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ
46 51
 github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
47 52
 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
48 53
 github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
54
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
49 55
 github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
50 56
 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
51 57
 github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -55,22 +61,27 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x
55 61
 github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
56 62
 github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
57 63
 github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
58
-github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
59 64
 github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
65
+github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
66
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
60 67
 github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
61 68
 github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
62 69
 github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
63 70
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
64 71
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
65 72
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
73
+github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
74
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
66 75
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
67 76
 github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
68 77
 github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
78
+github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
69 79
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
70 80
 github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
71 81
 github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
72 82
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
73 83
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
84
+github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
74 85
 github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
75 86
 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
76 87
 github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -80,10 +91,14 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
80 91
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
81 92
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
82 93
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
94
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
95
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
83 96
 github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
84 97
 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
98
+github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
85 99
 github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
86 100
 github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
101
+github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
87 102
 github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
88 103
 github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
89 104
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -92,9 +107,12 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
92 107
 github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
93 108
 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
94 109
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
110
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
95 111
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
96 112
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
113
+github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
97 114
 github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
115
+github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
98 116
 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
99 117
 github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
100 118
 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
@@ -102,6 +120,7 @@ github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHu
102 120
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
103 121
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
104 122
 github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
123
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
105 124
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
106 125
 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
107 126
 github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
@@ -132,9 +151,15 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
132 151
 github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
133 152
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
134 153
 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
154
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
155
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
135 156
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
136 157
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
137 158
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
159
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
160
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
161
+github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
162
+github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
138 163
 github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
139 164
 github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
140 165
 github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
@@ -143,22 +168,20 @@ github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29Xrm
143 168
 golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
144 169
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
145 170
 golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
146
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
147 171
 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
148 172
 golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
149
-golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
150
-golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
173
+golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
174
+golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
151 175
 golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
152 176
 golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
153 177
 golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
154 178
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
155 179
 golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
156
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
157 180
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
158 181
 golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
159 182
 golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
160
-golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
161
-golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
183
+golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
184
+golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
162 185
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
163 186
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
164 187
 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -174,28 +197,32 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w
174 197
 golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
175 198
 golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
176 199
 golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
177
-golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
178 200
 golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
179
-golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
180
-golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
181
-golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
201
+golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
202
+golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
182 203
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
183
-golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
184
-golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
204
+golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
205
+golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
206
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
185 207
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
186 208
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
187 209
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
188 210
 google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
189 211
 google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
190 212
 google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
191
-google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
192 213
 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
214
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
215
+google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
216
+google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
193 217
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
194 218
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
195 219
 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
220
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
196 221
 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
222
+gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
197 223
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
198 224
 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
225
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
199 226
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
200 227
 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
201 228
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
@@ -203,3 +230,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
203 230
 gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
204 231
 gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
205 232
 gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
233
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
234
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
235
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

+ 25 - 10
models/data_models.go Datei anzeigen

@@ -143,16 +143,17 @@ func (DictConfigViewModel) TableName() string {
143 143
 }
144 144
 
145 145
 type FiledConfig struct {
146
-	ID          int64  `gorm:"column:id" json:"id"`
147
-	OrgId       int64  `gorm:"column:org_id" json:"org_id"`
148
-	Module      int64  `gorm:"column:module" json:"module"`
149
-	FiledName   string `gorm:"column:filed_name" json:"filed_name"`
150
-	FiledNameCn string `gorm:"column:filed_name_cn" json:"filed_name_cn"`
151
-	IsShow      int64  `gorm:"column:is_show" json:"is_show"`
152
-	CreateTime  int64  `gorm:"column:create_time" json:"create_time"`
153
-	UpdateTime  int64  `gorm:"column:update_time" json:"update_time"`
154
-	SysModule   int64  `gorm:"column:sys_module" json:"sys_module" form:"sys_module"`
155
-	IsWrite     int64  `gorm:"column:is_write" json:"is_write" form:"is_write"`
146
+	ID           int64  `gorm:"column:id" json:"id"`
147
+	OrgId        int64  `gorm:"column:org_id" json:"org_id"`
148
+	Module       int64  `gorm:"column:module" json:"module"`
149
+	FiledName    string `gorm:"column:filed_name" json:"filed_name"`
150
+	FiledNameCn  string `gorm:"column:filed_name_cn" json:"filed_name_cn"`
151
+	IsShow       int64  `gorm:"column:is_show" json:"is_show"`
152
+	CreateTime   int64  `gorm:"column:create_time" json:"create_time"`
153
+	UpdateTime   int64  `gorm:"column:update_time" json:"update_time"`
154
+	SysModule    int64  `gorm:"column:sys_module" json:"sys_module" form:"sys_module"`
155
+	IsWrite      int64  `gorm:"column:is_write" json:"is_write" form:"is_write"`
156
+	IsSecondMenu int64  `gorm:"column:is_second_menu" json:"is_second_menu" form:"is_second_menu"`
156 157
 }
157 158
 
158 159
 func (FiledConfig) TableName() string {
@@ -192,3 +193,17 @@ type XtHisAddtionConfig struct {
192 193
 func (XtHisAddtionConfig) TableName() string {
193 194
 	return "xt_his_addtion_config"
194 195
 }
196
+
197
+type XtPatientDiagnose struct {
198
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
199
+	ClassName string `gorm:"column:class_name" json:"class_name" form:"class_name"`
200
+	Sort      int64  `gorm:"column:sort" json:"sort" form:"sort"`
201
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
202
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
203
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
204
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
205
+}
206
+
207
+func (XtPatientDiagnose) TableName() string {
208
+	return "xt_patient_diagnose"
209
+}

+ 22 - 0
models/device_models.go Datei anzeigen

@@ -1443,3 +1443,25 @@ func (XtNewObjectDisinfect) TableName() string {
1443 1443
 
1444 1444
 	return "xt_new_object_disinfect"
1445 1445
 }
1446
+
1447
+type XtDialysisInformation struct {
1448
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
1449
+	Module            int64  `gorm:"column:module" json:"module" form:"module"`
1450
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1451
+	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1452
+	ApplicationDate   int64  `gorm:"column:application_date" json:"application_date" form:"application_date"`
1453
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
1454
+	ApplicationStatus int64  `gorm:"column:application_status" json:"application_status" form:"application_status"`
1455
+	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
1456
+	CheckTime         int64  `gorm:"column:check_time" json:"check_time" form:"check_time"`
1457
+	Remark            string `gorm:"column:remark" json:"remark" form:"remark"`
1458
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1459
+	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1460
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
1461
+	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1462
+}
1463
+
1464
+func (XtDialysisInformation) TableName() string {
1465
+
1466
+	return "xt_dialysis_information"
1467
+}

+ 79 - 9
models/dialysis.go Datei anzeigen

@@ -160,6 +160,7 @@ type SchedualPatient2 struct {
160 160
 	UserSysBeforeCount        int64                `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
161 161
 	SchRemark                 string               `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
162 162
 	HospitalFirstDialysisDate int64                `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
163
+	RecordNumber              string               `gorm:"column:record_number" json:"record_number" form:"record_number"`
163 164
 }
164 165
 
165 166
 func (SchedualPatient2) TableName() string {
@@ -326,6 +327,12 @@ type PredialysisEvaluation struct {
326 327
 	HisDepartment                  string  `gorm:"column:his_department" json:"his_department" form:"his_department"`
327 328
 	HisBed                         string  `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
328 329
 	PointPuncture                  string  `gorm:"column:point_puncture" json:"point_puncture" form:"point_puncture"`
330
+	CatheterEvaluationProgram      string  `gorm:"column:catheter_evaluation_program" json:"catheter_evaluation_program" form:"catheter_evaluation_program"`
331
+	SkinSiteCatheterization        string  `gorm:"column:skin_site_catheterization" json:"skin_site_catheterization" form:"skin_site_catheterization"`
332
+	WhetherUnobstructed            int64   `gorm:"column:whether_unobstructed" json:"whether_unobstructed" form:"whether_unobstructed"`
333
+	LienNecessary                  int64   `gorm:"column:lien_necessary" json:"lien_necessary" form:"lien_necessary"`
334
+	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
335
+	BeforSymptoms                  string  `gorm:"column:befor_symptoms" json:"befor_symptoms" form:"befor_symptoms"`
329 336
 }
330 337
 
331 338
 func (PredialysisEvaluation) TableName() string {
@@ -1475,15 +1482,78 @@ func (NewAssessmentAfterDislysis) TableName() string {
1475 1482
 	return "xt_assessment_after_dislysis"
1476 1483
 }
1477 1484
 
1478
-type XtDialysisInformaitonSetting struct {
1479
-	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1480
-	WeekDay   int64 `gorm:"column:week_day" json:"week_day" form:"week_day"`
1481
-	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1482
-	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1483
-	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1484
-	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1485
+//type XtDialysisInformaitonSetting struct {
1486
+//	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1487
+//	WeekDay   int64 `gorm:"column:week_day" json:"week_day" form:"week_day"`
1488
+//	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1489
+//	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1490
+//	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1491
+//	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1492
+//}
1493
+//
1494
+//func (XtDialysisInformaitonSetting) TableName() string {
1495
+//	return "xt_dialysis_informaiton_setting"
1496
+//}
1497
+
1498
+type DialysisInformation struct {
1499
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
1500
+	Module            int64  `gorm:"column:module" json:"module" form:"module"`
1501
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1502
+	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1503
+	ApplicationDate   int64  `gorm:"column:application_date" json:"application_date" form:"application_date"`
1504
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
1505
+	ApplicationStatus int64  `gorm:"column:application_status" json:"application_status" form:"application_status"`
1506
+	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
1507
+	CheckTime         int64  `gorm:"column:check_time" json:"check_time" form:"check_time"`
1508
+	Remark            string `gorm:"column:remark" json:"remark" form:"remark"`
1509
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1510
+	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1511
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
1512
+	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1485 1513
 }
1486 1514
 
1487
-func (XtDialysisInformaitonSetting) TableName() string {
1488
-	return "xt_dialysis_informaiton_setting"
1515
+func (DialysisInformation) TableName() string {
1516
+	return "xt_dialysis_information"
1517
+}
1518
+
1519
+type DialysisScheduleFlow struct {
1520
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1521
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1522
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1523
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1524
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1525
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1526
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1527
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1528
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1529
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1530
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
1531
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1532
+
1533
+	MonitorPatients *MonitorPatients  `gorm:"ForeignKey:PatientId" json:"patient"`
1534
+	DeviceNumber    *DeviceNumber     `gorm:"ForeignKey:BedId" json:"device_number"`
1535
+	DeviceZone      *DeviceZone       `gorm:"ForeignKey:PartitionId" json:"device_zone"`
1536
+	TreatmentMode   *TreatmentMode    `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
1537
+	DialysisFinish  []*DialysisFinish `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:RecordDate,PatientId" json:"dialysis_finish"`
1538
+}
1539
+
1540
+func (DialysisScheduleFlow) TableName() string {
1541
+	return "xt_schedule"
1542
+}
1543
+
1544
+type DialysisFinish struct {
1545
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
1546
+	IsFinish   int64 `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`
1547
+	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1548
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
1549
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1550
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1551
+	Module     int64 `gorm:"column:module" json:"module" form:"module"`
1552
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
1553
+	Sourse     int64 `gorm:"column:sourse" json:"sourse" form:"sourse"`
1554
+	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1555
+}
1556
+
1557
+func (DialysisFinish) TableName() string {
1558
+	return "xt_dialysis_finish"
1489 1559
 }

+ 1 - 0
models/drug_stock.go Datei anzeigen

@@ -19,6 +19,7 @@ type DrugWarehouse struct {
19 19
 	SecondWarehouseId int64  `gorm:"column:second_warehouse_id" json:"second_warehouse_id" form:"second_warehouse_id"`
20 20
 	IsSys             int64  `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
21 21
 	IsCheck           int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
22
+	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
22 23
 }
23 24
 
24 25
 func (DrugWarehouse) TableName() string {

+ 1 - 0
models/his_models.go Datei anzeigen

@@ -422,6 +422,7 @@ type HisPrescriptionInfo struct {
422 422
 	XtHisDepartment    XtHisDepartment `gorm:"ForeignKey:ID;AssociationForeignKey:Departments" json:"department"`
423 423
 	SickType           int64           `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
424 424
 	PType              int64           `gorm:"column:p_type" json:"p_type" form:"p_type"`
425
+	PatientDiagnosis   string          `gorm:"column:patient_diagnosis" json:"patient_diagnosis" form:"patient_diagnosis"`
425 426
 }
426 427
 
427 428
 func (HisPrescriptionInfo) TableName() string {

+ 36 - 0
models/patient_models.go Datei anzeigen

@@ -221,6 +221,7 @@ type Patients struct {
221 221
 	ZbPatientId              string  `gorm:"column:zb_patient_id" json:"zb_patient_id" form:"zb_patient_id"`
222 222
 	TreatmentPlan            string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
223 223
 	Doctor                   int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
224
+	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
224 225
 }
225 226
 
226 227
 func (Patients) TableName() string {
@@ -366,6 +367,7 @@ type DialysisPrescription struct {
366 367
 	SodiumBicarbonateFlow      string        `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
367 368
 	PrescriptionWater          float64       `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
368 369
 	DialysisStrainer           string        `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
370
+	Chaptalization             string        `gorm:"column:chaptalization" json:"chaptalization" form:"chaptalization"`
369 371
 }
370 372
 
371 373
 func (DialysisPrescription) TableName() string {
@@ -583,6 +585,7 @@ type DialysisSolution struct {
583 585
 	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
584 586
 	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
585 587
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
588
+	Chaptalization             string  `gorm:"column:chaptalization" json:"chaptalization" form:"chaptalization"`
586 589
 }
587 590
 
588 591
 func (DialysisSolution) TableName() string {
@@ -810,6 +813,7 @@ type XtPatientsNew struct {
810 813
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
811 814
 	Doctor                       int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
812 815
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
816
+	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
813 817
 }
814 818
 
815 819
 func (XtPatientsNew) TableName() string {
@@ -1602,6 +1606,7 @@ type VmDialysisSolutionOne struct {
1602 1606
 	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1603 1607
 	ModeName                   string `gorm:"column:mode_name" json:"mode_name" form:"mode_name"`
1604 1608
 	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1609
+	SolutionStatus             int64  `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
1605 1610
 }
1606 1611
 
1607 1612
 func (VmDialysisSolutionOne) TableName() string {
@@ -1634,6 +1639,7 @@ type XtScheduleList struct {
1634 1639
 	ModeId           int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1635 1640
 	IsExport         int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
1636 1641
 	DialysisSolution VmDialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1642
+	Status           int64              `gorm:"column:status" json:"status" form:"status"`
1637 1643
 }
1638 1644
 
1639 1645
 func (XtScheduleList) TableName() string {
@@ -1827,6 +1833,36 @@ func (XtPatientFirstDisease) TableName() string {
1827 1833
 	return "xt_patient_first_disease"
1828 1834
 }
1829 1835
 
1836
+type XtDialysisFinish struct {
1837
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
1838
+	IsFinish   int64 `gorm:"column:is_finish" json:"is_finish" form:"is_finish"`
1839
+	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1840
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
1841
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1842
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1843
+	Module     int64 `gorm:"column:module" json:"module" form:"module"`
1844
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
1845
+	Sourse     int64 `gorm:"column:sourse" json:"sourse" form:"sourse"`
1846
+	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1847
+}
1848
+
1849
+func (XtDialysisFinish) TableName() string {
1850
+	return "xt_dialysis_finish"
1851
+}
1852
+
1853
+type XtDialysisInformaitonSetting struct {
1854
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1855
+	WeekDay   int64 `gorm:"column:week_day" json:"week_day" form:"week_day"`
1856
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1857
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1858
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1859
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1860
+}
1861
+
1862
+func (XtDialysisInformaitonSetting) TableName() string {
1863
+	return "xt_dialysis_informaiton_setting"
1864
+}
1865
+
1830 1866
 type XtPatientSickHistory struct {
1831 1867
 	ID                      int64                  `gorm:"column:id" json:"id" form:"id"`
1832 1868
 	OrgId                   int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`

+ 4 - 3
models/schedule_models.go Datei anzeigen

@@ -74,9 +74,10 @@ type ScheduleTwo struct {
74 74
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
75 75
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
76 76
 
77
-	Patient                   string               `gorm:"-" json:"patient" form:"patient"`
78
-	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
-	DialysisMachineName       string               `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
77
+	Patient                   string                `gorm:"-" json:"patient" form:"patient"`
78
+	PatientInfectiousDiseases []InfectiousDiseases  `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
+	DialysisMachineName       string                `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
80
+	DialysisSolution          VmDialysisSolutionOne `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
80 81
 }
81 82
 
82 83
 func (ScheduleTwo) TableName() string {

+ 1 - 0
models/stock_models.go Datei anzeigen

@@ -69,6 +69,7 @@ type Warehousing struct {
69 69
 	IsSys             int64        `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
70 70
 	SecondWarehouseId int64        `gorm:"column:second_warehouse_id" json:"second_warehouse_id" form:"second_warehouse_id"`
71 71
 	IsCheck           int64        `gorm:"column:is_check" json:"is_check" form:"is_check"`
72
+	Checker           int64        `gorm:"column:checker" json:"checker" form:"checker"`
72 73
 }
73 74
 
74 75
 func (Warehousing) TableName() string {

+ 169 - 2
service/dialysis_service.go Datei anzeigen

@@ -1640,6 +1640,7 @@ func GetAllPcDialysisOrdersByList(orgID int64, scheduleDate int64) (dialysisOrde
1640 1640
 	redis := RedisClient()
1641 1641
 	defer redis.Close()
1642 1642
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":dialysis_orders_list_all"
1643
+
1643 1644
 	dialysis_orders_list_all, _ := redis.Get(key).Result()
1644 1645
 
1645 1646
 	if len(dialysis_orders_list_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -2020,7 +2021,7 @@ func FindAllDoctorAdviceByIds(orgID int64, ids []string) (advice []models.Doctor
2020 2021
 }
2021 2022
 
2022 2023
 func ExectionBloodMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
2023
-	fmt.Println("ids2323232323323223233223wode", ids)
2024
+
2024 2025
 	advice := models.DoctorAdviceThrity{}
2025 2026
 	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1}).Error
2026 2027
 	return err
@@ -2101,6 +2102,53 @@ func UpdateLastMonitorRecordToday(accumulated_blood_volume float64, id int64) er
2101 2102
 	return err
2102 2103
 }
2103 2104
 
2105
+func GetDialysisFinish(user_org_id int64, record_date int64, module int64, patient_id int64) (models.XtDialysisFinish, error) {
2106
+
2107
+	finish := models.XtDialysisFinish{}
2108
+
2109
+	err := XTReadDB().Where("user_org_id = ? and record_date = ? and status =1 and module = ? and patient_id = ?", user_org_id, record_date, module, patient_id).Find(&finish).Error
2110
+	return finish, err
2111
+}
2112
+
2113
+func CreateDialysisFinish(finish models.XtDialysisFinish) error {
2114
+
2115
+	err := XTWriteDB().Create(&finish).Error
2116
+
2117
+	return err
2118
+}
2119
+
2120
+func GetDialysisInformationSetting(user_org_id int64) (models.XtDialysisInformaitonSetting, error) {
2121
+
2122
+	setting := models.XtDialysisInformaitonSetting{}
2123
+
2124
+	err := XTReadDB().Where("user_org_id =? and status = 1", user_org_id).Find(&setting).Error
2125
+
2126
+	return setting, err
2127
+
2128
+}
2129
+
2130
+func CreatedDialysisInformation(information models.XtDialysisInformation) error {
2131
+
2132
+	err := XTWriteDB().Create(&information).Error
2133
+
2134
+	return err
2135
+}
2136
+
2137
+func GetDialysisInoformationById(patient_id int64, record_date int64, user_org_id int64, module int64) (models.XtDialysisInformation, error) {
2138
+
2139
+	information := models.XtDialysisInformation{}
2140
+	err := XTReadDB().Where("patient_id = ? and record_date = ? and user_org_id = ? and module = ? and status = 1", patient_id, record_date, user_org_id, module).Find(&information).Error
2141
+	return information, err
2142
+}
2143
+
2144
+func UpdateDialysisInformationById(patient_id int64, record_date int64, user_org_id int64, module int64, advice_date int64, remark string) error {
2145
+
2146
+	information := models.XtDialysisInformation{}
2147
+
2148
+	err := XTWriteDB().Model(&information).Where("patient_id = ? and record_date = ? and user_org_id  =? and module = ? and status=1", patient_id, record_date, user_org_id, module).Update(map[string]interface{}{"application_date": advice_date, "remark": remark}).Error
2149
+	return err
2150
+}
2151
+
2104 2152
 func UpdateDoctorAdviceByExcecute(id int64, user_org_id int64) error {
2105 2153
 
2106 2154
 	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("id = ? and user_org_id = ? and status =1", id, user_org_id).Updates(map[string]interface{}{"execution_time": 0, "execution_staff": 0, "execution_state": 2}).Error
@@ -2129,9 +2177,128 @@ func GetInformationSettingByOrgId(user_org_id int64) (models.XtDialysisInformait
2129 2177
 	return setting, err
2130 2178
 }
2131 2179
 
2132
-func GetDialysisInformationSetting(user_org_id int64) (infor []*models.XtDialysisInformaitonSetting, err error) {
2180
+func GetDialysisInformationSettingList(user_org_id int64) (infor []*models.XtDialysisInformaitonSetting, err error) {
2133 2181
 
2134 2182
 	err = XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&infor).Error
2135 2183
 
2136 2184
 	return infor, err
2137 2185
 }
2186
+
2187
+func GetDialysisInformationIsNoCheck(user_org_id int64, limit int64, page int64, application_status int64) (infor []*models.DialysisInformation, total int64, err error) {
2188
+
2189
+	db := XTReadDB().Model(&infor).Where("status= 1")
2190
+	if application_status > 0 {
2191
+		db = db.Where("application_status = ?", application_status)
2192
+	}
2193
+	if user_org_id > 0 {
2194
+		db = db.Where("user_org_id = ?", user_org_id)
2195
+	}
2196
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Find(&infor).Error
2197
+	return infor, total, err
2198
+}
2199
+
2200
+func GetDialysisInformationIsNoCheckOne(user_org_id int64, limit int64, page int64, application_status int64) (infor []*models.DialysisInformation, total int64, err error) {
2201
+
2202
+	db := XTReadDB().Model(&infor).Where("status= 1")
2203
+	if application_status > 0 {
2204
+		db = db.Where("application_status = ? or application_status= 3", application_status)
2205
+	}
2206
+	if user_org_id > 0 {
2207
+		db = db.Where("user_org_id = ?", user_org_id)
2208
+	}
2209
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Find(&infor).Error
2210
+	return infor, total, err
2211
+}
2212
+
2213
+func CheckDialysisInformation(id int64, application_status int64, timenow int64, checker int64) (models.DialysisInformation, error) {
2214
+
2215
+	information := models.DialysisInformation{}
2216
+
2217
+	err := XTWriteDB().Model(&information).Where("id=? and status = 1", id).Updates(map[string]interface{}{"application_status": application_status, "check_time": timenow, "checker": checker}).Error
2218
+
2219
+	return information, err
2220
+
2221
+}
2222
+
2223
+func GetDialysisWatchByKeywordFlow(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) ([]*models.DialysisScheduleFlow, error, int64) {
2224
+	var patients []*models.Patients
2225
+	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
2226
+	if getPatientErr != nil {
2227
+		return nil, getPatientErr, 0
2228
+	}
2229
+	patientIDs := make([]int64, len(patients))
2230
+	for index, patient := range patients {
2231
+		patientIDs[index] = patient.ID
2232
+	}
2233
+
2234
+	db := readDb.Model(&models.DialysisScheduleFlow{})
2235
+	if start > 0 && end > 0 {
2236
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2237
+			// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
2238
+			Preload("TreatmentMode", "status = 1").
2239
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date >= ? and record_date<=?", orgID, start, end).
2240
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2241
+	} else {
2242
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2243
+			Preload("TreatmentMode", "status = 1").
2244
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ?", orgID).
2245
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2246
+	}
2247
+
2248
+	db = db.Where("xt_schedule.status = 1 AND patient_id in (?)", patientIDs)
2249
+	if schedulType > 0 {
2250
+		db = db.Where("schedule_type = ?", schedulType)
2251
+	}
2252
+	if start > 0 {
2253
+		db = db.Where("schedule_date >= ?", start)
2254
+	}
2255
+	if end > 0 {
2256
+		db = db.Where("schedule_date<=?", end)
2257
+	}
2258
+	if partitionType > 0 {
2259
+		db = db.Joins("inner join xt_device_number as d_n on d_n.id = xt_schedule.bed_id and d_n.zone_id = ?", partitionType)
2260
+	}
2261
+	var schedules []*models.DialysisScheduleFlow
2262
+	total := int64(0)
2263
+	err := db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("schedule_date desc").Find(&schedules).Error
2264
+	return schedules, err, total
2265
+}
2266
+
2267
+func GetDialysisWatchFlow(orgID int64, schedulDate int64, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) (schedule []*models.DialysisScheduleFlow, err error, total int64) {
2268
+	db := readDb.Model(&models.DialysisScheduleFlow{})
2269
+
2270
+	fmt.Println("schedule_date--------------------", schedulDate)
2271
+	if schedulDate > 0 {
2272
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
2273
+			Preload("TreatmentMode", "status = 1").
2274
+			Preload("DialysisFinish", "status = 1 AND user_org_id = ? and record_date =?", orgID, schedulDate).
2275
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
2276
+		db = db.Where("xt_schedule.status = 1")
2277
+		db = db.Where("schedule_date = ?", schedulDate)
2278
+	}
2279
+	if schedulType > 0 {
2280
+		db = db.Where("schedule_type = ?", schedulType)
2281
+	}
2282
+	if start > 0 {
2283
+		db = db.Where("schedule_date >= ?", start)
2284
+	}
2285
+	if end > 0 {
2286
+		db = db.Where("schedule_date <= ?", end)
2287
+	}
2288
+	if orgID > 0 {
2289
+		db = db.Where("user_org_id = ?", orgID)
2290
+	}
2291
+	if partitionType > 0 {
2292
+		db = db.Joins("inner join xt_device_number on xt_device_number.id = xt_schedule.bed_id and xt_device_number.zone_id = ?", partitionType)
2293
+	}
2294
+	offset := (page - 1) * limit
2295
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("bed_id desc").Find(&schedule).Error
2296
+	return schedule, err, total
2297
+}
2298
+
2299
+func GetPrescriptionInfo(user_org_id int64, patient_id int64, record_date int64) (models.HisPrescriptionInfo, error) {
2300
+
2301
+	info := models.HisPrescriptionInfo{}
2302
+	err := XTReadDB().Where("user_org_id = ? and patient_id =? and record_date = ? and status=1", user_org_id, patient_id, record_date).Find(&info).Error
2303
+	return info, err
2304
+}

+ 58 - 0
service/gobal_config_service.go Datei anzeigen

@@ -1081,3 +1081,61 @@ func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (mod
1081 1081
 	err := XTReadDB().Where("patient_id = ? and assessment_date = ? and user_org_id =? and status= 1", patient_id, schedule_date, user_org_id).Find(&dislysis).Error
1082 1082
 	return dislysis, err
1083 1083
 }
1084
+
1085
+func GetDialysisInformationByRecordDate(patient_id int64, record_date int64, user_org_id int64) (models.XtDialysisInformation, error) {
1086
+
1087
+	information := models.XtDialysisInformation{}
1088
+	err := XTReadDB().Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, record_date, user_org_id).Find(&information).Error
1089
+	return information, err
1090
+}
1091
+
1092
+func SaveDialysisInformation(information models.XtDialysisInformation) error {
1093
+
1094
+	err := XTWriteDB().Create(&information).Error
1095
+
1096
+	return err
1097
+}
1098
+
1099
+func UpdateInformationByRecordDate(patient_id int64, record_date int64, user_org_id int64, application_date int64, remark string) error {
1100
+
1101
+	err := XTWriteDB().Model(&models.XtDialysisInformation{}).Where("patient_id = ? and record_date = ? and user_org_id = ? and status = 1", patient_id, record_date, user_org_id).Update(map[string]interface{}{"application_status": 2, "application_date": application_date, "remark": remark}).Error
1102
+	return err
1103
+}
1104
+
1105
+func GetMobileInformation(limit int64, page int64, application_status int64, orgid int64) (infor []*models.XtDialysisInformation, total int64, err error) {
1106
+
1107
+	db := XTReadDB().Model(&infor).Where("status=1")
1108
+
1109
+	if orgid > 0 {
1110
+		db = db.Where("user_org_id = ?", orgid)
1111
+	}
1112
+
1113
+	if application_status > 0 {
1114
+		db = db.Where("application_status = ?", application_status)
1115
+	}
1116
+
1117
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("ctime desc").Find(&infor).Error
1118
+
1119
+	return infor, total, err
1120
+
1121
+}
1122
+
1123
+func GetMobileInformationOne(limit int64, page int64, orgid int64) (infor []*models.XtDialysisInformation, total int64, err error) {
1124
+
1125
+	db := XTReadDB().Model(&infor).Where("status=1")
1126
+
1127
+	if orgid > 0 {
1128
+		db = db.Where("user_org_id = ?", orgid)
1129
+	}
1130
+
1131
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("ctime desc").Find(&infor).Error
1132
+
1133
+	return infor, total, err
1134
+
1135
+}
1136
+
1137
+func CheckMobileInformation(id int64, application_status int64, checker int64, checker_time int64) error {
1138
+
1139
+	err := XTWriteDB().Model(&models.XtDialysisInformation{}).Where("id = ? and status= 1", id).Update(map[string]interface{}{"application_status": application_status, "checker": checker, "check_time": checker_time}).Error
1140
+	return err
1141
+}

+ 7 - 0
service/his_service.go Datei anzeigen

@@ -1350,6 +1350,13 @@ func FindAllDiagnose(orgId int64) (list []*models.HisXtDiagnoseConfig, err error
1350 1350
 	return
1351 1351
 }
1352 1352
 
1353
+func FindPatientDianose(orgId int64) (list []*models.XtPatientDiagnose, err error) {
1354
+
1355
+	err = readDb.Where("user_org_id =?", orgId).Find(&list).Error
1356
+
1357
+	return list, err
1358
+}
1359
+
1353 1360
 func FindAllAddition(orgId int64) (list []*models.XtHisAddtionConfig, err error) {
1354 1361
 	db := readDb.Model(&models.XtHisAddtionConfig{})
1355 1362
 	db = db.Where("user_org_id = ? AND status = 1", orgId)

+ 44 - 0
service/manage_center_service.go Datei anzeigen

@@ -1035,3 +1035,47 @@ func GoodAutoAddCancelInfo(good *models.NewDialysisBeforePrepareGoods, creater i
1035 1035
 	}
1036 1036
 	return err
1037 1037
 }
1038
+
1039
+func CreatePatientDiagnose(diagnose models.XtPatientDiagnose) error {
1040
+
1041
+	err := XTWriteDB().Create(&diagnose).Error
1042
+
1043
+	return err
1044
+}
1045
+
1046
+func GetPatientDiagnose(limit int64, page int64, orgid int64) (list []*models.XtPatientDiagnose, total int64, err error) {
1047
+
1048
+	db := XTReadDB().Model(&list).Where("status =1")
1049
+
1050
+	if orgid > 0 {
1051
+		db = db.Where("user_org_id = ?", orgid)
1052
+	}
1053
+	offset := (page - 1) * limit
1054
+
1055
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("sort asc").Find(&list).Error
1056
+	return
1057
+}
1058
+
1059
+func GetPatientDiagnoseDetail(id int64) (models.XtPatientDiagnose, error) {
1060
+
1061
+	diagnose := models.XtPatientDiagnose{}
1062
+
1063
+	err := XTReadDB().Where("id = ? and status =1", id).Find(&diagnose).Error
1064
+
1065
+	return diagnose, err
1066
+}
1067
+
1068
+func UpdatePatientCase(class_name string, sort int64, id int64) error {
1069
+
1070
+	diagnose := models.XtPatientDiagnose{}
1071
+
1072
+	err := XTReadDB().Model(&diagnose).Where("id = ? and status=1", id).Updates(map[string]interface{}{"class_name": class_name, "sort": sort}).Error
1073
+
1074
+	return err
1075
+}
1076
+
1077
+func DeletePatientDiagnose(id int64) error {
1078
+
1079
+	err := XTWriteDB().Model(&models.XtPatientDiagnose{}).Where("id=? and status= 1", id).Updates(map[string]interface{}{"status": 0}).Error
1080
+	return err
1081
+}

+ 3 - 3
service/manage_service.go Datei anzeigen

@@ -374,7 +374,7 @@ func GetDialysisTime(time int64, patientid int64, orgid int64) (models.Assessmen
374 374
 }
375 375
 
376 376
 func GetAllOrganization(orgid int64, appid int64) (approle []*models.App_Role, err error) {
377
-	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = 1", orgid, appid).Find(&approle).Error
377
+	err = UserReadDB().Where("org_id = ? AND app_id = ?", orgid, appid).Find(&approle).Error
378 378
 	return approle, err
379 379
 }
380 380
 
@@ -824,7 +824,7 @@ func GetUserForm(id int64, orgId int64, limit int64, page int64) (infor []*model
824 824
 		if orgId > 0 {
825 825
 			db = db.Where("x.user_org_id = ?", orgId)
826 826
 		}
827
-		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date asc").Scan(&infor).Error
827
+		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.admin_user_id,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date asc").Scan(&infor).Error
828 828
 		if err != nil {
829 829
 			return
830 830
 		}
@@ -844,7 +844,7 @@ func GetUserForm(id int64, orgId int64, limit int64, page int64) (infor []*model
844 844
 		if orgId > 0 {
845 845
 			db = db.Where("x.user_org_id = ?", orgId)
846 846
 		}
847
-		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date desc").Scan(&infor).Error
847
+		err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.admin_user_id,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date desc").Scan(&infor).Error
848 848
 		if err != nil {
849 849
 			return
850 850
 		}

+ 6 - 5
service/mobile_dialysis_service.go Datei anzeigen

@@ -4482,13 +4482,14 @@ func GetFistMonitor(orgid int64, patient_id int64, dialysis_date int64) (models.
4482 4482
 	return record, err
4483 4483
 }
4484 4484
 
4485
+func GetFistMonitorSix(orgid int64, patient_id int64, dialysis_date int64) (record []*models.MonitoringRecord, err error) {
4486
+
4487
+	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and monitoring_date = ? and status = 1", orgid, patient_id, dialysis_date).Find(&record).Error
4488
+	return record, err
4489
+}
4490
+
4485 4491
 func MobileGetScheduleDoctorAdvicesOne(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64, deliverWay string, scheduleType int64, partitonType int64, patient_id int64, execution_state int64, cost_type int64, execution_frequency string) ([]*MScheduleDoctorAdviceVM, error) {
4486 4492
 
4487
-	fmt.Println("execution_frequency---------------------------", execution_frequency)
4488
-	fmt.Println("cost_type-----------", cost_type)
4489
-	fmt.Println("adviceType-----------", adviceType)
4490
-	fmt.Println("patientType---------", patientType)
4491
-	fmt.Println("len(deliverWay)--------", len(deliverWay))
4492 4493
 	var vms []*MScheduleDoctorAdviceVM
4493 4494
 	adviceWhere := ""
4494 4495
 	adviceCondition := []interface{}{}

+ 96 - 71
service/new_warehouse_service.go Datei anzeigen

@@ -1308,15 +1308,25 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1308 1308
 	// 如果没有对应的库存,则报错
1309 1309
 	storeConfig, _ := GetAllStoreHouseConfig(advice.UserOrgId)
1310 1310
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
1311
-	if lastWarehouse.StockMinNumber >= drup.MinNumber {
1312
-		var stockMax int64
1313
-		var stockMin int64
1314
-		stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
1315
-		stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
1311
+	if lastWarehouse.MaxUnit != lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
1312
+		if lastWarehouse.StockMinNumber >= drup.MinNumber {
1313
+			var stockMax int64
1314
+			var stockMin int64
1315
+			stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
1316
+			stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
1317
+
1318
+			ChangeMaxNumber(lastWarehouse.ID, stockMax)
1319
+			UpdateMinNumber(lastWarehouse.ID, stockMin)
1320
+		}
1321
+	}
1322
+
1323
+	if lastWarehouse.MaxUnit == lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
1324
+
1325
+		lastWarehouse.StockMaxNumber = lastWarehouse.StockMaxNumber + lastWarehouse.StockMinNumber
1326
+		ChangeMaxNumberOne(lastWarehouse.ID, lastWarehouse.StockMaxNumber)
1316 1327
 
1317
-		ChangeMaxNumber(lastWarehouse.ID, stockMax)
1318
-		UpdateMinNumber(lastWarehouse.ID, stockMin)
1319 1328
 	}
1329
+
1320 1330
 	warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
1321 1331
 
1322 1332
 	if err != nil {
@@ -1374,12 +1384,16 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1374 1384
 		}
1375 1385
 
1376 1386
 		if drup.MinUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
1387
+			//fmt.Println("金1")
1377 1388
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber*drup.MinNumber
1378 1389
 		}
1390
+
1379 1391
 		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit != drup.MinUnit {
1392
+			//fmt.Println("金2")
1380 1393
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
1381 1394
 		}
1382 1395
 		if drup.MaxUnit == warehouse.MaxUnit && drup.MaxUnit == drup.MinUnit {
1396
+			//fmt.Println("金3")
1383 1397
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
1384 1398
 		}
1385 1399
 
@@ -1392,13 +1406,16 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1392 1406
 
1393 1407
 		warehouse.Mtime = time.Now().Unix()
1394 1408
 
1409
+		//fmt.Println("stockmin", warehouse.StockMinNumber)
1410
+		//fmt.Println("minnubmerr", minNumber)
1395 1411
 		if warehouse.StockMinNumber < minNumber {
1396
-
1412
+			//fmt.Println("金4")
1397 1413
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1398 1414
 			if warehouse.MaxUnit != warehouse.MinUnit {
1399 1415
 				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
1400 1416
 			}
1401 1417
 		} else {
1418
+			//fmt.Println("金5")
1402 1419
 			if minNumber > 0 {
1403 1420
 				if (warehouse.StockMinNumber - minNumber) >= 0 {
1404 1421
 					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
@@ -1407,6 +1424,7 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1407 1424
 			}
1408 1425
 
1409 1426
 			if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
1427
+				//fmt.Println("6")
1410 1428
 				if warehouse.StockMinNumber > 0 {
1411 1429
 					if warehouse.StockMinNumber-deliver_number >= 0 {
1412 1430
 						warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
@@ -1418,8 +1436,9 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1418 1436
 
1419 1437
 		}
1420 1438
 
1421
-		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
1439
+		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit && warehouse.MaxUnit != warehouse.MinUnit {
1422 1440
 			if (warehouse.StockMinNumber - deliver_number) >= 0 {
1441
+				//fmt.Println("金7")
1423 1442
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1424 1443
 			}
1425 1444
 
@@ -1561,74 +1580,80 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1561 1580
 		}
1562 1581
 
1563 1582
 		//如果本次出库数据大于历史出库数据 新增1条流水
1583
+		//fmt.Println("deliver_number233233223232wi", deliver_number)
1584
+		//fmt.Println("out_coutn23333333333333333", out_count)
1585
+		//fmt.Println("cancel_coutn099992ow", cancel_count)
1564 1586
 		if deliver_number >= (out_count - cancel_count) {
1565
-			drugflow := models.DrugFlow{
1566
-				WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
1567
-				WarehouseOutId:          warehouseout.ID,
1568
-				DrugId:                  advice.DrugId,
1569
-				Number:                  warehouse.Number,
1570
-				ProductDate:             warehouse.ProductDate,
1571
-				ExpireDate:              warehouse.ExpiryDate,
1572
-				Count:                   deliver_number - (out_count - cancel_count), //按最小单位计算,
1573
-				Price:                   warehouse.RetailPrice,
1574
-				Status:                  1,
1575
-				Ctime:                   time.Now().Unix(),
1576
-				UserOrgId:               orgID,
1577
-				Manufacturer:            warehouse.Manufacturer,
1578
-				Dealer:                  warehouse.Dealer,
1579
-				BatchNumber:             warehouse.BatchNumber,
1580
-				MaxUnit:                 drup.MinUnit,
1581
-				ConsumableType:          3,
1582
-				IsEdit:                  1,
1583
-				Creator:                 advice.ExecutionStaff,
1584
-				IsSys:                   1,
1585
-				PatientId:               advice.PatientId,
1586
-				SystemTime:              advice.AdviceDate,
1587
-				WarehousingDetailId:     warehouse.ID,
1588
-				SupplyWarehouseId:       warehouse.SupplyWarehouseId,
1589
-				StorehouseId:            storeConfig.DrugStorehouseOut,
1590
-				WarehouseOutDetailId:    lastDrugOutInfo.ID,
1591
-				OverCount:               sum_count,
1592
-				AdviceId:                advice.ID,
1593
-				LastPrice:               warehouse.Price,
1594
-			}
1587
+			if (deliver_number - out_count - cancel_count) != 0 {
1588
+				drugflow := models.DrugFlow{
1589
+					WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
1590
+					WarehouseOutId:          warehouseout.ID,
1591
+					DrugId:                  advice.DrugId,
1592
+					Number:                  warehouse.Number,
1593
+					ProductDate:             warehouse.ProductDate,
1594
+					ExpireDate:              warehouse.ExpiryDate,
1595
+					Count:                   deliver_number - (out_count - cancel_count), //按最小单位计算,
1596
+					Price:                   warehouse.RetailPrice,
1597
+					Status:                  1,
1598
+					Ctime:                   time.Now().Unix(),
1599
+					UserOrgId:               orgID,
1600
+					Manufacturer:            warehouse.Manufacturer,
1601
+					Dealer:                  warehouse.Dealer,
1602
+					BatchNumber:             warehouse.BatchNumber,
1603
+					MaxUnit:                 drup.MinUnit,
1604
+					ConsumableType:          3,
1605
+					IsEdit:                  1,
1606
+					Creator:                 advice.ExecutionStaff,
1607
+					IsSys:                   1,
1608
+					PatientId:               advice.PatientId,
1609
+					SystemTime:              advice.AdviceDate,
1610
+					WarehousingDetailId:     warehouse.ID,
1611
+					SupplyWarehouseId:       warehouse.SupplyWarehouseId,
1612
+					StorehouseId:            storeConfig.DrugStorehouseOut,
1613
+					WarehouseOutDetailId:    lastDrugOutInfo.ID,
1614
+					OverCount:               sum_count,
1615
+					AdviceId:                advice.ID,
1616
+					LastPrice:               warehouse.Price,
1617
+				}
1595 1618
 
1596
-			errThreeTy := CreateDrugFlowOne(drugflow)
1619
+				errThreeTy := CreateDrugFlowOne(drugflow)
1597 1620
 
1598
-			if errThreeTy != nil {
1599
-				drugError := models.XtDrugError{
1600
-					UserOrgId:             orgID,
1601
-					DrugId:                advice.DrugId,
1602
-					RecordDate:            advice.AdviceDate,
1603
-					PatientId:             advice.PatientId,
1604
-					Remark:                "创建流水失败",
1605
-					Status:                1,
1606
-					Ctime:                 time.Now().Unix(),
1607
-					Mtime:                 0,
1608
-					SumCount:              0,
1609
-					Prescribingnumber:     advice.PrescribingNumber,
1610
-					PrescribingNumberUnit: advice.PrescribingNumberUnit,
1621
+				if errThreeTy != nil {
1622
+					drugError := models.XtDrugError{
1623
+						UserOrgId:             orgID,
1624
+						DrugId:                advice.DrugId,
1625
+						RecordDate:            advice.AdviceDate,
1626
+						PatientId:             advice.PatientId,
1627
+						Remark:                "创建流水失败",
1628
+						Status:                1,
1629
+						Ctime:                 time.Now().Unix(),
1630
+						Mtime:                 0,
1631
+						SumCount:              0,
1632
+						Prescribingnumber:     advice.PrescribingNumber,
1633
+						PrescribingNumberUnit: advice.PrescribingNumberUnit,
1634
+					}
1635
+					CreateDrugError(drugError)
1611 1636
 				}
1612
-				CreateDrugError(drugError)
1613
-			}
1614
-			//出库数量相加
1615
-			errThreeTys := AddDrugCount(advice.DrugId, orgID, storeConfig.DrugStorehouseOut, drugflow.Count)
1637
+				//出库数量相加
1638
+				errThreeTys := AddDrugCount(advice.DrugId, orgID, storeConfig.DrugStorehouseOut, drugflow.Count)
1616 1639
 
1617
-			if errThreeTys != nil {
1618
-				drugError := models.XtDrugError{
1619
-					UserOrgId:             orgID,
1620
-					DrugId:                advice.DrugId,
1621
-					RecordDate:            advice.AdviceDate,
1622
-					PatientId:             advice.PatientId,
1623
-					Remark:                "出库数量相加失败",
1624
-					Status:                1,
1625
-					Ctime:                 time.Now().Unix(),
1626
-					Mtime:                 0,
1627
-					SumCount:              0,
1628
-					Prescribingnumber:     advice.PrescribingNumber,
1629
-					PrescribingNumberUnit: advice.PrescribingNumberUnit,
1640
+				if errThreeTys != nil {
1641
+					drugError := models.XtDrugError{
1642
+						UserOrgId:             orgID,
1643
+						DrugId:                advice.DrugId,
1644
+						RecordDate:            advice.AdviceDate,
1645
+						PatientId:             advice.PatientId,
1646
+						Remark:                "出库数量相加失败",
1647
+						Status:                1,
1648
+						Ctime:                 time.Now().Unix(),
1649
+						Mtime:                 0,
1650
+						SumCount:              0,
1651
+						Prescribingnumber:     advice.PrescribingNumber,
1652
+						PrescribingNumberUnit: advice.PrescribingNumberUnit,
1653
+					}
1654
+					CreateDrugError(drugError)
1630 1655
 				}
1631
-				CreateDrugError(drugError)
1656
+
1632 1657
 			}
1633 1658
 
1634 1659
 		}

+ 44 - 2
service/patient_service.go Datei anzeigen

@@ -871,7 +871,7 @@ func UpdatePatientLapseto(patientid int64, lapseto models.PatientLapseto) error
871 871
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
872 872
 
873 873
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
874
-		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan}).Error
874
+		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber}).Error
875 875
 	return err
876 876
 }
877 877
 
@@ -1240,6 +1240,48 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
1240 1240
 	return
1241 1241
 }
1242 1242
 
1243
+func GetLongDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64, keywords string, page int64, limit int64) (advices []*models.DoctorAdvices, total int64, err error) {
1244
+
1245
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
1246
+	table := UserReadDB().Table("sgj_user_admin_role as r")
1247
+	fmt.Print("table", table)
1248
+	if orgID > 0 {
1249
+		db = db.Where("x.user_org_id=?", orgID)
1250
+	}
1251
+	if patientID > 0 {
1252
+		db = db.Where("x.patient_id = ?", patientID)
1253
+	}
1254
+	if advice_type == 1 && advice_type > 0 {
1255
+		db = db.Where("x.advice_type = ?", advice_type)
1256
+	}
1257
+	if advice_type == 3 && advice_type > 0 {
1258
+		db = db.Where("x.advice_type = 2 or x.advice_type = 3")
1259
+	}
1260
+	if advice_type == 4 && advice_type > 0 {
1261
+		db = db.Where("x.advice_type = 4")
1262
+	}
1263
+	if stop == 1 {
1264
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
1265
+	} else if stop == 2 {
1266
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
1267
+	}
1268
+
1269
+	if start != 0 {
1270
+		db = db.Where("x.start_time>=?", start)
1271
+	}
1272
+	if end != 0 {
1273
+		db = db.Where("x.start_time<=?", end)
1274
+	}
1275
+	if len(keywords) > 0 {
1276
+		likeKey := "%" + keywords + "%"
1277
+		db = db.Where("x.advice_name LIKE ?", likeKey)
1278
+	}
1279
+	offset := (page - 1) * limit
1280
+	err = db.Group("x.id").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,x.push_start_time,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
1281
+	fmt.Print("err", err)
1282
+	return
1283
+}
1284
+
1243 1285
 func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string, page int64, limit int64) (advices []*models.DoctorAdvices, total int64, err error) {
1244 1286
 
1245 1287
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
@@ -1949,7 +1991,7 @@ func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDial
1949 1991
 
1950 1992
 func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1951 1993
 
1952
-	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator, "bilirubin_adsorption_column": prescription.BilirubinAdsorptionColumn, "oxygen_uptake": prescription.OxygenUptake, "oxygen_flow": prescription.OxygenFlow, "oxygen_time": prescription.OxygenTime, "dialysis_strainer": prescription.DialysisStrainer}).Error
1994
+	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator, "bilirubin_adsorption_column": prescription.BilirubinAdsorptionColumn, "oxygen_uptake": prescription.OxygenUptake, "oxygen_flow": prescription.OxygenFlow, "oxygen_time": prescription.OxygenTime, "dialysis_strainer": prescription.DialysisStrainer, "chaptalization": prescription.Chaptalization}).Error
1953 1995
 	return err
1954 1996
 }
1955 1997
 

+ 1 - 1
service/patientmanage_service.go Datei anzeigen

@@ -912,7 +912,7 @@ func GetDialysisrecord(patientID int64, start int64, end int64, limit int64, pag
912 912
 
913 913
 func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.SgjUserAdminRole, err error) {
914 914
 
915
-	err = UserReadDB().Where("org_id = ? and app_id = ? and status = ? ", orgid, appid, 1).Find(&appRole).Error
915
+	err = UserReadDB().Where("org_id = ? and app_id = ?", orgid, appid).Find(&appRole).Error
916 916
 	return appRole, err
917 917
 }
918 918
 

+ 1 - 2
service/pharmacy_service.go Datei anzeigen

@@ -1226,8 +1226,7 @@ func FenDrugInventory(item *models.HisDoctorAdviceInfo, orgid int64) bool {
1226 1226
 		total = list.Count*medical.MinNumber + list.StockMinNumber
1227 1227
 		prescribing_number_total = count
1228 1228
 	}
1229
-	fmt.Println("prescribing_number_total-----", prescribing_number_total)
1230
-	fmt.Println("total-------------", total)
1229
+
1231 1230
 	if prescribing_number_total <= total {
1232 1231
 		//可以扣减
1233 1232
 		return true

+ 7 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Datei anzeigen

@@ -303,6 +303,11 @@ type AssessmentBeforeDislysisVM struct {
303 303
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
304 304
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
305 305
 	UserOrgId                      int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
306
+	CatheterEvaluationProgram      string  `gorm:"column:catheter_evaluation_program" json:"catheter_evaluation_program" form:"catheter_evaluation_program"`
307
+	SkinSiteCatheterization        string  `gorm:"column:skin_site_catheterization" json:"skin_site_catheterization" form:"skin_site_catheterization"`
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"`
310
+	PathwayFormationTime           int64   `gorm:"column:pathway_formation_time" json:"pathway_formation_time" form:"pathway_formation_time"`
306 311
 }
307 312
 
308 313
 func (AssessmentBeforeDislysisVM) TableName() string {
@@ -567,6 +572,8 @@ type MonitoringRecordVM struct {
567 572
 	BloodPressureMonitoringSite int64   `gorm:"column:blood_pressure_monitoring_site" json:"blood_pressure_monitoring_site" form:"blood_pressure_monitoring_site"`
568 573
 	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
569 574
 	FilterPressure              string  `gorm:"column:filter_pressure" json:"filter_pressure" form:"filter_pressure"`
575
+	Dicarbonate                 float64 `gorm:"column:dicarbonate" json:"dicarbonate" form:"dicarbonate"`
576
+	ReplacementSpeed            float64 `gorm:"column:replacement_speed" json:"replacement_speed" form:"replacement_speed"`
570 577
 }
571 578
 
572 579
 func (MonitoringRecordVM) TableName() string {

+ 18 - 0
service/schedule_service.go Datei anzeigen

@@ -168,6 +168,7 @@ func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, schedu
168 168
 		db = db.Where("s.schedule_week in(?)", WeekDayIds)
169 169
 	}
170 170
 	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
171
+		Preload("DialysisSolution", "status= 1 and solution_status = 1").
171 172
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
172 173
 		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
173 174
 		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time,s.dialysis_machine_name, p.name as patient").
@@ -1670,3 +1671,20 @@ func CreateScheduleTwo(m *models.Schedule) error {
1670 1671
 	utx.Commit()
1671 1672
 	return err
1672 1673
 }
1674
+
1675
+func GetLongSolutionByModeId(patient_id int64, mode_id int64, user_org_id int64) (models.DialysisSolution, error) {
1676
+
1677
+	solution := models.DialysisSolution{}
1678
+
1679
+	err := XTReadDB().Where("patient_id = ? and mode_id = ? and user_org_id = ? and status= 1 and solution_status =1", patient_id, mode_id, user_org_id).Find(&solution).Error
1680
+	return solution, err
1681
+}
1682
+
1683
+func UpdateScheduleByDialysis(patient_id int64, mode_id int64, schedule_date int64, user_org_id int64, dialyzer_perfusion_apparatus string, schedule_type int64) error {
1684
+
1685
+	schedule := models.XtSchedule{}
1686
+
1687
+	err := XTWriteDB().Model(&schedule).Where("patient_id = ? and mode_id = ? and schedule_date = ? and user_org_id = ? and schedule_type = ?", patient_id, mode_id, schedule_date, user_org_id, schedule_type).Updates(map[string]interface{}{"dialysis_machine_name": dialyzer_perfusion_apparatus}).Error
1688
+
1689
+	return err
1690
+}

+ 6 - 5
service/stock_service.go Datei anzeigen

@@ -982,6 +982,7 @@ type VMDrugWarehouse struct {
982 982
 	StorehouseId      int64                `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
983 983
 	IsSys             int64                `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
984 984
 	IsCheck           int64                `gorm:"column:is_check" json:"is_check" form:"is_check"`
985
+	Checker           int64                `gorm:"column:checker" json:"checker" form:"checker"`
985 986
 }
986 987
 
987 988
 func (VMDrugWarehouse) TableName() string {
@@ -6299,7 +6300,7 @@ func UpdateWarehouseInfoByGoodId(info models.WarehousingInfo, id int64) error {
6299 6300
 
6300 6301
 func UpdateWarehouseInfoByGoodIdOne(info *models.WarehousingInfo, id int64) error {
6301 6302
 
6302
-	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber}).Error
6303
+	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber, "good_id": info.GoodId}).Error
6303 6304
 	return err
6304 6305
 }
6305 6306
 
@@ -7366,10 +7367,10 @@ func UpdateWarehouseDetail(info *models.WarehousingInfo, id int64) error {
7366 7367
 	return err
7367 7368
 }
7368 7369
 
7369
-func UpdateCheckWarehouseInfo(id int64) error {
7370
+func UpdateCheckWarehouseInfo(id int64, checker int64) error {
7370 7371
 
7371 7372
 	tx := XTWriteDB().Begin()
7372
-	err := tx.Model(&models.Warehousing{}).Where("id =? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7373
+	err := tx.Model(&models.Warehousing{}).Where("id =? and status = 1", id).Update(map[string]interface{}{"is_check": 1, "checker": checker}).Error
7373 7374
 	if err != nil {
7374 7375
 		tx.Rollback()
7375 7376
 		return err
@@ -7506,9 +7507,9 @@ func UpdateWarehouseing(info *models.DrugWarehouseInfo) error {
7506 7507
 	return err
7507 7508
 }
7508 7509
 
7509
-func CheckWarehousingInfo(id int64, orgid int64) error {
7510
+func CheckWarehousingInfo(id int64, orgid int64, checker int64) error {
7510 7511
 	tx := XTWriteDB().Begin()
7511
-	err := tx.Model(&models.DrugWarehouse{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
7512
+	err := tx.Model(&models.DrugWarehouse{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"is_check": 1, "checker": checker}).Error
7512 7513
 	if err != nil {
7513 7514
 		tx.Rollback()
7514 7515
 		return err

+ 25 - 10
service/warhouse_service.go Datei anzeigen

@@ -131,15 +131,25 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
131 131
 	// 如果没有对应的库存,则报错
132 132
 	storeConfig, _ := GetAllStoreHouseConfig(advice.UserOrgId)
133 133
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
134
-	if lastWarehouse.StockMinNumber >= drup.MinNumber {
135
-		var stockMax int64
136
-		var stockMin int64
137
-		stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
138
-		stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
134
+	if lastWarehouse.MaxUnit != lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
135
+		if lastWarehouse.StockMinNumber >= drup.MinNumber {
136
+			var stockMax int64
137
+			var stockMin int64
138
+			stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
139
+			stockMin = lastWarehouse.StockMinNumber % drup.MinNumber
139 140
 
140
-		ChangeMaxNumber(lastWarehouse.ID, stockMax)
141
-		UpdateMinNumber(lastWarehouse.ID, stockMin)
141
+			ChangeMaxNumber(lastWarehouse.ID, stockMax)
142
+			UpdateMinNumber(lastWarehouse.ID, stockMin)
143
+		}
142 144
 	}
145
+
146
+	if lastWarehouse.MaxUnit == lastWarehouse.MinUnit && drup.MaxUnit != drup.MinUnit && lastWarehouse.MinUnit != "" {
147
+
148
+		lastWarehouse.StockMaxNumber = lastWarehouse.StockMaxNumber + lastWarehouse.StockMinNumber
149
+		ChangeMaxNumberOne(lastWarehouse.ID, lastWarehouse.StockMaxNumber)
150
+
151
+	}
152
+
143 153
 	warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
144 154
 
145 155
 	if err != nil {
@@ -554,7 +564,6 @@ func HisDrugsDelivery(orgID int64, creater int64, advice *models.HisDoctorAdvice
554 564
 		drup, _ := FindBaseDrugLibRecord(orgID, advice.DrugId)
555 565
 		if drup.ID > 0 {
556 566
 			prescribingNumber := advice.PrescribingNumber
557
-			//HisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice)
558 567
 
559 568
 			BloodHisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice)
560 569
 
@@ -1856,7 +1865,7 @@ func ConsumablesDeliveryDelete(orgID int64, patient_id int64, record_time int64,
1856 1865
 		if errThree != nil {
1857 1866
 			return errThree
1858 1867
 		}
1859
-		fmt.Println("errThreee23333333333333333333333", errThree)
1868
+
1860 1869
 		//查询剩余库存
1861 1870
 		houseConfig, _ := GetAllStoreHouseConfig(orgID)
1862 1871
 		goodList, _ := GetAllGoodSumCount(good_yc.GoodId, orgID, houseConfig.StorehouseOutInfo)
@@ -1864,7 +1873,7 @@ func ConsumablesDeliveryDelete(orgID int64, patient_id int64, record_time int64,
1864 1873
 		for _, item := range goodList {
1865 1874
 			sum_count += item.StockCount
1866 1875
 		}
1867
-		fmt.Println("sum_count++++++++++++++++++++++++++++++++=", sum_count)
1876
+
1868 1877
 		// 判断当前出库的数据和删除出库数量
1869 1878
 		if good_yc.Count <= ware.Count {
1870 1879
 			delete_count = good_yc.Count
@@ -5988,6 +5997,12 @@ func ChangeMaxNumber(id int64, count int64) error {
5988 5997
 	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1 and is_check = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number + ?", count)).Error
5989 5998
 	return err
5990 5999
 
6000
+}
6001
+func ChangeMaxNumberOne(id int64, count int64) error {
6002
+
6003
+	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1 and is_check = 1", id).Updates(map[string]interface{}{"stock_max_number": count, "stock_min_number": 0}).Error
6004
+	return err
6005
+
5991 6006
 }
5992 6007
 
5993 6008
 func UpdateMinNumber(id int64, count int64) error {