XMLWAN преди 2 години
родител
ревизия
6ae59579c4

+ 484 - 13
controllers/coordinate_controller.go Целия файл

@@ -68,6 +68,36 @@ type RefundDetail struct {
68 68
 	Code string `json:"code"`
69 69
 }
70 70
 
71
+type ResultQuery struct {
72
+	Msg    string `json:"msg"`
73
+	Result []struct {
74
+		Type      string `json:"type"`
75
+		Name      string `json:"name"`
76
+		Vaa01     int    `json:"vaa01"`
77
+		Vaa07     int    `json:"vaa07"`
78
+		Visittime string `json:"visittime"`
79
+	} `json:"result"`
80
+	Code string `json:"code"`
81
+}
82
+
83
+type ResultUpload struct {
84
+	Code   string `json:"code"`
85
+	Msg    string `json:"msg"`
86
+	Result []struct {
87
+		List            []interface{} `json:"list"`
88
+		Page            int64         `json:"page"`
89
+		Pagenumber      int64         `json:"pagenumber"`
90
+		Records         int64         `json:"records"`
91
+		RecordsFiltered int64         `json:"recordsFiltered"`
92
+		RecordsTotal    int64         `json:"recordsTotal"`
93
+		Result          string        `json:"result"`
94
+		ResultMsg       string        `json:"resultMsg"`
95
+		Total           int64         `json:"total"`
96
+		TotalPage       int64         `json:"totalPage"`
97
+		Userdata        string        `json:"userdata"`
98
+	} `json:"result"`
99
+}
100
+
71 101
 func CoordinateRcegistRouters() {
72 102
 	beego.Router("/coordinate/check", &CoordinateController{}, "get:SavePatientMessageInfo")
73 103
 	//坐标挂号
@@ -80,6 +110,439 @@ func CoordinateRcegistRouters() {
80 110
 	beego.Router("/coordinate/settle", &CoordinateController{}, "post:Settle")
81 111
 	//坐标退费回调
82 112
 	beego.Router("/coordinate/refund", &CoordinateController{}, "post:Refund")
113
+	//坐标患者查询~上传医嘱~结算功能
114
+	beego.Router("/coordinate/settleAccount", &CoordinateController{}, "get:SettleAccount")
115
+
116
+}
117
+
118
+func (c *CoordinateController) SettleAccount() {
119
+	patient_id, _ := c.GetInt64("patient_id")
120
+	record_date := c.GetString("record_date")
121
+	admin_user_id, _ := c.GetInt64("admin_user_id")
122
+	diagnosis_id := c.GetString("diagnosis")
123
+	sick_type, _ := c.GetInt64("sick_type")
124
+	reg_type, _ := c.GetInt64("p_type")
125
+	org_id, _ := c.GetInt64("org_id")
126
+	org_id = 3877
127
+	org, _ := service.GetOrgById(org_id)
128
+	patient, _ := service.GetPatientByID(org.Id, patient_id)
129
+	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
130
+
131
+	result, request := service.GetHisPatientForCoordinate(patient.IdCardNo)
132
+	saveLog(result, request, "查询", "查询", org.OrgName)
133
+	var res ResultQuery
134
+	if err := json.Unmarshal([]byte(result), &res); err != nil {
135
+		utils.ErrorLog("解析失败:%v", err)
136
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
137
+		return
138
+	}
139
+	if res.Code == "10000" {
140
+		if len(res.Result) == 0 {
141
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientNoRegException)
142
+			return
143
+		}
144
+		timeLayout := "2006-01-02"
145
+		loc, _ := time.LoadLocation("Local")
146
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
147
+		if err != nil {
148
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
149
+			return
150
+		}
151
+		org_id := org.Id
152
+		recordDateTime := theTime.Unix()
153
+		patientPrescription, _ := service.FindPatientPrescriptionInfoTwo(org_id, patient.ID, recordDateTime, 2)
154
+		if patientPrescription.ID == 0 {
155
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(org_id, patient.ID, recordDateTime)
156
+		}
157
+		departmwnt, _ := service.GetDepartMentDetail(patientPrescription.Departments)
158
+		doctor_info, _ := service.GetAdminUserInfoByID(org_id, patientPrescription.DoctorId)
159
+		//admin_user_info, _ := service.GetAdminUserInfoByID(org_id, admin_user_id)
160
+
161
+		var prescriptions []*models.HisPrescription
162
+
163
+		if settle_accounts_type == 1 { //日结
164
+			prescriptions, _ = service.GetUnSettleHisPrescriptionFive(org_id, patient_id, recordDateTime, 2)
165
+		} else { //月结
166
+
167
+			start_time_str := c.GetString("start_time")
168
+			end_time_str := c.GetString("end_time")
169
+			timeLayout := "2006-01-02"
170
+			loc, _ := time.LoadLocation("Local")
171
+			theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
172
+			if err != nil {
173
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
174
+				return
175
+			}
176
+			recordStartTime := theStartTime.Unix()
177
+			theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
178
+			if err != nil {
179
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
180
+				return
181
+			}
182
+			recordEndTime := theEndTime.Unix()
183
+			prescriptions, _ = service.GetUnSettleMonthHisPrescription(org_id, patient_id, recordStartTime, recordEndTime)
184
+		}
185
+		var total float64
186
+
187
+		for _, item := range prescriptions {
188
+			fmt.Println(item)
189
+			if item.Type == 1 { //药品
190
+				for _, subItem := range item.HisDoctorAdviceInfo {
191
+					total = total + (subItem.Price * subItem.PrescribingNumber)
192
+				}
193
+			}
194
+			if item.Type == 2 { //项目
195
+				for _, subItem := range item.HisPrescriptionProject {
196
+					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
197
+					total = total + (subItem.Price * cnt)
198
+				}
199
+			}
200
+
201
+		}
202
+
203
+		var ids []int64
204
+
205
+		for _, item := range prescriptions {
206
+			ids = append(ids, item.ID)
207
+		}
208
+
209
+		var customs []*models.NewCustomTwo
210
+		for _, item := range prescriptions {
211
+			if item.Type == 1 { //药品
212
+				for _, subItem := range item.HisDoctorAdviceInfo {
213
+					cus := &models.NewCustomTwo{
214
+						AdviceId:         subItem.ID,
215
+						ProjectId:        0,
216
+						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
217
+						Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
218
+						FeedetlSn:        subItem.FeedetlSn,
219
+						Price:            fmt.Sprintf("%.2f", subItem.Price),
220
+						MedListCodg:      subItem.Drug.MedicalInsuranceNumber,
221
+						Type:             1,
222
+					}
223
+					customs = append(customs, cus)
224
+				}
225
+			}
226
+			if item.Type == 2 { //项目
227
+				for _, subItem := range item.HisPrescriptionProject {
228
+					if subItem.Type == 2 {
229
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
230
+						cus := &models.NewCustomTwo{
231
+							AdviceId:         0,
232
+							ProjectId:        subItem.ID,
233
+							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
234
+							Cut:              fmt.Sprintf("%.4f", cnt),
235
+							FeedetlSn:        subItem.FeedetlSn,
236
+							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
237
+							MedListCodg:      subItem.HisProject.MedicalCode,
238
+							Type:             2,
239
+						}
240
+						customs = append(customs, cus)
241
+
242
+					} else {
243
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
244
+						cus := &models.NewCustomTwo{
245
+							AdviceId:         0,
246
+							ProjectId:        subItem.ID,
247
+							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
248
+							Cut:              fmt.Sprintf("%.4f", cnt),
249
+							FeedetlSn:        subItem.FeedetlSn,
250
+							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
251
+							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
252
+							Type:             3,
253
+						}
254
+						customs = append(customs, cus)
255
+					}
256
+
257
+				}
258
+			}
259
+		}
260
+
261
+		var info models.UploadInfo
262
+		info.Vaa01 = res.Result[0].Vaa01
263
+		info.Fasong = "1"
264
+		info.Vaa07 = res.Result[0].Vaa07
265
+		info.Bck01c = departmwnt.Number
266
+		info.Bce02a = doctor_info.DoctorNumber
267
+
268
+		diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
269
+		var config []*models.HisXtDiagnoseConfig
270
+		for _, item := range diagnosis_ids {
271
+			id, _ := strconv.ParseInt(item, 10, 64)
272
+			diagnosisConfig, _ := service.FindDiagnoseById(id)
273
+			config = append(config, diagnosisConfig)
274
+		}
275
+		for index, item := range config {
276
+			var diag models.Diag
277
+			diag.Vao06 = strconv.FormatInt(int64(index+1), 10)
278
+			diag.Bak02 = item.CountryCode
279
+			info.Diag = append(info.Diag, &diag)
280
+		}
281
+		var presInfos []*models.PresInfo
282
+		var presDetails []*models.PresDetail
283
+		for index, item := range prescriptions {
284
+			var presDetail models.PresDetail
285
+			var presInfo models.PresInfo
286
+			presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
287
+			if item.Type == 1 {
288
+				presInfo.Cbm06 = "0"
289
+			} else {
290
+				presInfo.Cbm06 = "5"
291
+			}
292
+
293
+			if item.Type == 1 {
294
+				presInfo.Cbm07 = item.MedType
295
+			} else {
296
+				presInfo.Cbm07 = item.MedType
297
+			}
298
+
299
+			presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
300
+			var infoItems []*models.Item
301
+			for _, subItem := range item.HisDoctorAdviceInfo {
302
+				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
303
+
304
+				var infoItem models.Item
305
+				infoItem.Rownr = "0"
306
+				infoItem.Vaf11 = "1"
307
+				infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
308
+				infoItem.Bbx01 = subItem.Drug.MedicalInsuranceNumber
309
+				infoItem.Bda01 = "1"
310
+				infoItem.Bby01 = ""
311
+				if subItem.Drug.MinUnit != subItem.Drug.DoseUnit {
312
+					infoItem.Vaf22 = subItem.Drug.DrugName + " " + subItem.Drug.Dose + subItem.Drug.DoseUnit + "*" + strconv.FormatInt(subItem.Drug.MinNumber, 10) + subItem.Drug.MinUnit + "/" + subItem.Drug.MaxUnit
313
+				}
314
+				infoItem.Vaf14 = subItem.Drug.DrugName
315
+				infoItem.Bdi01 = ef.Code
316
+				infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
317
+				infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
318
+				infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
319
+				infoItem.Vaf35 = "0"
320
+				infoItem.Vaf32 = "0"
321
+				infoItem.Bck01b = departmwnt.Number
322
+				infoItem.Bck01d = departmwnt.Number
323
+				infoItem.Vaf58 = "0"
324
+				infoItem.Vaf61 = "1"
325
+				infoItems = append(infoItems, &infoItem)
326
+			}
327
+			for _, subItem := range item.HisPrescriptionProject {
328
+				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
329
+
330
+				if subItem.Type == 2 {
331
+					var infoItem models.Item
332
+					infoItem.Rownr = "0"
333
+					infoItem.Vaf11 = "1"
334
+					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
335
+					infoItem.Bbx01 = subItem.HisProject.MedicalCode
336
+
337
+					if subItem.HisProject.CostClassify == 2 {
338
+						infoItem.Bda01 = "T"
339
+					} else if subItem.HisProject.CostClassify == 3 {
340
+						infoItem.Bda01 = "L"
341
+					} else {
342
+						infoItem.Bda01 = "T"
343
+					}
344
+					infoItem.Bby01 = ""
345
+					infoItem.Vaf22 = subItem.HisProject.ProjectName
346
+					infoItem.Bdi01 = ef.Code
347
+					infoItem.Vaf17 = subItem.Day
348
+					infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
349
+					infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.Count)
350
+					infoItem.Vaf35 = "0"
351
+					infoItem.Vaf18 = 0
352
+					infoItem.Vaf32 = "0"
353
+					infoItem.Bck01b = departmwnt.Number
354
+					infoItem.Bck01d = departmwnt.Number
355
+					infoItem.Vaf58 = "0"
356
+					infoItem.Vaf61 = "1"
357
+					infoItems = append(infoItems, &infoItem)
358
+
359
+				} else {
360
+					var infoItem models.Item
361
+					infoItem.Rownr = "0"
362
+					infoItem.Vaf11 = "1"
363
+					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
364
+					infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
365
+					infoItem.Bda01 = "M"
366
+					infoItem.Bby01 = ""
367
+					infoItem.Vaf22 = subItem.GoodInfo.GoodName + " " + subItem.GoodInfo.SpecificationName
368
+					infoItem.Bdi01 = ef.Code
369
+					infoItem.Vaf17 = subItem.Day
370
+					infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
371
+					infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.Count)
372
+					infoItem.Vaf35 = "0"
373
+					infoItem.Vaf32 = "0"
374
+					infoItem.Bck01b = departmwnt.Number
375
+					infoItem.Bck01d = departmwnt.Number
376
+					infoItem.Vaf58 = "0"
377
+					infoItem.Vaf61 = "1"
378
+					infoItems = append(infoItems, &infoItem)
379
+
380
+				}
381
+
382
+			}
383
+			presDetail.Item = infoItems
384
+			presDetails = append(presDetails, &presDetail)
385
+			presInfo.PresDetail = presDetails
386
+			presInfos = append(presInfos, &presInfo)
387
+		}
388
+		info.PresInfo = presInfos
389
+
390
+		result2, request2 := service.UploadPrescriptionForCoordinate(info)
391
+		saveLog(result2, request2, "上传明细", "上传明细", org.OrgName)
392
+
393
+		var res2 ResultUpload
394
+		if err := json.Unmarshal([]byte(result2), &res2); err != nil {
395
+			utils.ErrorLog("解析失败:%v", err)
396
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
397
+			return
398
+		}
399
+		if res2.Code == "10000" {
400
+
401
+			timestamp := time.Now().Unix()
402
+			tempTime := time.Unix(timestamp, 0)
403
+			timeFormat := tempTime.Format("20060102150405")
404
+			chrgBchno := rand.Intn(100000) + 10000
405
+			ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(patient.ID, 10)
406
+			his := models.VMHisPatient{
407
+				Name:                   patient.Name,
408
+				Gender:                 patient.Gender,
409
+				Birthday:               patient.Birthday,
410
+				MedicalTreatmentType:   0,
411
+				IdType:                 1,
412
+				IdCardNo:               patient.IdCardNo,
413
+				BalanceAccountsType:    1,
414
+				MedicalInsuranceNumber: "",
415
+				RegisterType:           0,
416
+				RegisterCost:           0,
417
+				TreatmentCost:          0,
418
+				Status:                 1,
419
+				Ctime:                  time.Now().Unix(),
420
+				Mtime:                  time.Now().Unix(),
421
+				PsnNo:                  strconv.FormatInt(int64(res.Result[0].Vaa01), 10),
422
+				PsnCertType:            "",
423
+				Certno:                 patient.IdCardNo,
424
+				PsnName:                patient.Name,
425
+				Gend:                   "",
426
+				Naty:                   "",
427
+				Brdy:                   "",
428
+				Age:                    0,
429
+				Iinfo:                  "",
430
+				Idetinfo:               "",
431
+				PatientId:              patient.ID,
432
+				RecordDate:             theTime.Unix(),
433
+				UserOrgId:              org_id,
434
+				AdminUserId:            admin_user_id,
435
+				IsReturn:               1,
436
+				Doctor:                 patientPrescription.DoctorId,
437
+				Departments:            patientPrescription.Departments,
438
+				IptOtpNo:               ipt_otp_no,
439
+				Number:                 strconv.FormatInt(int64(res.Result[0].Vaa07), 10),
440
+				PhoneNumber:            patient.Phone,
441
+			}
442
+			service.UpdateHisPatientStatus(&his)
443
+			service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, org_id)
444
+			tm := time.Unix(time.Now().Unix(), 0)
445
+
446
+			order := &models.HisOrder{
447
+				PsnNo:              his.PsnNo,
448
+				UserOrgId:          org_id,
449
+				HisPatientId:       his.ID,
450
+				PatientId:          patient_id,
451
+				SettleAccountsDate: recordDateTime,
452
+				Ctime:              time.Now().Unix(),
453
+				Mtime:              time.Now().Unix(),
454
+				Status:             1,
455
+				OrderStatus:        1,
456
+				MdtrtId:            his.Number,
457
+				Number:             ipt_otp_no,
458
+				SetlId:             "",
459
+				MedfeeSumamt:       total,
460
+				MedType:            strconv.Itoa(int(reg_type)),
461
+				SettleEndTime:      0,
462
+				SettleStartTime:    0,
463
+				SettleType:         settle_accounts_type,
464
+				Diagnosis:          diagnosis_id,
465
+				PType:              2,
466
+				SetlTime:           tm.Format("2006-01-02 15:04:05"),
467
+			}
468
+			err = service.CreateOrder(order)
469
+			if err != nil {
470
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
471
+				return
472
+			}
473
+
474
+			for _, item := range customs {
475
+				var advice_id int64 = 0
476
+				var project_id int64 = 0
477
+				var item_id int64 = 0
478
+
479
+				var types int64 = 0
480
+
481
+				if item.Type == 1 {
482
+					advice_id = item.AdviceId
483
+					project_id = 0
484
+					item_id = 0
485
+				} else if item.Type == 2 {
486
+					advice_id = 0
487
+					item_id = 0
488
+
489
+					project_id = item.ProjectId
490
+				} else if item.Type == 3 {
491
+					advice_id = 0
492
+					item_id = item.ItemId
493
+					project_id = 0
494
+				}
495
+				detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
496
+				cut, _ := strconv.ParseFloat(item.Cut, 32)
497
+				pric, _ := strconv.ParseFloat(item.Price, 32)
498
+				info := &models.HisOrderInfo{
499
+					OrderNumber:      order.Number,
500
+					UploadDate:       time.Now().Unix(),
501
+					AdviceId:         advice_id,
502
+					DetItemFeeSumamt: detItemFeeSumamt,
503
+					Cnt:              cut,
504
+					Pric:             pric,
505
+					PatientId:        patient_id,
506
+					Status:           1,
507
+					Mtime:            time.Now().Unix(),
508
+					Ctime:            time.Now().Unix(),
509
+					UserOrgId:        org_id,
510
+					HisPatientId:     his.ID,
511
+					OrderId:          order.ID,
512
+					ProjectId:        project_id,
513
+					Type:             types,
514
+					ItemId:           item_id,
515
+				}
516
+				service.CreateOrderInfo(info)
517
+			}
518
+			his.Diagnosis = diagnosis_id
519
+			his.SickType = sick_type
520
+			his.RegisterType = reg_type
521
+			his.MedicalTreatmentType = reg_type
522
+			service.UpdataHisPateintTwo(&his)
523
+			err = service.UpDatePrescriptionNumber(org_id, ids, strconv.FormatInt(int64(chrgBchno), 10))
524
+			err = service.UpDateHisPrescriptionInfoNumber(org_id, patient_id, strconv.FormatInt(int64(chrgBchno), 10), recordDateTime, his.ID)
525
+			err = service.UpdataOrderStatusThree(strconv.FormatInt(int64(chrgBchno), 10), org_id)
526
+
527
+			c.ServeSuccessJSON(map[string]interface{}{
528
+				"msg": "医嘱保存成功",
529
+			})
530
+
531
+		} else {
532
+			c.ServeSuccessJSON(map[string]interface{}{
533
+				"failed_code": -10,
534
+				"msg":         res.Msg,
535
+			})
536
+
537
+		}
538
+
539
+	} else {
540
+		c.ServeSuccessJSON(map[string]interface{}{
541
+			"failed_code": -10,
542
+			"msg":         res.Msg,
543
+		})
544
+
545
+	}
83 546
 
