Browse Source

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

28169 1 year ago
parent
commit
a85da3967a

+ 515 - 4
controllers/dialysis_api_controller.go View File

@@ -112,6 +112,8 @@ 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")
@@ -618,8 +620,51 @@ func (c *DialysisApiController) PostPrescription() {
618 620
 			prescription.AdminUserId = adminUserInfo.AdminUser.Id
619 621
 		}
620 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
+
621 648
 		err := service.AddSigleRecord(&prescription)
622 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
+
623 668
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
624 669
 		redis := service.RedisClient()
625 670
 		//清空key 值
@@ -646,6 +691,7 @@ func (c *DialysisApiController) PostPrescription() {
646 691
 
647 692
 	} else { //修改
648 693
 		if mode_id > 0 {
694
+
649 695
 			var str string
650 696
 			//查找该机构用的是什么透析器
651 697
 			filedConfig, _ := service.GetFiledConfig(adminUserInfo.CurrentOrgId)
@@ -689,6 +735,31 @@ func (c *DialysisApiController) PostPrescription() {
689 735
 		prescription.Modifier = adminUserInfo.AdminUser.Id
690 736
 		prescription.ID = dialysisPrescription.ID
691 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
+
692 763
 		updateErr := service.UpDateDialysisPrescription(&prescription)
693 764
 
694 765
 		//修改处方
@@ -902,6 +973,30 @@ func (c *DialysisApiController) PostSoulution() {
902 973
 	//	}
903 974
 	//}
904 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
+
905 1000
 	prescription := models.DialysisPrescription{
906 1001
 		UserOrgId:                 adminUserInfo.CurrentOrgId,
907 1002
 		PatientId:                 patient,
@@ -1072,6 +1167,24 @@ func (c *DialysisApiController) PostSoulution() {
1072 1167
 	//  }
1073 1168
 	//}
1074 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
+
1075 1188
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1076 1189
 	if dialysisPrescription.ID == 0 { //新增
1077 1190
 		if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -1455,6 +1568,31 @@ func (c *DialysisApiController) PostDouleCheck() {
1455 1568
 		NeedleBatchNumber:          needle_batch_number,
1456 1569
 	}
1457 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
+
1458 1596
 	_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1459 1597
 	if check.ID == 0 { //新增
1460 1598
 		doubleCheck.FirstCheckTime = firstCheckTimeDate
@@ -1463,6 +1601,48 @@ func (c *DialysisApiController) PostDouleCheck() {
1463 1601
 		doubleCheck.Modifier = modifier
1464 1602
 
1465 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
+		}
1466 1646
 		redis := service.RedisClient()
1467 1647
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1468 1648
 
@@ -1594,9 +1774,51 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1594 1774
 		Diacrisis:                    diacrisis,
1595 1775
 	}
1596 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
+
1597 1802
 	if receiveTreatment.ID == 0 { //新增
1598 1803
 		receiveTreatmentAsses.Creater = adminUserInfo.AdminUser.Id
1599 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
+		}
1600 1822
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":receive_treatment_asses"
1601 1823
 		redis := service.RedisClient()
1602 1824
 		//清空key 值
@@ -1776,7 +1998,33 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1776 1998
 		}
1777 1999
 
1778 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
+		}
1779 2026
 		err = service.UpdateAssessmentAfterDislysisRecord(&assessment)
2027
+
1780 2028
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
1781 2029
 		redis := service.RedisClient()
1782 2030
 		//清空key 值
@@ -1800,6 +2048,22 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1800 2048
 		assessment.AssessmentDate = recordDate.Unix()
1801 2049
 
1802 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
+		}
1803 2067
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
1804 2068
 		redis := service.RedisClient()
1805 2069
 		//清空key 值
@@ -2031,8 +2295,49 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2031 2295
 
2032 2296
 		}
2033 2297
 
2034
-		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
2298
+		// 查询信息规挡的设置天数
2299
+
2300
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2301
+		if infor.ID > 0 {
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
+		}
2035 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
+		}
2036 2341
 		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 {
2037 2342
 			var dewater_amount float64
2038 2343
 			dewater_amount = 0
@@ -2483,6 +2788,31 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2483 2788
 			}
2484 2789
 		}
2485 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
+
2486 2816
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
2487 2817
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
2488 2818
 		redis := service.RedisClient()
@@ -2561,7 +2891,48 @@ func (c *DialysisApiController) PostTreatmentSummary() {
2561 2891
 	_, tempTreatmentSummary := service.FindTreatmentSummaryByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
2562 2892
 	if tempTreatmentSummary.ID == 0 { //新增
2563 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
+		}
2564 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
+		}
2565 2936
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summary"
2566 2937
 		redis := service.RedisClient()
2567 2938
 		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summarys_list_all"
@@ -3091,8 +3462,33 @@ func (this *DialysisApiController) DelMonitor() {
3091 3462
 	//		}
3092 3463
 	//	}
3093 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
+	}
3094 3489
 
3095 3490
 	err := service.DisableMonitor(adminInfo.CurrentOrgId, patientID, recordID, adminInfo.AdminUser.Id)
3491
+
3096 3492
 	key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(monitor.MonitoringDate, 10) + ":monitor_records"
3097 3493
 	redis := service.RedisClient()
3098 3494
 	//清空key 值
@@ -3213,7 +3609,49 @@ func (c *DialysisApiController) CreateMonitor() {
3213 3609
 		Dicarbonate:               dicarbonate,
3214 3610
 	}
3215 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
+
3216 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
+
3217 3655
 	redis := service.RedisClient()
3218 3656
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(monitoring_date, 10) + ":monitor_record_list_all"
3219 3657
 
@@ -4318,6 +4756,24 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
4318 4756
 	}
