Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 2 years ago
parent
commit
269bf3f58f
4 changed files with 390 additions and 16 deletions
  1. 2 3
      conf/app.conf
  2. 377 7
      controllers/sg/his_api_controller.go
  3. 6 6
      service/fj_service.go
  4. 5 0
      service/his_service.go

+ 2 - 3
conf/app.conf View File

@@ -45,8 +45,7 @@ appsecret="61ee2e6268497d5aa9de0b0187c39aea"
45 45
 
46 46
 
47 47
 [prod]
48
-org_id = 10215
49
-
48
+org_id = 10217
50 49
 mobile_token_expiration_second = 86400
51 50
 httpdomain = https://api.xt.kuyicloud.com
52 51
 sso_domain = https://sso.kuyicloud.com
@@ -73,7 +72,7 @@ gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
73 72
 #深圳
74 73
 # gdyb_paasid = "sz_prd_yjyy"
75 74
 #肇庆
76
-gdyb_paasid = "zq_prd_yjyy"
75
+# gdyb_paasid = "zq_prd_yjyy"
77 76
 # gdyb_paasid = "sztest_hosp"
78 77
 #广州
79 78
 #gdyb_paasid = "gdyb_inf"

+ 377 - 7
controllers/sg/his_api_controller.go View File

@@ -86,13 +86,13 @@ func HisManagerApiRegistRouters() {
86 86
 }
87 87
 
