Browse Source

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

test_user 2 years ago
parent
commit
82aa941d23

+ 3 - 2
conf/app.conf View File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = dev
3
+runmode = prod
4 4
 #dev/prod
5 5
 
6 6
 #
@@ -146,7 +146,8 @@ aliquid = 83
146 146
 
147 147
 [dev]
148 148
 mobile_token_expiration_second = 604800
149
-httpdomain = http://new_mobile.xt.api.sgjyun.com
149
+# httpdomain = http://new_mobile.xt.api.sgjyun.com
150
+httpdomain = https://api.xt.test.sgjyun.com
150 151
 sso_domain = https://testsso.sgjyun.com
151 152
 call_domain = http://hf.szjkhd.com
152 153
 front_end_domain = "http://xt.test.sgjyun.com/#"

+ 6 - 6
controllers/base_api_controller.go View File

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

+ 4 - 4
controllers/dialysis_api_controller.go View File

@@ -1894,6 +1894,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1894 1894
 	age := c.GetString("age")
1895 1895
 	his_department := c.GetString("his_department")
1896 1896
 	his_bed := c.GetString("his_bed")
1897
+	point_puncture := c.GetString("point_puncture")
1897 1898
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1898 1899
 		DialysisCount:                  dialysis_count,
1899 1900
 		EmergencyTreatment:             emergency_treatment,
@@ -1967,6 +1968,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1967 1968
 		Age:                            age,
1968 1969
 		HisDepartment:                  his_department,
1969 1970
 		HisBed:                         his_bed,
1971
+		PointPuncture:                  point_puncture,
1970 1972
 	}
1971 1973
 
1972 1974
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -1984,9 +1986,6 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1984 1986
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
1985 1987
 