4319 4757
 
4320 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
+	}
4321 4777
 	redis := service.RedisClient()
4322 4778
 	formatAdviceDate := theTime.Format("2006-01-02")
4323 4779
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
@@ -6196,13 +6652,13 @@ func (this *DialysisApiController) GetDialysisInformationSetting() {
6196 6652
 
6197 6653
 	limit, _ := this.GetInt64("limit")
6198 6654
 	page, _ := this.GetInt64("page")
6199
-	informationSetting, _ := service.GetDialysisInformationSetting(orgId)
6655
+	informationSetting, _ := service.GetDialysisInformationSettingList(orgId)
6200 6656
 
6201 6657
 	//未审核
6202 6658
 	infor, total, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 2)
6203 6659
 
6204
-	//已经审核
6205
-	inforList, totalOne, _ := service.GetDialysisInformationIsNoCheck(orgId, limit, page, 1)
6660
+	//全部
6661
+	inforList, totalOne, _ := service.GetDialysisInformationIsNoCheckOne(orgId, limit, page, 1)
6206 6662
 
6207 6663
 	patients, _ := service.GetAllpatientThirty(orgId)
6208 6664
 
@@ -6270,3 +6726,58 @@ func (this *DialysisApiController) GetDialysisPatientsFlow() {
6270 6726
 		}
6271 6727
 	}
6272 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 View File

@@ -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()

File diff suppressed because it is too large
+ 709 - 16
controllers/mobile_api_controllers/dialysis_api_controller.go


+ 90 - 1
controllers/mobile_api_controllers/dialysis_api_controller_extend.go View File

