|
@@ -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"] = "结算记录不存在,请检查参数是否正确"
|