1986 1988
 		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 {
1987
-			fmt.Println("进来--------------------------------------")
1988
-			fmt.Println("evaluation.WeightBefore", weight_before)
1989
-			fmt.Println(" evaluation.DryWeight", dry_weight)
1990 1989
 			var dewater_amount float64
1991 1990
 			dewater_amount = 0
1992 1991
 			if dry_weight > 0 {
@@ -3442,6 +3441,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
3442 3441
 
3443 3442
 	//透析单
3444 3443
 	dialysisOrder, _ := service.MobileGetSchedualDialysisRecordTen(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
3444
+	fmt.Println("dialysisOrder----------------", dialysisOrder)
3445 3445
 	if dialysisOrder != nil {
3446 3446
 		if dialysisOrder.FinishNurse > 0 {
3447 3447
 			operatorIDs = append(operatorIDs, dialysisOrder.FinishNurse)
@@ -5141,7 +5141,7 @@ func (this *DialysisApiController) GetDialysisGoodTotalCount() {
5141 5141
 	var ids []string
5142 5142
 
5143 5143
 	ids = strings.Split(partion_type, ",")
5144
-	fmt.Println("ids------------------------", ids)
5144
+
5145 5145
 	timeLayout := "2006-01-02"
5146 5146
 	loc, _ := time.LoadLocation("Local")
5147 5147
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)

+ 4 - 1
controllers/doctors_api_controller.go View File

@@ -1262,9 +1262,12 @@ func (this *DoctorsApiController) GetHospitalSummaryDetail() {
1262 1262
 
1263 1263
 	id, _ := this.GetInt64("id")
1264 1264
 	detail, err := service.GetHospitalSummaryDetail(id)
1265
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1266
+	operators, err := service.GetAdminUserEsOne(orgId)
1265 1267
 	if err == nil {
1266 1268
 		this.ServeSuccessJSON(map[string]interface{}{
1267
-			"detail": detail,
1269
+			"detail":    detail,
1270
+			"operators": operators,
1268 1271
 		})
1269 1272
 		return
1270 1273
 	}

+ 61 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -843,6 +843,19 @@ func (c *DialysisAPIController) PostDoubleCheck() {
843 843
 			order, _ := service.GetDialysisOrder(recordDate.Unix(), id, adminUserInfo.Org.Id)
844 844
 			doubleCheck.Creater = order.StartNurse
845 845
 		}
846
+
847
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
848
+			//查询未核对的医嘱
849
+			doctorList, err := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
850
+			for _, advice := range doctorList {
851
+				if advice.ExecutionStaff == modifier {
852
+
853
+					c.ErrorLog("医嘱核对人不能和执行人为同一人!", err)
854
+					c.ServeFailJSONWithSGJErrorCode(enums.AdviceCodeParamWrong)
855
+					return
856
+				}
857
+			}
858
+		}
846 859
 		err := service.AddSigleDoubleCheck(&doubleCheck)
847 860
 
848 861
 		//针对长沙南雅
@@ -851,6 +864,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
851 864
 			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
852 865
 			if len(doctorList) > 0 && modifier > 0 {
853 866
 				for _, advice := range doctorList {
867
+
854 868
 					service.UpdateDoctorAdviceList(advice.ID, modifier)
855 869
 					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
856 870
 					redis := service.RedisClient()
@@ -890,7 +904,21 @@ func (c *DialysisAPIController) PostDoubleCheck() {
890 904
 		doubleCheck.EmployeeNumber = employee_number
891 905
 		doubleCheck.NeedleBatchNumber = needle_batch_number
892 906
 		doubleCheck.DialyzerBatchNumber = dialyzer_batch_number
907
+
908
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
909
+			//查询未核对的医嘱
910
+			doctorList, err := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
911
+			for _, advice := range doctorList {
912
+				if advice.ExecutionStaff == modifier {
913
+
914
+					c.ErrorLog("医嘱核对人不能和执行人为同一人!", err)
915
+					c.ServeFailJSONWithSGJErrorCode(enums.AdviceCodeParamWrong)
916
+					return
917
+				}
918
+			}
919
+		}
893 920
 		err := service.UpdateDoubleCheck(&doubleCheck)
921
+
894 922
 		//针对长沙南雅
895 923
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
896 924
 			//查询未核对的医嘱
@@ -1701,6 +1729,13 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1701 1729
 			if prescribing_number == 0 {
1702 1730
 				prescribing_number = 1
1703 1731
 			}
1732
+			if prescribing_number == 0 && id == 14682 {
1733
+				prescribing_number = 2
1734
+			}
1735
+
1736
+			if prescribing_number == 0 && id == 18560 {
1737
+				prescribing_number = 2
1738
+			}
1704 1739
 			advice := models.DoctorAdvice{
1705 1740
 				UserOrgId:             adminUserInfo.Org.Id,
1706 1741
 				PatientId:             id,
@@ -3294,6 +3329,32 @@ func (c *DialysisAPIController) PostSolution() {
3294 3329
 		}
3295 3330
 	}
3296 3331
 
3332
+	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 {
3333
+
3334
+		if solution.PrescribingNumber == 0 {
3335
+			solution.PrescribingNumber = 1
3336
+		}
3337
+		if prescription.PrescribingNumber == 0 {
3338
+			prescription.PrescribingNumber = 1
3339
+		}
3340
+
3341
+		if solution.PrescribingNumber == 0 && id == 14682 {
3342
+			solution.PrescribingNumber = 2
3343
+		}
3344
+
3345
+		if solution.PrescribingNumber == 0 && id == 18560 {
3346
+			solution.PrescribingNumber = 2
3347
+		}
3348
+
3349
+		if prescription.PrescribingNumber == 0 && id == 14682 {
3350
+			prescription.PrescribingNumber = 2
3351
+		}
3352
+
3353
+		if prescription.PrescribingNumber == 0 && id == 18560 {
3354
+			prescription.PrescribingNumber = 2
3355
+		}
3356
+	}
3357
+
3297 3358
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
3298 3359
 	//获取最新1条
3299 3360
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(id, adminUserInfo.Org.Id)

+ 6 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -2849,6 +2849,12 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2849 2849
 
2850 2850
 		evaluation.HisBed = his_bed
2851 2851
 	}
2852
+
2853
+	if dataBody["point_puncture"] != nil && reflect.TypeOf(dataBody["point_puncture"]).String() == "string" {
2854
+		point_puncture := dataBody["point_puncture"].(string)
2855
+
2856
+		evaluation.PointPuncture = point_puncture
2857
+	}
2852 2858
 	return
2853 2859
 }
2854 2860
 

+ 12 - 0
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

@@ -1269,3 +1269,15 @@ func (c *MobileHisApiController) GetPatientPlan() {
1269 1269
 	})
1270 1270
 	return
1271 1271
 }
1272
+
1273
+func (c *MobileHisApiController) ToGetPatient() {
1274
+
1275
+	order, _ := service.GetDialysisOrderList(10340)
1276
+	for _, item := range order {
1277
+		service.UpdatePatientDialysisOrder(item.PatientId, item.Url)
1278
+	}
1279
+	c.ServeSuccessJSON(map[string]interface{}{
1280
+		"msg": "ok",
1281
+	})
1282
+	return
1283
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go View File

@@ -181,5 +181,6 @@ func NewMobileAPIControllersRegisterRouters() {
181 181
 	beego.Router("/m/api/prescription/create", &MobileHisApiController{}, "Post:CreateHisPrescription")
182 182
 
183 183
 	beego.Router("/m/api/patient/getpatientplan", &MobileHisApiController{}, "Get:GetPatientPlan")
184
+	beego.Router("/m/api/patient/togetpatient", &MobileHisApiController{}, "Get:ToGetPatient")
184 185
 
185 186
 }

+ 115 - 14
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

@@ -49,10 +49,40 @@ func (this *StaffScheduleApiController) GetMobileDoctorList() {
49 49
 func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
50 50
 
51 51
 	orgId := this.GetMobileAdminUserInfo().Org.Id
52
-	start_time, _ := this.GetInt64("start_time")
53
-	fmt.Println("staft_time", start_time)
54
-	end_time, _ := this.GetInt64("end_time")
55
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
52
+	//start_time, _ := this.GetInt64("start_time")
53
+	//fmt.Println("staft_time", start_time)
54
+	//end_time, _ := this.GetInt64("end_time")
55
+	//fmt.Println("start_time",start_time)
56
+	//fmt.Println("end_time",end_time)
57
+	start_time_one := this.GetString("start_time_one")
58
+	end_time_one := this.GetString("end_time_one")
59
+	fmt.Println("start_time_one--------", len(start_time_one))
60
+	fmt.Println("end_time_one-------", end_time_one)
61
+	timeLayout := "2006-01-02"
62
+	loc, _ := time.LoadLocation("Local")
63
+	var startTime int64
64
+	if len(start_time_one) > 0 {
65
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
66
+		fmt.Println("err-----------", err)
67
+		if err != nil {
68
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
69
+			return
70
+		}
71
+		startTime = theTime.Unix()
72
+	}
73
+	var endTime int64
74
+	if len(end_time_one) > 0 {
75
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
76
+		if err != nil {
77
+			utils.ErrorLog(err.Error())
78
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
79
+			return
80
+		}
81
+		endTime = theTime.Unix()
82
+	}
83
+	fmt.Println("starti_time233232323232", startTime)
84
+	fmt.Println("end_time2323223232323", endTime)
85
+	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
56 86
 	if err != nil {
57 87
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
58 88
 		return
@@ -66,10 +96,33 @@ func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
66 96
 func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
67 97
 
68 98
 	orgId := this.GetMobileAdminUserInfo().Org.Id
69
-	start_time, _ := this.GetInt64("start_time")
70
-	end_time, _ := this.GetInt64("end_time")
99
+	//start_time, _ := this.GetInt64("start_time")
100
+	//end_time, _ := this.GetInt64("end_time")
101
+	start_time_one := this.GetString("start_time_one")
102
+	end_time_one := this.GetString("end_time_one")
103
+	timeLayout := "2006-01-02"
104
+	loc, _ := time.LoadLocation("Local")
105
+	var startTime int64
106
+	if len(start_time_one) > 0 {
107
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
108
+		if err != nil {
109
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
110
+			return
111
+		}
112
+		startTime = theTime.Unix()
113
+	}
114
+	var endTime int64
115
+	if len(end_time_one) > 0 {
116
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
117
+		if err != nil {
118
+			utils.ErrorLog(err.Error())
119
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
120
+			return
121
+		}
122
+		endTime = theTime.Unix()
123
+	}
71 124
 
72
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
125
+	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
73 126
 	if err != nil {
74 127
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
75 128
 		return
@@ -82,10 +135,33 @@ func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
82 135
 
83 136
 func (this *StaffScheduleApiController) GetScheduleByUserType() {
84 137
 	doctor_id, _ := this.GetInt64("doctor_id")
85
-	start_time, _ := this.GetInt64("start_time")
86
-	end_time, _ := this.GetInt64("end_time")
138
+	//start_time, _ := this.GetInt64("start_time")
139
+	//end_time, _ := this.GetInt64("end_time")
140
+	start_time_one := this.GetString("start_time_one")
141
+	end_time_one := this.GetString("end_time_one")
142
+	timeLayout := "2006-01-02"
143
+	loc, _ := time.LoadLocation("Local")
144
+	var startTime int64
145
+	if len(start_time_one) > 0 {
146
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
147
+		if err != nil {
148
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
149
+			return
150
+		}
151
+		startTime = theTime.Unix()
152
+	}
153
+	var endTime int64
154
+	if len(end_time_one) > 0 {
155
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
156
+		if err != nil {
157
+			utils.ErrorLog(err.Error())
158
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
159
+			return
160
+		}
161
+		endTime = theTime.Unix()
162
+	}
87 163
 	orgId := this.GetMobileAdminUserInfo().Org.Id
88
-	staffList, err := service.GetScheduleByDoctorId(doctor_id, start_time, end_time, orgId)
164
+	staffList, err := service.GetScheduleByDoctorId(doctor_id, startTime, endTime, orgId)
89 165
 	if err != nil {
90 166
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
91 167
 		return
@@ -100,9 +176,34 @@ func (this *StaffScheduleApiController) GetSearchPatientByDoctorId() {
100 176
 
101 177
 	orgId := this.GetMobileAdminUserInfo().Org.Id
102 178
 	user_name := this.GetString("user_name")
103
-	start_time, _ := this.GetInt64("start_time")
104
-	end_time, _ := this.GetInt64("end_time")
105
-	staffList, err := service.ToSearchSeacheduleList(user_name, start_time, end_time, orgId)
179
+	//start_time, _ := this.GetInt64("start_time")
180
+	//end_time, _ := this.GetInt64("end_time")
181
+
182
+	start_time_one := this.GetString("start_time_one")
183
+	end_time_one := this.GetString("end_time_one")
184
+	timeLayout := "2006-01-02"
185
+	loc, _ := time.LoadLocation("Local")
186
+	var startTime int64
187
+	if len(start_time_one) > 0 {
188
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
189
+		if err != nil {
190
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
191
+			return
192
+		}
193
+		startTime = theTime.Unix()
194
+	}
195
+	var endTime int64
196
+	if len(end_time_one) > 0 {
197
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
198
+		if err != nil {
199
+			utils.ErrorLog(err.Error())
200
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
201
+			return
202
+		}
203
+		endTime = theTime.Unix()
204
+	}
205
+	//
206
+	staffList, err := service.ToSearchSeacheduleList(user_name, startTime, endTime, orgId)
106 207
 	if err != nil {
107 208
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
108 209
 		return
@@ -812,7 +913,7 @@ func (c *StaffScheduleApiController) ChangeScheduleById() {
812 913
 	patient_id, _ := c.GetInt64("patient_id")
813 914
 	org_id := c.GetMobileAdminUserInfo().Org.Id
814 915
 	err := service.ChangeScheduleById(id, mode_id)
815
-	fmt.Println("9999999999999999", err)
916
+	fmt.Println("err", err)
816 917
 	err = service.ChangeDialysisSolution(patient_id, schedule_date, org_id, mode_id)
817 918
 	c.ServeSuccessJSON(map[string]interface{}{
818 919
 		"msg": "ok",

+ 31 - 14
controllers/pharmacy_controller.go View File

@@ -35,7 +35,7 @@ func PharmacyApiRegistRouters() {
35 35
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
36 36
 }
37 37
 
38
-//测试
38
+// 测试
39 39
 func (this *PharmacyController) Tlili() {
40 40
 	var err error
41 41
 	defer func() {
@@ -65,7 +65,7 @@ func (this *PharmacyController) GetCurrentName() {
65 65
 	return
66 66
 }
67 67
 
68
-//查询今天的待发药,已发药人数
68
+// 查询今天的待发药,已发药人数
69 69
 func (this *PharmacyController) TodayNumber() {
70 70
 	var err error
71 71
 	defer func() {
@@ -166,8 +166,17 @@ func (this *PharmacyController) IssuedDrug() {
166 166
 	}
167 167
 
168 168
 	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 {
169
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1)
170
-		fmt.Println("list23323232323232", list)
169
+
170
+		//获取排班班次
171
+		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
172
+
173
+		var ids []int64
174
+		for _, item := range schedule {
175
+			ids = append(ids, item.PatientId)
176
+		}
177
+
178
+		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
179
+
171 180
 		var flist []models.TmpPatientOne
172 181
 		if len(list) > 0 {
173 182
 			for _, item := range list {
@@ -247,6 +256,7 @@ func (this *PharmacyController) WaitingDrug() {
247 256
 			return
248 257
 		}
249 258
 		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
259
+
250 260
 		if err != nil {
251 261
 			utils.ErrorLog(err.Error())
252 262
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -261,7 +271,15 @@ func (this *PharmacyController) WaitingDrug() {
261 271
 	//当天已发药的人数
262 272
 	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 {
263 273
 
264
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0)
274
+		//获取排班班次
275
+		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
276
+		fmt.Println("schedule--------", schedule)
277
+		var ids []int64
278
+		for _, item := range schedule {
279
+			ids = append(ids, item.PatientId)
280
+		}
281
+
282
+		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
265 283
 
266 284
 		var flist []models.TmpPatientOne
267 285
 		if len(list) > 0 {
@@ -278,7 +296,6 @@ func (this *PharmacyController) WaitingDrug() {
278 296
 
279 297
 }
280 298
 
281
-//
282 299
 func (this *PharmacyController) GetPharmacyContent() {
283 300
 	var err error
284 301
 	defer func() {
@@ -320,7 +337,7 @@ func (this *PharmacyController) GetPharmacyContent() {
320 337
 
321 338
 }
322 339
 
323
-//发药按钮点击
340
+// 发药按钮点击
324 341
 func (this *PharmacyController) DispensingMedicine() {
325 342
 	var err error
326 343
 	defer func() {
@@ -399,7 +416,7 @@ func (this *PharmacyController) DispensingMedicine() {
399 416
 	return
400 417
 }
401 418
 
402
-//退药按钮点击
419
+// 退药按钮点击
403 420
 func (this *PharmacyController) DrugWithdrawal() {
404 421
 	var err error
405 422
 	defer func() {
@@ -437,7 +454,7 @@ func (this *PharmacyController) DrugWithdrawal() {
437 454
 
438 455
 }
439 456
 
440
-//发药明细列表
457
+// 发药明细列表
441 458
 func (this *PharmacyController) DispensingDetails() {
442 459
 	var err error
443 460
 	defer func() {
@@ -485,7 +502,7 @@ func (this *PharmacyController) DispensingDetails() {
485 502
 	return
486 503
 }
487 504
 
488
-//处方详情
505
+// 处方详情
489 506
 func (this *PharmacyController) PrescriptionDetails() {
490 507
 	var err error
491 508
 	defer func() {
@@ -518,7 +535,7 @@ func (this *PharmacyController) PrescriptionDetails() {
518 535
 	return
519 536
 }
520 537
 
521
-//已发药品的信息
538
+// 已发药品的信息
522 539
 func (this *PharmacyController) DispenseMedicine() {
523 540
 	var err error
524 541
 	defer func() {
@@ -563,7 +580,7 @@ func (this *PharmacyController) DispenseMedicine() {
563 580
 	return
564 581
 }
565 582
 
566
-//待发药的药品信息
583
+// 待发药的药品信息
567 584
 func (this *PharmacyController) WaitingMedicine() {
568 585
 	var err error
569 586
 	defer func() {
@@ -608,7 +625,7 @@ func (this *PharmacyController) WaitingMedicine() {
608 625
 	return
609 626
 }
610 627
 
611
-//获取药品的所有患者信息
628
+// 获取药品的所有患者信息
612 629
 func (this *PharmacyController) GetPatientsWithDrugs() {
613 630
 	var err error
614 631
 	defer func() {
@@ -675,7 +692,7 @@ func (this *PharmacyController) GetPatientsWithDrugs() {
675 692
 	return
676 693
 }
677 694
 
678
-//药品管理发药按钮点击
695
+// 药品管理发药按钮点击
679 696
 func (this *PharmacyController) MedicineDeparture() {
680 697
 	var err error
681 698
 	defer func() {

+ 15 - 2
controllers/schedule_api_controller.go View File

@@ -4334,11 +4334,16 @@ func (c *ScheduleApiController) GetScheduleOne() {
4334 4334
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4335 4335
 	patitionIdStr := c.GetString("patitionid")
4336 4336
 	ids := strings.Split(patitionIdStr, ",")
4337
-	fmt.Println("patitonStr", ids)
4337
+	//fmt.Println("patitonStr", ids)
4338 4338
 	schedule_type, _ := c.GetInt64("schedule_type")
4339
+	is_before, _ := c.GetInt64("is_before")
4340
+	start_time := c.GetString("start_time")
4341
+	end_time := c.GetString("end_time")
4342
+
4339 4343
 	adminInfo := c.GetAdminUserInfo()
4340 4344
 
4341 4345
 	thisTime := time.Now()
4346
+
4342 4347
 	today := thisTime.Format("2006-01-02")
4343 4348
 	if week < 1 || week > 4 {
4344 4349
 		week = 2
@@ -4377,9 +4382,17 @@ func (c *ScheduleApiController) GetScheduleOne() {
4377 4382
 	loc, _ := time.LoadLocation("Local")
4378 4383
 	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
4379 4384
 	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
4385
+
4380 4386
 	weekStartPoint := theStarTime.Unix()
4381 4387
 	weekEndPoint := theEndTime.Unix()
4382
-
4388
+	if is_before > 0 {
4389
+		timeLayout := "2006-01-02 15:04:05"
4390
+		loc, _ := time.LoadLocation("Local")
4391
+		theStarTime, _ := time.ParseInLocation(timeLayout, start_time, loc)
4392
+		theEndTime, _ := time.ParseInLocation(timeLayout, end_time, loc)
4393
+		weekStartPoint = theStarTime.Unix()
4394
+		weekEndPoint = theEndTime.Unix()
4395
+	}
4383 4396
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4384 4397
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4385 4398
 	c.ServeSuccessJSON(map[string]interface{}{

+ 3 - 0
enums/error_code.go View File

@@ -275,6 +275,8 @@ const ( // ErrorCode
275 275
 	ErrorCodeDelScheduleFailByDialysisTwo = 60000003
276 276
 
277 277
 	ErrorCodeSyncWrong = 60000006
278
+
279
+	AdviceCodeParamWrong = 600000007
278 280
 )
279 281
 
280 282
 var ErrCodeMsgs = map[int]string{
@@ -533,6 +535,7 @@ var ErrCodeMsgs = map[int]string{
533 535
 	ErrorCodePatientDialysisOrderTwo:      "被替换的患者已经上机,无法替换排班",
534 536
 	ErrorCodePatientScheduleRepeat:        "一天只能存在一次排班",
535 537
 	ErrorCodeDelScheduleFailByDialysisTwo: "已经上机透析,不能操作排班",
538
+	AdviceCodeParamWrong:                  "医嘱核对人和执行人不能为同一人,请更换第二核对人!",
536 539
 }
537 540
 
538 541
 type SGJError struct {

+ 2 - 0
models/dialysis.go View File

@@ -325,6 +325,7 @@ type PredialysisEvaluation struct {
325 325
 	Age                            string  `gorm:"column:age" json:"age" form:"age"`
326 326
 	HisDepartment                  string  `gorm:"column:his_department" json:"his_department" form:"his_department"`
327 327
 	HisBed                         string  `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
328
+	PointPuncture                  string  `gorm:"column:point_puncture" json:"point_puncture" form:"point_puncture"`
328 329
 }
329 330
 
330 331
 func (PredialysisEvaluation) TableName() string {
@@ -887,6 +888,7 @@ type XtDialysisOrder struct {
887 888
 	Number         int64  `gorm:"column:number" json:"number" form:"number"`
888 889
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
889 890
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
891
+	Url            string `gorm:"column:url" json:"url" form:"url"`
890 892
 }
891 893
 
892 894
 func (XtDialysisOrder) TableName() string {

+ 1 - 0
models/patient_models.go View File

@@ -1177,6 +1177,7 @@ type XtPatients struct {
1177 1177
 	SchRemark                    string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
1178 1178
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1179 1179
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1180
+	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1180 1181
 }
1181 1182
 
1182 1183
 func (XtPatients) TableName() string {

+ 1 - 1
service/dialysis_service.go View File

@@ -896,7 +896,7 @@ func GetAllStarfEs(orgid int64) (es []*models.SgjUserAdminRoles, err error) {
896 896
 	// cur_date := time.Now().Format("2006-01-02")
897 897
 	key := strconv.FormatInt(orgid, 10) + ":starfes"
898 898
 	starfes_str, _ := redis.Get(key).Result()
899
-
899
+	redis.Set(key, "", time.Second)
900 900
 	if len(starfes_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
901 901
 		db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
902 902
 		err = db.Select("x.id,x.admin_user_id,x.org_id,x.app_id,x.role_id,x.user_name,x.avatar,x.user_type,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id and s.status = 1").Where("x.org_id = ?", orgid).Scan(&es).Error

+ 1 - 1
service/dialysis_solution_service.go View File

@@ -203,7 +203,7 @@ func GetDialysisGoodTotalCount(orgID int64, schedule_type int64, partition_id []
203 203
 	//if partition_id > 0 {
204 204
 	//	db = db.Where("partition_id = ?", partition_id)
205 205
 	//}
206
-	fmt.Println("len-------------", len(partition_id))
206
+
207 207
 	if len(partition_id) > 0 {
208 208
 		db = db.Where("partition_id in(?)", partition_id)
209 209
 	}

+ 16 - 4
service/his_service.go View File

@@ -618,7 +618,7 @@ func GetMonthHisPrescriptionThree(org_id int64, patient_id int64, start_date int
618 618
 	return
619 619
 }
620 620
 
621
-//未收费
621
+// 未收费
622 622
 func GetUnChargeMonthHisPrescriptionThree(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
623 623
 	err = readDb.Model(&models.HisPrescription{}).
624 624
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
@@ -637,7 +637,7 @@ func GetUnChargeMonthHisPrescriptionThree(org_id int64, patient_id int64, start_
637 637
 	return
638 638
 }
639 639
 
640
-//已收费
640
+// 已收费
641 641
 func GetChargeMonthHisPrescriptionFour(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
642 642
 	err = readDb.Model(&models.HisPrescription{}).
643 643
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
@@ -2235,7 +2235,7 @@ func GetHisPrescriptionTemplate(template_id int64, org_id int64) (prescription [
2235 2235
 	return
2236 2236
 }
2237 2237
 
2238
-//组
2238
+// 
2239 2239
 func GetHisPrescriptionTemplateL(template_id int64, org_id int64) (prescription []*models.HisPrescriptionInfoTemplateL, err error) {
2240 2240
 	err = readDb.Model(&models.HisPrescriptionInfoTemplateL{}).
2241 2241
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
@@ -2343,7 +2343,7 @@ func GetChargeHisPrescriptionSeven(org_id int64, patient_id int64, order_number
2343 2343
 	return
2344 2344
 }
2345 2345
 
2346
-//已收费
2346
+// 已收费
2347 2347
 func GetChargeMonthHisPrescriptionFive(org_id int64, patient_id int64, order_number string, p_type int64) (prescription []*models.HisPrescription, err error) {
2348 2348
 	err = readDb.Model(&models.HisPrescription{}).
2349 2349
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
@@ -2714,3 +2714,15 @@ func UpdatePatienPlan(id int64, trement_plan string) error {
2714 2714
 	err := XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status = 1", id).Update(map[string]interface{}{"treatment_plan": trement_plan}).Error
2715 2715
 	return err
2716 2716
 }
2717
+
2718
+func GetDialysisOrderList(orgid int64) (order []*models.XtDialysisOrder, err error) {
2719
+
2720
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and url<>''", orgid).Group("patient_id").Find(&order).Error
2721
+	return order, err
2722
+}
2723
+
2724
+func UpdatePatientDialysisOrder(patient_id int64, url string) error {
2725
+
2726
+	err := XTWriteDB().Model(&models.XtPatients{}).Where("id =? and status=1", patient_id).Updates(map[string]interface{}{"url": url}).Error
2727
+	return err
2728
+}

+ 4 - 0
service/new_stock_service.go View File

@@ -90,6 +90,10 @@ func GetGoodStockList(orgId int64, storehouse_id int64, good_type int64, keyword
90 90
 		db = db.Where("x.sum_count = 0")
91 91
 	}
92 92
 
93
+	if good_type == 4 {
94
+		db = db.Where("x.sum_count > 0")
95
+	}
96
+
93 97
 	if len(keyword) > 0 {
94 98
 		db = db.Where("good_name like ? or manufacturer in(?)", likeKey, ids)
95 99
 	}

+ 2 - 2
service/patient_service.go View File

@@ -533,7 +533,7 @@ func ChechLastDialysisNo(orgID int64) (dialysisNo int64) {
533 533
 }
534 534
 
535 535
 func FindPatientByDialysisNo(orgID int64, dialysisNo string) (patient models.Patients, err error) {
536
-	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and dialysis_no=?", orgID, dialysisNo).First(&patient).Error
536
+	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and dialysis_no=? and lapseto = 1", orgID, dialysisNo).First(&patient).Error
537 537
 	return
538 538
 }
539 539
 
@@ -605,7 +605,7 @@ func FindPatientWithDeviceByNo(orgID int64, no string, time int64) (patient mode
605 605
 		return db.Preload("DeviceNumber", "org_id = ?", orgID).
606 606
 			Preload("DeviceZone", "org_id = ?", orgID).
607 607
 			Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
608
-	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1", orgID, no).First(&patient).Error
608
+	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1 ", orgID, no).First(&patient).Error
609 609
 	return
610 610
 }
611 611
 

+ 36 - 2
service/pharmacy_service.go View File

@@ -96,7 +96,33 @@ func GetTodayAdviceCount(stime, etime, orgid, is_medicine int64) (num int, err e
96 96
 	return len(tmp), err
97 97
 }
98 98
 
99
-func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine int64) (advice []*models.HisDoctorAdviceInfo, err error) {
99
+func GetSchedulePatientId(start_time int64, end_time int64, org_id int64, class_type int64, partion_type int64) (schedule []*models.XtSchedules, err error) {
100
+
101
+	db := XTReadDB().Model(&schedule).Where("status = 1")
102
+
103
+	if start_time > 0 {
104
+		db = db.Where("schedule_date >=?", start_time)
105
+	}
106
+
107
+	if end_time > 0 {
108
+		db = db.Where("schedule_date <=?", end_time)
109
+	}
110
+
111
+	if org_id > 0 {
112
+		db = db.Where("user_org_id = ?", org_id)
113
+	}
114
+	if class_type > 0 {
115
+		db = db.Where("schedule_type =?", class_type)
116
+	}
117
+	if partion_type > 0 {
118
+		db = db.Where("partition_id = ?", partion_type)
119
+	}
120
+	err = db.Find(&schedule).Error
121
+
122
+	return schedule, err
123
+}
124
+
125
+func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine int64, ids []int64) (advice []*models.HisDoctorAdviceInfo, err error) {
100 126
 
101 127
 	db := XTReadDB().Model(&advice).Where("status=1 and is_medicine = ?", is_medicine)
102 128
 	if stime > 0 {
@@ -109,6 +135,13 @@ func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine i
109 135
 		db = db.Where("user_org_id = ?", orgid)
110 136
 	}
111 137
 
138
+	if len(ids) == 0 {
139
+		db = db.Where("patient_id not in(?)", ids)
140
+	}
141
+	if len(ids) > 0 {
142
+		db = db.Where("patient_id in(?)", ids)
143
+	}
144
+
112 145
 	err = db.Group("patient_id").Find(&advice).Error
113 146
 	return advice, err
114 147
 }
@@ -1828,7 +1861,8 @@ func PartitionAndLayout(stime, etime, orgid, shift, partition int64, flist []*mo
1828 1861
 	if shift == 0 && partition == 0 {
1829 1862
 		return flist, nil
1830 1863
 	}
1831
-	err = XTWriteDB().Model(&models.XtScheduleTwo{}).Where(s, orgid, stime, etime).Find(&sch).Error
1864
+	err = XTReadDB().Model(&models.XtScheduleTwo{}).Where(s, orgid, stime, etime).Find(&sch).Error
1865
+
1832 1866
 	if err != nil {
1833 1867
 		return
1834 1868
 	}

+ 4 - 0
service/self_drug_service.go View File

@@ -1816,6 +1816,10 @@ func GetDrugStockCountList(orgId int64, storehouse_id int64, good_type int64, ke
1816 1816
 	if good_type == 3 {
1817 1817
 		db = db.Where("x.sum_count = 0")
1818 1818
 	}
1819
+
1820
+	if good_type == 4 {
1821
+		db = db.Where("x.sum_count > 0")
1822
+	}
1819 1823
 	if storehouse_id > 0 {
1820 1824
 		db = db.Preload("DrugWarehouseInfo", "org_id = ? and status = 1 and storehouse_id = ? and is_check = 1", orgId, storehouse_id)
1821 1825