@@ -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 {

+ 5 - 6
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

@@ -151,16 +151,15 @@ func (this *MobileBaseAPIAuthController) Prepare() {
151 151
 			var userRolePurviews string
152 152
 			var userRolePurviewsArr []string
153 153
 
154
-			fmt.Println("----redis 开始----")
155
-			fmt.Println(purviews_json_str)
156
-			fmt.Println("----redis 结束----")
154
+			//fmt.Println("----redis 开始----")
155
+			//fmt.Println(purviews_json_str)
156
+			//fmt.Println("----redis 结束----")
157 157
 
158
-			fmt.Println("purviews_json_str0000000000000000000000000000", len(purviews_json_str))
159 158
 			if len(purviews_json_str) == 0 {
160 159
 				for _, item := range roles {
161 160
 					role_id, _ := strconv.ParseInt(item, 10, 64)
162 161
 					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
163
-					fmt.Println("2333333333333333333", purviews)
162
+
164 163
 					if len(userRolePurviews) == 0 {
165 164
 						userRolePurviews = purviews
166 165
 					} else {
@@ -171,7 +170,6 @@ func (this *MobileBaseAPIAuthController) Prepare() {
171 170
 				userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
172 171
 				//缓存数据
173 172
 				purview_json, err := json.Marshal(userRolePurviewsArr)
174
-				fmt.Println("errr-------------------", err)
175 173
 				if err == nil {
176 174
 					redis.Set(key, purview_json, time.Minute*60*60*24)
177 175
 				}
@@ -189,6 +187,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
189 187
 
190 188
 			//系统所记录的权限列表
191 189
 			allPermission, _ := service.GetAllFunctionPurview()
190
+
192 191
 			for _, item := range allPermission {
193 192
 				//判断当前路由是否在权限路由列表里面
194 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 View File

@@ -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
 }

+ 585 - 2
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -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
@@ -621,6 +692,32 @@ func (c *PatientApiController) ExecDoctorAdvice() {
621 692
 		var err error
622 693
 
623 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
+			}
624 721
 			err = service.ExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
625 722
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
626 723
 			redis := service.RedisClient()
@@ -643,7 +740,30 @@ func (c *PatientApiController) ExecDoctorAdvice() {
643 740
 
644 741
 			defer redis.Close()
645 742
 		} else {
743
+			// 查询信息规挡的设置天数
744
+
745
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
746
+			if infor.ID > 0 {
747
+
748
+				var cha_time int64
646 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
+					}
764
+
765
+				}
766
+			}
647 767
 			err = service.BatchExceOldDoctorAdvice(&advices, ids)
648 768
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
649 769
 			redis := service.RedisClient()
@@ -1133,6 +1253,31 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1133 1253
 			item.ExecutionStaff = adminInfo.AdminUser.Id
1134 1254
 			item.ExecutionTime = theTime.Unix()
1135 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
+			}
1136 1281
 			err = service.SaveHisDoctorAdvice(item)
1137 1282
 			if err == nil {
1138 1283
 				drugError := models.XtDrugError{
@@ -1557,6 +1702,30 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1557 1702
 	var err error
1558 1703
 	if groupno > 0 {
1559 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
+		}
1560 1729
 		err = service.ModifyExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1561 1730
 		redis := service.RedisClient()
1562 1731
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -1568,6 +1737,28 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1568 1737
 		defer redis.Close()
1569 1738
 
1570 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
+		}
1571 1762
 		err = service.BatchModifyExceOldDoctorAdvice(&advices, ids)
1572 1763
 
1573 1764
 		err = service.ModifyExceDoctorAdviceByGroupNoOne(&advices, ids)
@@ -1638,7 +1829,8 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
1638 1829
 
1639 1830
 func (c *PatientApiController) CheckDoctorAdvice() {
1640 1831
 	origin, _ := c.GetInt64("origin", 0)
1641
-
1832
+	record_date, _ := c.GetInt64("record_date")
1833
+	patient_id, _ := c.GetInt64("patient_id")
1642 1834
 	if origin != 2 {
1643 1835
 		groupno, _ := c.GetInt64("groupno", -1)
1644 1836
 		var ids []string
@@ -1708,6 +1900,31 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1708 1900
 		}
1709 1901
 		var err error
1710 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
+			}
1711 1928
 			err = service.CheckDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1712 1929
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1713 1930
 			redis := service.RedisClient()
@@ -1734,6 +1951,30 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1734 1951
 				//timeLayout2 := "2006-01-02"
1735 1952
 				//loc, _ := time.LoadLocation("Local")
1736 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
+				}
1737 1978
 				err = service.BatchCheckOldDoctorAdvice(&advices, ids, adminUserInfo.Org.Id, advice.AdviceDate)
1738 1979
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1739 1980
 				redis := service.RedisClient()
@@ -1784,6 +2025,30 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1784 2025
 			item.Checker = adminInfo.AdminUser.Id
1785 2026
 			item.CheckTime = time.Now().Unix()
1786 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
+			}
1787 2052
 			err = service.SaveHisDoctorAdvice(item)
1788 2053
 			redis := service.RedisClient()
1789 2054
 			key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(item.PatientId, 10) + ":" + strconv.FormatInt(item.AdviceDate, 10) + ":doctor_advices"
@@ -2385,8 +2650,48 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2385 2650
 	// 	}
2386 2651
 	// }
2387 2652
 
2388
-	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
2389 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
+	}
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
+	}
2390 2695
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_before_dislysis"
2391 2696
 	redis := service.RedisClient()
2392 2697
 	defer redis.Close()
@@ -3962,6 +4267,8 @@ func (c *PatientApiController) CreateGroupAdvice() {
3962 4267
 			Remark = remark
3963 4268
 		}
3964 4269
 
4270
+		Startdate := int64(dataBody["record_date"].(float64))
4271
+
3965 4272
 		var advices []*models.GroupAdvice
3966 4273
 		// utils.TraceLog("%+v", dataBody["adviceNames"])
3967 4274
 		if dataBody["adviceNames"] == nil || reflect.TypeOf(dataBody["adviceNames"]).String() != "[]interface {}" {
@@ -4048,7 +4355,48 @@ func (c *PatientApiController) CreateGroupAdvice() {
4048 4355
 			advices = append(advices, &advice)
4049 4356
 		}
4050 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
+
4051 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
+		}
4052 4400
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":doctor_advices"
4053 4401
 		redis := service.RedisClient()
4054 4402
 		//清空key 值
@@ -4135,6 +4483,29 @@ func (c *PatientApiController) CreateGroupAdvice() {
4135 4483
 				advice.CheckTime = time.Now().Unix()
4136 4484
 			}
4137 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
+		}
4138 4509
 		err := service.CreateDoctorAdvice(&advice)