88 88
 type Result3101 struct {
89
-	Infcode     string      `json:"infcode"`
90
-	InfRefmsgid string      `json:"inf_refmsgid"`
91
-	RefmsgTime  string      `json:"refmsg_time"`
92
-	RespondTime string      `json:"respond_time"`
93
-	Enctype     string      `json:"enctype"`
94
-	Signtype    string      `json:"signtype"`
95
-	ErrMsg      interface{} `json:"err_msg"`
89
+	Infcode     string `json:"infcode"`
90
+	InfRefmsgid string `json:"inf_refmsgid"`
91
+	RefmsgTime  string `json:"refmsg_time"`
92
+	RespondTime string `json:"respond_time"`
93
+	Enctype     string `json:"enctype"`
94
+	Signtype    string `json:"signtype"`
95
+	ErrMsg      string `json:"err_msg"`
96 96
 	Output      struct {
97 97
 		Result []struct {
98 98
 			JudgeResultDetailDtos []struct {
@@ -145,6 +145,288 @@ func (c *HisApiController) Get9001() {
145 145
 	}
146 146
 
147 147
 }
148
+func Check3101ForOne(c *HisApiController, patient_id int64, his models.VMHisPatient, admin_user_id int64, trig_scen string, record_time string, prescriptions []*models.HisPrescription) (res Result3101) {
149
+
150
+	adminUser := c.GetAdminUserInfo()
151
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
152
+	//his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
153
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
154
+	//record_time := c.GetString("record_time")
155
+	//trig_scen := c.GetString("trig_scen")
156
+
157
+	timeLayout := "2006-01-02"
158
+	loc, _ := time.LoadLocation("Local")
159
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
160
+	if err != nil {
161
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
162
+		return res
163
+	}
164
+	recordDateTime := theTime.Unix()
165
+
166
+	var patientPrescription models.HisPrescriptionInfo
167
+	//patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
168
+	//if patientPrescription.ID == 0 {
169
+	patientPrescription, _ = service.FindLastPatientPrescriptionInfoTwo(adminUser.CurrentOrgId, patient_id, recordDateTime)
170
+	//}
171
+	department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
172
+	doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
173
+	//
174
+	diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
175
+
176
+	//prescriptions, _ := service.GetNewHisPrescriptionTen(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
177
+
178
+	var pp models.PublicParams
179
+	pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
180
+	pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
181
+	pp.FixmedinsName = miConfig.OrgName
182
+	pp.FixmedinsCode = miConfig.Code
183
+
184
+	pp.RequestUrl = miConfig.Url
185
+	pp.Cainfo = miConfig.Cainfo
186
+	pp.SecretKey = miConfig.SecretKey
187
+	pp.AccessKey = miConfig.AccessKey
188
+	pp.OpterName = roles.UserName
189
+
190
+	var config []*models.HisXtDiagnoseConfig
191
+	for _, item := range diagnosis_ids {
192
+		id, _ := strconv.ParseInt(item, 10, 64)
193
+		diagnosisConfig, _ := service.FindDiagnoseById(id)
194
+		config = append(config, &diagnosisConfig)
195
+	}
196
+
197
+	var pd models.PatientDtos
198
+	pd.PatnID = his.PsnNo
199
+	pd.PatnName = his.Name
200
+	pd.Gend = his.Gend
201
+	pd.Brdy = his.Brdy
202
+	pd.Poolarea = his.InsuplcAdmdvs
203
+	pd.CurrMdtrtID = his.Number
204
+
205
+	var fed models.FsiEncounterDtos
206
+	fed.MdtrtID = his.Number
207
+	fed.MedinsID = miConfig.Code
208
+	fed.MedinsName = miConfig.OrgName
209
+	fed.MedinsAdmdvs = miConfig.MdtrtareaAdmvs
210
+	fed.MedMdtrtType = "1"
211
+	fed.MedinsType = "1"
212
+	fed.MedinsLv = "11"
213
+	tm := time.Unix(his.RecordDate, 0)
214
+	s_tm := tm.Format("2006-01-02 15:04:05")
215
+	fed.AdmDate = s_tm
216
+	fed.DscgDate = s_tm
217
+	fed.DscgMainDiseCodg = config[0].CountryCode
218
+	fed.DscgMainDiseName = config[0].CountryContentName
219
+	//诊断信息
220
+	var fdds []*models.FsiDiagnoseDtos
221
+	for index, item := range config {
222
+		if index == 0 {
223
+			var fdd models.FsiDiagnoseDtos
224
+			fdd.DiseID = strconv.FormatInt(item.ID, 10)
225
+			fdd.InoutDiseType = "1"
226
+			fdd.MaindiseFlag = "1"
227
+			fdd.DiseDate = s_tm
228
+			fdd.DiasSrtNo = "1"
229
+			fdd.DiseName = item.CountryContentName
230
+			fdd.DiseCodg = item.CountryCode
231
+			fdds = append(fdds, &fdd)
232
+
233
+		} else {
234
+			var fdd models.FsiDiagnoseDtos
235
+			fdd.DiseID = strconv.FormatInt(item.ID, 10)
236
+			fdd.InoutDiseType = "1"
237
+			fdd.MaindiseFlag = "1"
238
+			fdd.DiseDate = s_tm
239
+			fdd.DiasSrtNo = strconv.FormatInt(int64(index), 10)
240
+			fdd.DiseName = item.CountryContentName
241
+			fdd.DiseCodg = item.CountryCode
242
+			fdds = append(fdds, &fdd)
243
+		}
244
+	}
245
+	fed.DrCodg = strconv.FormatInt(doctor_info.ID, 10)
246
+	fed.AdmDeptCodg = strconv.FormatInt(department.ID, 10)
247
+	fed.AdmDeptName = department.Name
248
+	fed.DscgDeptCodg = strconv.FormatInt(department.ID, 10)
249
+	fed.DscgDeptName = department.Name
250
+	fed.MedMdtrtType = "1"
251
+	fed.MedType = "11"
252
+	//if his.Insutype == "390" {
253
+	//	fed.MedType = "1402"
254
+	//} else {
255
+	//	fed.MedType = "9933"
256
+	//}
257
+	var orders []*models.FsiOrderDtos
258
+
259
+	if trig_scen == "2" {
260
+		//处方医嘱信息
261
+		for _, item := range prescriptions {
262
+			for _, subItem := range item.HisDoctorAdviceInfo {
263
+				var order models.FsiOrderDtos
264
+				order.RxID = strconv.FormatInt(item.ID, 10)
265
+				order.Rxno = strconv.FormatInt(item.ID, 10)
266
+				order.LongDrordFlag = "0"
267
+				order.HilistType = "1"
268
+				order.ChrgType = "1"
269
+				order.DrordBhvr = "-"
270
+				order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
271
+				order.HosplistName = subItem.BaseDrugLib.DrugName
272
+				order.HilistLv = "1"
273
+				order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
274
+				order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
275
+				order.HosplistName = subItem.BaseDrugLib.DrugName
276
+				order.Cnt = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
277
+				order.Pric = fmt.Sprintf("%.2f", subItem.Price)
278
+				order.Sumamt = fmt.Sprintf("%.2f", (subItem.PrescribingNumber * subItem.Price))
279
+				order.OwnpayAmt = ""
280
+				order.SelfpayAmt = ""
281
+				order.Spec = ""
282
+				order.SpecUnt = ""
283
+				order.DrordBegnDate = s_tm
284
+				order.DrordStopDate = ""
285
+				order.DrordDrCodg = "1"
286
+				order.DrordDeptName = department.Name
287
+				order.DrordDrCodg = "1"
288
+				order.DrordDrName = doctor_info.UserName
289
+				order.DrordDrProfttl = ""
290
+				order.CurrDrordFlag = "1"
291
+				orders = append(orders, &order)
292
+			}
293
+			for _, subItem := range item.HisPrescriptionProject {
294
+				if subItem.Type == 2 {
295
+					var order models.FsiOrderDtos
296
+					order.RxID = strconv.FormatInt(item.ID, 10)
297
+					order.Rxno = strconv.FormatInt(item.ID, 10)
298
+					order.LongDrordFlag = "0"
299
+					order.HilistType = "1"
300
+					order.ChrgType = "1"
301
+					order.DrordBhvr = "-"
302
+					order.HilistCode = subItem.HisProject.MedicalCode
303
+					order.HosplistName = subItem.HisProject.ProjectName
304
+					order.HilistLv = "1"
305
+					order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
306
+					order.HosplistCode = subItem.HisProject.MedicalCode
307
+					order.HosplistName = subItem.HisProject.ProjectName
308
+					order.Cnt = subItem.Count
309
+					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
310
+					order.Pric = fmt.Sprintf("%.2f", subItem.Price)
311
+					order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
312
+					order.OwnpayAmt = ""
313
+					order.SelfpayAmt = ""
314
+					order.Spec = ""
315
+					order.SpecUnt = ""
316
+					order.DrordBegnDate = s_tm
317
+					order.DrordStopDate = ""
318
+					order.DrordDrCodg = "1"
319
+					order.DrordDeptName = department.Name
320
+					order.DrordDrCodg = "1"
321
+					order.DrordDrName = doctor_info.UserName
322
+					order.DrordDrProfttl = ""
323
+					order.CurrDrordFlag = "1"
324
+					orders = append(orders, &order)
325
+
326
+				}
327
+				if subItem.Type == 3 {
328
+
329
+					var order models.FsiOrderDtos
330
+					order.RxID = strconv.FormatInt(item.ID, 10)
331
+					order.Rxno = strconv.FormatInt(item.ID, 10)
332
+					order.LongDrordFlag = "0"
333
+					order.HilistType = "1"
334
+					order.ChrgType = "1"
335
+					order.DrordBhvr = "-"
336
+					order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
337
+					order.HosplistName = subItem.GoodInfo.GoodName
338
+					order.HilistLv = "1"
339
+					order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
340
+					order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
341
+					order.HosplistName = subItem.GoodInfo.GoodName
342
+					order.Cnt = subItem.Count
343
+					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
344
+					order.Pric = fmt.Sprintf("%.2f", subItem.Price)
345
+					order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
346
+					order.OwnpayAmt = ""
347
+					order.SelfpayAmt = ""
348
+					order.Spec = ""
349
+					order.SpecUnt = ""
350
+					order.DrordBegnDate = s_tm
351
+					order.DrordStopDate = ""
352
+					order.DrordDrCodg = "1"
353
+					order.DrordDeptName = department.Name
354
+					order.DrordDrCodg = "1"
355
+					order.DrordDrName = doctor_info.UserName
356
+					order.DrordDrProfttl = ""
357
+					order.CurrDrordFlag = "1"
358
+					orders = append(orders, &order)
359
+
360
+				}
361
+			}
362
+		}
363
+		//处方医嘱信息
364
+	}
365
+	fed.MatnStas = "0"
366
+	fed.MedfeeSumamt = "0"
367
+	fed.OwnpayAmt = "0"
368
+	fed.SelfpayAmt = "0"
369
+	fed.AcctPayamt = "0"
370
+	fed.MaAmt = "0"
371
+	fed.HifpPayamt = "0"
372
+	fed.SetlTotlnum = "1"
373
+	fed.Insutype = his.Insutype
374
+	fed.ReimFlag = "0"
375
+	fed.OutSetlFlag = "0"
376
+
377
+	var fopd []*models.FsiOperationDtosData
378
+	data := make(map[string]interface{})
379
+	data["fed"] = fed
380
+	data["fdd"] = fdds
381
+	data["fod"] = orders
382
+	data["pd"] = pd
383
+	data["pp"] = pp
384
+	data["fopd"] = fopd
385
+	data["trig_scen"] = trig_scen
386
+	fmt.Println(data)
387
+	fmt.Println(fed)
388
+	fmt.Println(fdds)
389
+	fmt.Println(orders)
390
+	fmt.Println(pd)
391
+	fmt.Println(pp)
392
+	fmt.Println(fopd)
393
+
394
+	client := &http.Client{}
395
+	bytesData, _ := json.Marshal(data)
396
+	var req *http.Request
397
+
398
+	if miConfig.MdtrtareaAdmvs == "320921" {
399
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3101", bytes.NewReader(bytesData))
400
+	} else {
401
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3101", bytes.NewReader(bytesData))
402
+	}
403
+
404
+	resp, _ := client.Do(req)
405
+	defer resp.Body.Close()
406
+	body, ioErr := ioutil.ReadAll(resp.Body)
407
+	if ioErr != nil {
408
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
409
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
410
+		return res
411
+	}
412
+	var respJSON map[string]interface{}
413
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
414
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
415
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
416
+		return res
417
+	}
418
+	respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
419
+	result, _ := json.Marshal(respJSON)
420
+	if err := json.Unmarshal([]byte(result), &res); err != nil {
421
+		utils.ErrorLog("解析失败:%v", err)
422
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
423
+		return res
424
+	}
425
+
426
+	return res
427
+
428
+}
429
+
148 430
 func Check3101(c *HisApiController, patient_id int64, his_patient_id int64, admin_user_id int64, trig_scen string, record_time string, prescriptions []*models.HisPrescription) (res Result3101) {
149 431
 
150 432
 	adminUser := c.GetAdminUserInfo()
@@ -5566,6 +5848,31 @@ func (c *HisApiController) GetRegisterInfo() {
5566 5848
 					cert_no = bas[2]
5567 5849
 				}
5568 5850
 
5851
+				var hisPrescription []*models.HisPrescription
5852
+				res3101 := Check3101ForOne(c, patient.ID, his, admin_user_id, "1", record_time, hisPrescription)
5853
+
5854
+				if res3101.Infcode == "0" && len(res3101.Output.Result) > 0 {
5855
+					for _, item := range res3101.Output.Result {
5856
+						if len(res3101.ErrMsg) == 0 {
5857
+							res3101.ErrMsg = item.VolaCont
5858
+						} else {
5859
+							res3101.ErrMsg = res3101.ErrMsg + "\n" + item.VolaCont
5860
+						}
5861
+					}
5862
+					c.ServeSuccessJSON(map[string]interface{}{
5863
+						"failed_code": -10,
5864
+						"msg":         res3101.ErrMsg,
5865
+					})
5866
+					return
5867
+
5868
+				} else if res3101.Infcode != "0" {
5869
+					c.ServeSuccessJSON(map[string]interface{}{
5870
+						"failed_code": -10,
5871
+						"msg":         res3101.ErrMsg,
5872
+					})
5873
+					return
5874
+				}
5875
+
5569 5876
 				var api string
5570 5877
 				if miConfig.MdtrtareaAdmvs == "320921" {
5571 5878
 
@@ -6622,6 +6929,22 @@ func (c *HisApiController) GetUploadInfo() {
6622 6929
 							}
6623 6930
 
6624 6931
 						} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
6932
+							result3101 := Check3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
6933
+							if result3101.Infcode == "0" {
6934
+								if len(result3101.Output.Result) > 0 {
6935
+									var errMsgs []string
6936
+									for _, item := range result3101.Output.Result {
6937
+										errMsgs = append(errMsgs, item.VolaCont)
6938
+
6939
+									}
6940
+									c.ServeSuccessJSON(map[string]interface{}{
6941
+										"failed_code": -10,
6942
+										"msg":         errMsgs,
6943
+									})
6944
+									return
6945
+								}
6946
+							}
6947
+
6625 6948
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
6626 6949
 							psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
6627 6950
 							bas := strings.Split(psn_info.CardInfo, "|")
@@ -7041,6 +7364,21 @@ func (c *HisApiController) GetUploadInfo() {
7041 7364
 				}
7042 7365
 
7043 7366
 			} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
7367
+				result3101 := Check3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
7368
+				if result3101.Infcode == "0" {
7369
+					if len(result3101.Output.Result) > 0 {
7370
+						var errMsgs []string
7371
+						for _, item := range result3101.Output.Result {
7372
+							errMsgs = append(errMsgs, item.VolaCont)
7373
+
7374
+						}
7375
+						c.ServeSuccessJSON(map[string]interface{}{
7376
+							"failed_code": -10,
7377
+							"msg":         errMsgs,
7378
+						})
7379
+						return
7380
+					}
7381
+				}
7044 7382
 				psn_info, _ := service.GetPsnByPatientId(his.PatientId)
7045 7383
 				psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
7046 7384
 
@@ -8234,6 +8572,22 @@ func (c *HisApiController) GetPreUploadInfo() {
8234 8572
 				}
8235 8573
 
8236 8574
 			} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
8575
+				result3101 := Check3101(c, id, his_patient_id, admin_user_id, "2", record_time, prescriptions)
8576
+				if result3101.Infcode == "0" {
8577
+					if len(result3101.Output.Result) > 0 {
8578
+						var errMsgs []string
8579
+						for _, item := range result3101.Output.Result {
8580
+							errMsgs = append(errMsgs, item.VolaCont)
8581
+
8582
+						}
8583
+						c.ServeSuccessJSON(map[string]interface{}{
8584
+							"failed_code": -10,
8585
+							"msg":         errMsgs,
8586
+						})
8587
+						return
8588
+					}
8589
+				}
8590
+
8237 8591
 				bytesData, _ := json.Marshal(data)
8238 8592
 				var req *http.Request
8239 8593
 				if miConfig.MdtrtareaAdmvs == "320921" {
@@ -8556,6 +8910,22 @@ func (c *HisApiController) GetPreUploadInfo() {
8556 8910
 						}
8557 8911
 
8558 8912
 					} else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
8913
+						result3101 := Check3102(c, id, his_patient_id, admin_user_id, "6", order.ID)
8914
+						if result3101.Infcode == "0" {
8915
+							if len(result3101.Output.Result) > 0 {
8916
+								var errMsgs []string
8917
+								for _, item := range result3101.Output.Result {
8918
+									errMsgs = append(errMsgs, item.VolaCont)
8919
+
8920
+								}
8921
+								c.ServeSuccessJSON(map[string]interface{}{
8922
+									"failed_code": -10,
8923
+									"msg":         errMsgs,
8924
+								})
8925
+								return
8926
+							}
8927
+						}
8928
+
8559 8929
 						psn_info, _ := service.GetPsnByPatientId(his.PatientId)
8560 8930
 						psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
8561 8931
 

+ 6 - 6
service/fj_service.go View File

@@ -764,12 +764,12 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
764 764
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
765 765
 	input := make(map[string]interface{})
766 766
 	inputData := make(map[string]interface{})
767
-	inputMessage["infno"] = "3201"                 // 交易编码
768
-	inputData["url"] = baseParams.RequestUrl       // 险种
769
-	inputData["app_id"] = baseParams.AppID         // 险种
770
-	inputData["app_secret"] = baseParams.AppSecret // 险种
771
-	inputData["sign_key"] = baseParams.SignKey     // 险种
772
-	inputData["enc_key"] = baseParams.EncKey       // 险种
767
+	inputMessage["infno"] = "3201"                    // 交易编码
768
+	inputMessage["url"] = baseParams.RequestUrl       // 险种
769
+	inputMessage["app_id"] = baseParams.AppID         // 险种
770
+	inputMessage["app_secret"] = baseParams.AppSecret // 险种
771
+	inputMessage["sign_key"] = baseParams.SignKey     // 险种
772
+	inputMessage["enc_key"] = baseParams.EncKey       // 险种
773 773
 
774 774
 	inputData["insutype"] = businessParams.Insutype                   // 险种
775 775
 	inputData["clr_type"] = businessParams.ClrType                    // 就诊 ID(来自2201接口返回)

+ 5 - 0
service/his_service.go View File

@@ -520,6 +520,11 @@ func FindLastPatientPrescriptionInfo(org_id int64, patient_id int64, record_date
520 520
 	return
521 521
 }
522 522
 
523
+func FindLastPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
524
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ?", org_id, record_date, patient_id).Last(&info).Error
525
+	return
526
+}
527
+
523 528
 func SavePatientPrescriptionInfo(info models.HisPrescriptionInfo) (err error) {
524 529
 	err = writeDb.Save(&info).Error
525 530
 	return