84 547
 }
85 548
 
@@ -97,15 +560,17 @@ func (c *CoordinateController) Settle() {
97 560
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
98 561
 		return
99 562
 	}
100
-	patien_id := respJSON["patientid"].(string)
101
-	infoSeq := respJSON["infoseq"].(string)
102
-	docId := respJSON["docid"].(string)
103
-	fmt.Println(patien_id)
104
-	fmt.Println(infoSeq)
105
-	fmt.Println(docId)
106
-
107
-	order, _ := service.GetHisOrderFour(patien_id, infoSeq, "")
108
-	order.SetlId = docId
563
+	patien_id := respJSON["vaa01"].(float64)
564
+	infoSeq := respJSON["vaa07"].(float64)
565
+
566
+	//strconv.For(patien_id, 10)
567
+
568
+	vaa001 := fmt.Sprintf("%f", patien_id)
569
+	vaa007 := fmt.Sprintf("%f", infoSeq)
570
+
571
+	setl_id := respJSON["setl_id"].(string)
572
+	order, _ := service.GetHisOrderFour(vaa001, vaa007, "")
573
+	order.SetlId = setl_id
109 574
 	if order.ID == 0 {
110 575
 		json := make(map[string]interface{})
111 576
 		json["msg"] = "结算记录不存在,请检查参数是否正确"
@@ -134,10 +599,16 @@ func (c *CoordinateController) Refund() {
134 599
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
135 600
 		return
136 601
 	}
137
-	patien_id := respJSON["patientid"].(string)
138
-	infoSeq := respJSON["infoseq"].(string)
139
-	docId := respJSON["docid"].(string)
140
-	order, _ := service.GetHisOrderFour(patien_id, infoSeq, docId)
602
+	patien_id := respJSON["vaa01"].(float64)
603
+	infoSeq := respJSON["vaa07"].(float64)
604
+
605
+	//strconv.For(patien_id, 10)
606
+
607
+	vaa001 := fmt.Sprintf("%f", patien_id)
608
+	vaa007 := fmt.Sprintf("%f", infoSeq)
609
+
610
+	docId := respJSON["setl_id"].(string)
611
+	order, _ := service.GetHisOrderFour(vaa001, vaa007, docId)
141 612
 	if order.ID == 0 {
142 613
 		json := make(map[string]interface{})
143 614
 		json["msg"] = "结算记录不存在,请检查参数是否正确"

+ 1 - 1
controllers/data_api_controller.go Целия файл

@@ -825,7 +825,6 @@ func (c *DataApiController) CreateExecutionFrequency() {
825 825
 		return
826 826
 	}
827 827
 	timeNow := time.Now().Unix()
828
-	ef.Code = ""
829 828
 	ef.Status = 1
830 829
 	ef.CreatedTime = timeNow
831 830
 	ef.UpdatedTime = timeNow
@@ -881,6 +880,7 @@ func (c *DataApiController) UpdateExecutionFrequency() {
881 880
 	timeNow := time.Now().Unix()
882 881
 	ef.UpdatedTime = timeNow
883 882
 	ef.Name = efdata.Name
883
+	ef.Code = efdata.Code
884 884
 
885 885
 	err = service.UpdateExecutionFrequency(ef)
886 886
 	if err != nil {

+ 31 - 0
controllers/dialysis_api_controller.go Целия файл

@@ -393,6 +393,17 @@ func (c *DialysisApiController) PostPrescription() {
393 393
 		}
394 394
 
395 395
 		prescription.Creater = adminUserInfo.AdminUser.Id
396
+
397
+		//针对河间咸得
398
+		if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 {
399
+
400
+			if prescription.ModeId != 2 && prescription.ModeId != 5 && prescription.ModeId != 12 {
401
+
402
+				prescription.DisplaceLiquiPart = 0
403
+				prescription.DisplaceLiquiValue = 0
404
+			}
405
+		}
406
+
396 407
 		err := service.AddSigleRecord(&prescription)
397 408
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
398 409
 		redis := service.RedisClient()
@@ -875,6 +886,26 @@ func (c *DialysisApiController) PostSoulution() {
875 886
 		OxygenTime:                 oxygen_time,
876 887
 		PreImpulse:                 preImpules,
877 888
 	}
889
+
890
+	//针对河间咸得
891
+	if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 {
892
+
893
+		if prescription.ModeId != 2 && prescription.ModeId != 5 && prescription.ModeId != 12 {
894
+
895
+			prescription.DisplaceLiquiPart = 0
896
+			prescription.DisplaceLiquiValue = 0
897
+		}
898
+	}
899
+
900
+	if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 {
901
+
902
+		if solution.ModeId != 2 && solution.ModeId != 5 && solution.ModeId != 12 {
903
+
904
+			solution.DisplaceLiquiPart = 0
905
+			solution.DisplaceLiquiValue = 0
906
+		}
907
+	}
908
+
878 909
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
879 910
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
880 911
 	redis := service.RedisClient()

+ 158 - 0
controllers/err_msg.json Целия файл

@@ -0,0 +1,158 @@
1
+{
2
+  "msg": [
3
+    {
4
+      "url": "/m/api/solution?mode=1,/api/dialysis/soulution?mode=1,/api/patients/dialysissolution/create?mode=1",
5
+      "err_msg": "没有权限新增长期处方"
6
+    },{
7
+      "url": ",,/api/patients/dialysissolution/edit?mode=2",
8
+      "err_msg": "没有权限修改长期处方"
9
+    },{
10
+      "url": ",,/api/patients/dialysissolution/edit?mode=3",
11
+      "err_msg": "没有权限修改别人的长期处方"
12
+    },{
13
+      "url": "/m/api/dialysis/dialysisPrescription?mode=1,/api/dialysis/prescription?mode=1,",
14
+      "err_msg": "没有权限新增临时处方"
15
+    },{
16
+      "url": "/m/api/dialysis/dialysisPrescription?mode=3,/api/dialysis/prescription?mode=3,",
17
+      "err_msg": "没有权限修改他人的临时处方"
18
+    },{
19
+      "url": "/m/api/dialysis/acceptsAssessment?mode=1,/api/dialysis/accepts?mode=1,",
20
+      "err_msg": "没有权限新增接诊评估"
21
+    },{
22
+      "url": "/m/api/dialysis/acceptsAssessment?mode=2,/api/dialysis/accepts?mode=2,",
23
+      "err_msg": "没有权限修改接诊评估"
24
+    },{
25
+      "url": "/m/api/dialysis/acceptsAssessment?mode=3,/api/dialysis/accepts?mode=3,",
26
+      "err_msg": "没有权限修改别人接诊评估"
27
+    },{
28
+      "url": "/m/api/assessmentbefore/commit?mode=1,/api/dialysis/assessmentbeforedislysis?mode=1,",
29
+      "err_msg": "没有权限新增透前评估"
30
+    },{
31
+      "url": "/m/api/assessmentbefore/commit?mode=2,/api/dialysis/assessmentbeforedislysis?mode=2,",
32
+      "err_msg": "没有权限修改透前评估"
33
+    },{
34
+      "url": "/m/api/assessmentbefore/commit?mode=3,/api/dialysis/assessmentbeforedislysis?mode=3,",
35
+      "err_msg": "没有权限修改别人透前评估"
36
+    },{
37
+      "url": "/m/api/dialysis/start?mode=1,/api/dialysis/start_record?mode=1,",
38
+      "err_msg": "没有权限执行上机"
39
+    },{
40
+      "url": "/m/api/startOrder/edit?mode=2,/api/start_dialysis/modify?mode=2,",
41
+      "err_msg": "没有权限修改执行上机"
42
+    },{
43
+      "url": "/m/api/startOrder/edit?mode=3,/api/start_dialysis/modify?mode=3,",
44
+      "err_msg": "没有权限修改他人执行上机"
45
+    },{
46
+      "url": "/m/api/monitor/add?mode=1,/api/dislysis/monitor/edit?mode=1,",
47
+      "err_msg": "没有权限新增透析监测"
48
+    },{
49
+      "url": "/m/api/monitor/edit?mode=2,/api/dislysis/monitor/edit?mode=2,",
50
+      "err_msg": "没有权限修改透析监测"
51
+    },{
52
+      "url": "/m/api/monitor/edit?mode=3,/api/dislysis/monitor/edit?mode=3,",
53
+      "err_msg": "没有权限修改他人透析监测"
54
+    },{
55
+      "url": "/m/api/monitor/delete?mode=4,/api/dialysis/monitor/del?mode=4,",
56
+      "err_msg": "没有权限删除透析监测"
57
+    },{
58
+      "url": "/m/api/monitor/delete?mode=5,/api/dialysis/monitor/del?mode=5,",
59
+      "err_msg": "没有权限删除他人透析监测"
60
+    },{
61
+      "url": "/m/api/dialysis/finish?mode=1,/api/dialysis/finish?mode=1,",
62
+      "err_msg": "没有权限执行下机"
63
+    },{
64
+      "url": "/m/api/finishOrder/edit?mode=2,/api/finish_dialysis/modify?mode=2,",
65
+      "err_msg": "没有权限修改执行下机"
66
+    },{
67
+      "url": "/m/api/finishOrder/edit?mode=3,/api/finish_dialysis/modify?mode=3,",
68
+      "err_msg": "没有权限修改他人执行下机"
69
+    },{
70
+      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=1,/api/dialysis/assessmentafterdislysis?mode=1,",
71
+      "err_msg": "没有权限新增透后评估"
72
+    },{
73
+      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=2,/api/dialysis/assessmentafterdislysis?mode=2,",
74
+      "err_msg": "没有权限修改透后评估"
75
+    },{
76
+      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=3,/api/dialysis/assessmentafterdislysis?mode=3,",
77
+      "err_msg": "没有权限修改他人透后评估"
78
+    },{
79
+      "url": "/m/api/dialysis/treatmentSummary?mode=1,/api/dialysis/treatmentsummary?mode=1,",
80
+      "err_msg": "没有权限新增治疗小结"
81
+    },{
82
+      "url": "/m/api/dialysis/treatmentSummary?mode=2,/api/dialysis/treatmentsummary?mode=2,",
83
+      "err_msg": "没有权限修改治疗小结"
84
+    },{
85
+      "url": "/m/api/dialysis/treatmentSummary?mode=3,/api/dialysis/treatmentsummary?mode=3,",
86
+      "err_msg": "没有权限修改他人治疗小结"
87
+    },{
88
+      "url": "/m/api/dryweight/commit?mode=1,/api/dryweight/commit?mode=1,/api/patient/updatedryweightdata?mode=1",
89
+      "err_msg": "没有权限新增干体重"
90
+    },{
91
+      "url": ",/api/patients/advice/create?mode=1-1,/api/patients/advice/creategroup?mode=1-1",
92
+      "err_msg": "没有权限新增临时医嘱"
93
+    },{
94
+      "url": ",/api/patients/advice/edit?mode=2-1,",
95
+      "err_msg": "没有权限修改临时医嘱"
96
+    },{
97
+      "url": ",/api/patients/advice/edit?mode=3-1,",
98
+      "err_msg": "没有权限修改他人临时医嘱"
99
+    },{
100
+      "url": ",/api/patients/advice/delete?mode=4-1,/api/patients/advice/deletegroup?mode=4-1",
101
+      "err_msg": "没有权限删除临时医嘱"
102
+    },{
103
+      "url": ",/api/patients/advice/delete?mode=5-1,/api/patients/advice/deletegroup?mode=5-1",
104
+      "err_msg": "没有权限删除他人开的临时医嘱"
105
+    },{
106
+      "url": ",/api/patients/advice/create?mode=1-2,/api/patients/advice/creategroup?mode=1-2",
107
+      "err_msg": "没有权限新增长期医嘱"
108
+    },{
109
+      "url": ",/api/patients/advice/edit?mode=1-3,",
110
+      "err_msg": "没有权限修改长期医嘱"
111
+    },{
112
+      "url": ",/api/patients/advice/edit?mode=1-4,",
113
+      "err_msg": "没有权限修改他人长期医嘱"
114
+    },{
115
+      "url": ",/api/patients/advice/stop?mode=1-5,",
116
+      "err_msg": "没有权限停止长期医嘱"
117
+    },{
118
+      "url": ",/api/patients/advice/delete?mode=1-6,/api/patients/advice/deletegroup?mode=1-6",
119
+      "err_msg": "没有权限删除长期医嘱"
120
+    },{
121
+      "url": ",/api/patients/advice/delete?mode=1-7,/api/patients/advice/deletegroup?mode=1-7",
122
+      "err_msg": "没有权限删除他人长期医嘱"
123
+    },{
124
+      "url": "/m/api/advice/creategroup?mode=1,/api/patients/advice/creategroup?mode=1,/api/patients/advice/create?mode=1",
125
+      "err_msg": "没有权限新增透析临时医嘱"
126
+    },{
127
+      "url": "/m/api/advice/edit?mode=2,/api/patients/advice/edit?mode=2,",
128
+      "err_msg": "没有权限修改透析临时医嘱"
129
+    },{
130
+      "url": "/m/api/advice/edit?mode=3,/api/patients/advice/edit?mode=3,",
131
+      "err_msg": "没有权限修改他人透析临时医嘱"
132
+    },{
133
+      "url": "/m/api/newadvice/delete?mode=4,/api/patients/advice/delete?mode=4,/api/patients/advice/deletegroup?mode=4",
134
+      "err_msg": "没有权限删除透析临时医嘱"
135
+    },{
136
+      "url": "/m/api/newadvice/delete?mode=5,/api/patients/advice/delete?mode=5,/api/patients/advice/deletegroup?mode=5",
137
+      "err_msg": "没有权限删除他人透析临时医嘱"
138
+    },{
139
+      "url": "/m/api/advice/exec?mode=6,/api/patients/advice/exec?mode=6,",
140
+      "err_msg": "没有权限执行透析临时医嘱"
141
+    },{
142
+      "url": "/m/api/advice/exec/modify?mode=8,,",
143
+      "err_msg": "没有权限修改已执行医嘱"
144
+    },{
145
+      "url": "/m/api/advice/check?mode=7,/api/patients/advice/check?mode=7,",
146
+      "err_msg": "没有权限核对透析临时医嘱"
147
+    },{
148
+      "url": ",/api/patients/advice/stop?mode=1-8,",
149
+      "err_msg": "没有权限停止他人长期医嘱"
150
+    },{
151
+      "url": ",/api/patients/advice/execgroup?mode=6-1,",
152
+      "err_msg": "没有权限执行医嘱"
153
+    },{
154
+      "url": ",/api/patients/advice/checkgroup?mode=7-1,",
155
+      "err_msg": "没有权限核对医嘱"
156
+    }
157
+  ]
158
+}

+ 5 - 1
controllers/his_api_controller.go Целия файл

@@ -2091,7 +2091,11 @@ func (c *HisApiController) CreateHisPrescription() {
2091 2091
 					stockInfo, _ := service.GetDrugAllStockInfo(storeConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
2092 2092
 					var sum_count int64
2093 2093
 					for _, its := range stockInfo {
2094
-						sum_count += its.StockMaxNumber*drug.MinNumber + its.StockMinNumber
2094
+						baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
2095
+						if its.MaxUnit == baseDrug.MaxUnit {
2096
+							its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
2097
+						}
2098
+						sum_count += its.StockMaxNumber + its.StockMinNumber
2095 2099
 					}
2096 2100
 					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
2097 2101
 				}

+ 1 - 0
controllers/pharmacy_controller.go Целия файл

@@ -564,6 +564,7 @@ func (this *PharmacyController) GetPatientsWithDrugs() {
564 564
 		return
565 565
 	}
566 566
 	total, err := service.CalculateTheTotalAmount(listll, drug_id)
567
+	fmt.Println("total2322332232323232332322wo", total)
567 568
 	if err != nil {
568 569
 		utils.ErrorLog(err.Error())
569 570
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)