4139 4510
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
4140 4511
 		redis := service.RedisClient()
@@ -4273,6 +4644,30 @@ func (c *PatientApiController) DelDoctorAdvice() {
4273 4644
 		advice.UpdatedTime = time.Now().Unix()
4274 4645
 		advice.Modifier = adminUserInfo.AdminUser.Id
4275 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
+		}
4276 4671
 		err := service.DeleteDoctorAdvice(&advice)
4277 4672
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
4278 4673
 
@@ -4335,7 +4730,30 @@ func (c *PatientApiController) DelDoctorAdvice() {
4335 4730
 
4336 4731
 		var err error
4337 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
4338 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
+					}
4754
+
4755
+				}
4756
+			}
4339 4757
 			err = service.DeleteDoctorAdviceByGroupNo(&advice)
4340 4758
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
4341 4759
 
@@ -4347,7 +4765,30 @@ func (c *PatientApiController) DelDoctorAdvice() {
4347 4765
 			keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":his_doctor_advice"
4348 4766
 			redis.Set(keyThree, "", time.Second)
4349 4767
 		} else {
4768
+			// 查询信息规挡的设置天数
4769
+
4770
+			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4771
+			if infor.ID > 0 {
4772
+
4773
+				var cha_time int64
4350 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
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
+			}
4351 4792
 			err = service.BatchDeleteDoctorAdvice(ids, adminUserInfo.AdminUser.Id)
4352 4793
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(doc_advice_date, 10) + ":doctor_advices"
4353 4794
 
@@ -4549,7 +4990,30 @@ func (c *PatientApiController) ExecProject() {
4549 4990
 	project.ExecutionStaff = adminInfo.AdminUser.Id
4550 4991
 	project.ExecutionTime = theTime.Unix()
4551 4992
 	if team_id == 0 {
4993
+		// 查询信息规挡的设置天数
4552 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)
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
+		}
4553 5017
 		err := service.SaveHisProject(&project)
4554 5018
 		if err == nil {
4555 5019
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -4562,7 +5026,30 @@ func (c *PatientApiController) ExecProject() {
4562 5026
 		}
4563 5027
 	} else {
4564 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
5035
+
5036
+				timeNowStr := time.Now().Format("2006-01-02")
5037
+				timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
4565 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
+			}
4566 5053
 			err := service.SaveHisProject(&project)
4567 5054
 			if err == nil {
4568 5055
 				c.ServeSuccessJSON(map[string]interface{}{
@@ -4574,6 +5061,30 @@ func (c *PatientApiController) ExecProject() {
4574 5061
 
4575 5062
 			}
4576 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
+			}
4577 5088
 			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
4578 5089
 			var ids []int64
4579 5090
 			for _, items := range ps {
@@ -4615,6 +5126,30 @@ func (c *PatientApiController) CheckProject() {
4615 5126
 	project.CheckTime = time.Now().Unix()
4616 5127
 	project.CheckState = 1
4617 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
+		}
4618 5153
 		err := service.SaveHisProject(&project)
4619 5154
 		if err == nil {
4620 5155
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -4630,6 +5165,30 @@ func (c *PatientApiController) CheckProject() {
4630 5165
 
4631 5166
 	} else {
4632 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
+			}
4633 5192
 			err := service.SaveHisProject(&project)
4634 5193
 			if err == nil {
4635 5194
 				c.ServeSuccessJSON(map[string]interface{}{
@@ -4644,6 +5203,30 @@ func (c *PatientApiController) CheckProject() {
4644 5203
 			}
4645 5204
 
4646 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
+			}
4647 5230
 			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
4648 5231
 			var ids []int64
4649 5232
 			for _, items := range ps {

+ 210 - 0
controllers/patient_api_controller.go View File

@@ -1303,6 +1303,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
1303 1303
 	}
1304 1304
 	adviceNames := dataBody["adviceNames"].([]interface{})
1305 1305
 	for _, adviceNameMap := range adviceNames {
1306
+
1306 1307
 		adviceNameM := adviceNameMap.(map[string]interface{})
1307 1308
 		var advice models.GroupAdvice
1308 1309
 		advice.Remark = Remark
@@ -1320,6 +1321,50 @@ func (c *PatientApiController) CreateGroupAdvice() {
1320 1321
 		advice.PatientId = patientInfo.ID
1321 1322
 		advice.AdviceDoctor = adminUserInfo.AdminUser.Id
1322 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
+
1323 1368
 		if adviceNameM["advice_name"] == nil || reflect.TypeOf(adviceNameM["advice_name"]).String() != "string" {
1324 1369
 			utils.ErrorLog("advice_name")
1325 1370
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1669,6 +1714,31 @@ func (c *PatientApiController) CreateDoctorAdvice() {
1669 1714
 	advice.PatientId = patient
1670 1715
 	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
1671 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
+
1672 1742
 	if advice.UserOrgId == 3877 || advice.UserOrgId == 10340 || advice.UserOrgId == 9671 {
1673 1743
 		if advice.PrescribingNumber == 0 {
1674 1744
 			advice.PrescribingNumber = 1
@@ -1683,6 +1753,23 @@ func (c *PatientApiController) CreateDoctorAdvice() {
1683 1753
 		}
1684 1754
 	}
1685 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
+	}
1686 1773
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1687 1774
 	redis := service.RedisClient()
1688 1775
 	defer redis.Close()
@@ -1962,6 +2049,31 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1962 2049
 			ExecutionTime:  theTime.Unix(),
1963 2050
 			UpdatedTime:    time.Now().Unix(),
1964 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
+		}
1965 2077
 		if advice.ParentId > 0 {
1966 2078
 			err = service.ExceDoctorAdviceById(&exceAdvice, advice.ParentId, patient)
1967 2079
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -2728,6 +2840,30 @@ func (c *PatientApiController) CheckDoctorAdvice() {
2728 2840
 			UpdatedTime: time.Now().Unix(),
2729 2841
 		}
2730 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
+		}
2731 2867
 		if advice.ParentId > 0 {
2732 2868
 			err = service.CheckDoctorAdviceById(&exceAdvice, advice.ParentId, patient)
2733 2869
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -2919,6 +3055,31 @@ func (c *PatientApiController) UpdateDoctorAdvice() {
2919 3055
 	advice.UpdatedTime = time.Now().Unix()
2920 3056
 	advice.Modifier = adminUserInfo.AdminUser.Id
2921 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
+
2922 3083
 	err := service.UpdateDoctorAdvice(&advice)
2923 3084
 	redis := service.RedisClient()
2924 3085
 
@@ -3131,6 +3292,30 @@ func (c *PatientApiController) DeleteDoctorAdvice() {
3131 3292
 	advice.Status = 0
3132 3293
 	advice.Modifier = adminUserInfo.AdminUser.Id
3133 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
+	}
3134 3319
 	err := service.DeleteDoctorAdvice(&advice)
3135 3320
 	redis := service.RedisClient()
3136 3321
 	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
@@ -3178,6 +3363,31 @@ func (c *PatientApiController) DeleteGroupAdvice() {
3178 3363
 	//	}
3179 3364
 	//}
3180 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
+
3181 3391
 	err := service.DeleteGroupAdvice(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
3182 3392
 
3183 3393
 	key := strconv.FormatInt(advice.UserOrgId, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"

+ 1 - 1
controllers/supply_order_api_contorller.go View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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=

+ 11 - 10
models/data_models.go View File

@@ -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 {

+ 22 - 0
models/device_models.go View File

@@ -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
+}

+ 17 - 17
models/dialysis.go View File

@@ -1482,18 +1482,18 @@ func (NewAssessmentAfterDislysis) TableName() string {
1482 1482
 	return "xt_assessment_after_dislysis"
1483 1483
 }
1484 1484
 
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
-}
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 1497
 
1498 1498
 type DialysisInformation struct {
1499 1499
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
@@ -1530,11 +1530,11 @@ type DialysisScheduleFlow struct {
1530 1530
 	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
1531 1531
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1532 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"`
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 1538
 }
1539 1539
 
1540 1540
 func (DialysisScheduleFlow) TableName() string {

+ 30 - 0
models/patient_models.go View File

@@ -1833,6 +1833,36 @@ func (XtPatientFirstDisease) TableName() string {
1833 1833
 	return "xt_patient_first_disease"
1834 1834
 }
1835 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
+
1836 1866
 type XtPatientSickHistory struct {
1837 1867
 	ID                      int64                  `gorm:"column:id" json:"id" form:"id"`
1838 1868
 	OrgId                   int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`

+ 61 - 1
service/dialysis_service.go View File

@@ -2102,6 +2102,53 @@ func UpdateLastMonitorRecordToday(accumulated_blood_volume float64, id int64) er
2102 2102
 	return err
2103 2103
 }
2104 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
+
2105 2152
 func UpdateDoctorAdviceByExcecute(id int64, user_org_id int64) error {
2106 2153
 
2107 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
@@ -2130,7 +2177,7 @@ func GetInformationSettingByOrgId(user_org_id int64) (models.XtDialysisInformait
2130 2177
 	return setting, err
2131 2178
 }
2132 2179
 
2133
-func GetDialysisInformationSetting(user_org_id int64) (infor []*models.XtDialysisInformaitonSetting, err error) {
2180
+func GetDialysisInformationSettingList(user_org_id int64) (infor []*models.XtDialysisInformaitonSetting, err error) {
2134 2181
 
2135 2182
 	err = XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&infor).Error
2136 2183
 
@@ -2150,6 +2197,19 @@ func GetDialysisInformationIsNoCheck(user_org_id int64, limit int64, page int64,
2150 2197
 	return infor, total, err
2151 2198
 }
2152 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
+
2153 2213
 func CheckDialysisInformation(id int64, application_status int64, timenow int64, checker int64) (models.DialysisInformation, error) {
2154 2214
 
2155 2215
 	information := models.DialysisInformation{}

+ 58 - 0
service/gobal_config_service.go View File

@@ -1061,3 +1061,61 @@ func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (mod
1061 1061
 	err := XTReadDB().Where("patient_id = ? and assessment_date = ? and user_org_id =? and status= 1", patient_id, schedule_date, user_org_id).Find(&dislysis).Error
1062 1062
 	return dislysis, err
1063 1063
 }
1064
+
1065
+func GetDialysisInformationByRecordDate(patient_id int64, record_date int64, user_org_id int64) (models.XtDialysisInformation, error) {
1066
+
1067
+	information := models.XtDialysisInformation{}
1068
+	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
1069
+	return information, err
1070
+}
1071
+
1072
+func SaveDialysisInformation(information models.XtDialysisInformation) error {
1073
+
1074
+	err := XTWriteDB().Create(&information).Error
1075
+
1076
+	return err
1077
+}
1078
+
1079
+func UpdateInformationByRecordDate(patient_id int64, record_date int64, user_org_id int64, application_date int64, remark string) error {
1080
+
1081
+	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
1082
+	return err
1083
+}
1084
+
1085
+func GetMobileInformation(limit int64, page int64, application_status int64, orgid int64) (infor []*models.XtDialysisInformation, total int64, err error) {
1086
+
1087
+	db := XTReadDB().Model(&infor).Where("status=1")
1088
+
1089
+	if orgid > 0 {
1090
+		db = db.Where("user_org_id = ?", orgid)
1091
+	}
1092
+
1093
+	if application_status > 0 {
1094
+		db = db.Where("application_status = ?", application_status)
1095
+	}
1096
+
1097
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("ctime desc").Find(&infor).Error
1098
+
1099
+	return infor, total, err
1100
+
1101
+}
1102
+
1103
+func GetMobileInformationOne(limit int64, page int64, orgid int64) (infor []*models.XtDialysisInformation, total int64, err error) {
1104
+
1105
+	db := XTReadDB().Model(&infor).Where("status=1")
1106
+
1107
+	if orgid > 0 {
1108
+		db = db.Where("user_org_id = ?", orgid)
1109
+	}
1110
+
1111
+	err = db.Count(&total).Offset(limit * (page - 1)).Limit(limit).Order("ctime desc").Find(&infor).Error
1112
+
1113
+	return infor, total, err
1114
+
1115
+}
1116
+
1117
+func CheckMobileInformation(id int64, application_status int64, checker int64, checker_time int64) error {
1118
+
1119
+	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
1120
+	return err
1121
+}

+ 2 - 2
service/warhouse_service.go View File

@@ -1865,7 +1865,7 @@ func ConsumablesDeliveryDelete(orgID int64, patient_id int64, record_time int64,
1865 1865
 		if errThree != nil {
1866 1866
 			return errThree
1867 1867
 		}
1868
-		fmt.Println("errThreee23333333333333333333333", errThree)
1868
+
1869 1869
 		//查询剩余库存
1870 1870
 		houseConfig, _ := GetAllStoreHouseConfig(orgID)
1871 1871
 		goodList, _ := GetAllGoodSumCount(good_yc.GoodId, orgID, houseConfig.StorehouseOutInfo)
@@ -1873,7 +1873,7 @@ func ConsumablesDeliveryDelete(orgID int64, patient_id int64, record_time int64,
1873 1873
 		for _, item := range goodList {
1874 1874
 			sum_count += item.StockCount
1875 1875
 		}
1876
-		fmt.Println("sum_count++++++++++++++++++++++++++++++++=", sum_count)
1876
+
1877 1877
 		// 判断当前出库的数据和删除出库数量
1878 1878
 		if good_yc.Count <= ware.Count {
1879 1879
 			delete_count = good_yc.Count