|
@@ -6165,14 +6165,18 @@ func (c *HisApiController) RefundNumber() {
|
6165
|
6165
|
}
|
6166
|
6166
|
func (c *HisApiController) RefundDetail() {
|
6167
|
6167
|
order_id, _ := c.GetInt64("order_id")
|
|
6168
|
+ //admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
6169
|
+
|
6168
|
6170
|
//his_patient_id, _ := c.GetInt64("his_patient_id")
|
6169
|
6171
|
|
6170
|
6172
|
number := c.GetString("number")
|
6171
|
6173
|
record_time := c.GetString("record_time")
|
6172
|
6174
|
patient_id, _ := c.GetInt64("patient_id")
|
|
6175
|
+
|
6173
|
6176
|
timeLayout := "2006-01-02"
|
6174
|
6177
|
loc, _ := time.LoadLocation("Local")
|
6175
|
6178
|
adminUser := c.GetAdminUserInfo()
|
|
6179
|
+ //roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
6176
|
6180
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
6177
|
6181
|
fmt.Println(err)
|
6178
|
6182
|
if err != nil {
|
|
@@ -6196,36 +6200,85 @@ func (c *HisApiController) RefundDetail() {
|
6196
|
6200
|
his, _ := service.GetHisPatientByNumber(order.MdtrtId)
|
6197
|
6201
|
|
6198
|
6202
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
6199
|
|
- api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
|
6200
|
|
- "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
6201
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
6202
|
|
- resp2, requestErr2 := http.Get(api2)
|
6203
|
|
- if requestErr2 != nil {
|
6204
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
6205
|
|
- return
|
6206
|
|
- }
|
|
6203
|
+ var res2 ResultSix
|
6207
|
6204
|
|
6208
|
|
- body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
6209
|
|
- if ioErr2 != nil {
|
6210
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
6211
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
6212
|
|
- return
|
6213
|
|
- }
|
6214
|
|
- var respJSON2 map[string]interface{}
|
6215
|
|
- if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
6216
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
6217
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
6218
|
|
- return
|
6219
|
|
- }
|
|
6205
|
+ if miConfig.MdtrtareaAdmvs == "421300" {
|
|
6206
|
+ api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
|
|
6207
|
+ "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
6208
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
6209
|
+ resp3, requestErr3 := http.Get(api3)
|
|
6210
|
+ if requestErr3 != nil {
|
|
6211
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6212
|
+ return
|
|
6213
|
+ }
|
|
6214
|
+ body3, ioErr3 := ioutil.ReadAll(resp3.Body)
|
|
6215
|
+ if ioErr3 != nil {
|
|
6216
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
|
|
6217
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6218
|
+ return
|
|
6219
|
+ }
|
|
6220
|
+ var respJSON3 map[string]interface{}
|
|
6221
|
+ if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
|
|
6222
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
6223
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6224
|
+ return
|
|
6225
|
+ }
|
6220
|
6226
|
|
6221
|
|
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
|
6222
|
|
- if err == nil {
|
6223
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
6224
|
|
- "msg": "退费成功",
|
6225
|
|
- })
|
|
6227
|
+ respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
6228
|
+ userJSONBytes3, _ := json.Marshal(respJSON3)
|
|
6229
|
+ fmt.Println("log")
|
|
6230
|
+ fmt.Println(string(userJSONBytes3))
|
|
6231
|
+ if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
|
|
6232
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
6233
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6234
|
+ return
|
|
6235
|
+ }
|
|
6236
|
+
|
|
6237
|
+ err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
|
|
6238
|
+ if err == nil {
|
|
6239
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
6240
|
+ "msg": "撤销明细成功",
|
|
6241
|
+ })
|
|
6242
|
+ return
|
|
6243
|
+ } else {
|
|
6244
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6245
|
+ return
|
|
6246
|
+ }
|
6226
|
6247
|
} else {
|
6227
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
6228
|
|
- return
|
|
6248
|
+ api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
|
|
6249
|
+ "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
6250
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
6251
|
+ resp2, requestErr2 := http.Get(api2)
|
|
6252
|
+ if requestErr2 != nil {
|
|
6253
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6254
|
+ return
|
|
6255
|
+ }
|
|
6256
|
+
|
|
6257
|
+ body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
|
6258
|
+ if ioErr2 != nil {
|
|
6259
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
|
6260
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6261
|
+ return
|
|
6262
|
+ }
|
|
6263
|
+ var respJSON2 map[string]interface{}
|
|
6264
|
+ if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
|
6265
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
6266
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6267
|
+ return
|
|
6268
|
+ }
|
|
6269
|
+
|
|
6270
|
+ err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
|
|
6271
|
+ if err == nil {
|
|
6272
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
6273
|
+ "msg": "撤销明细成功",
|
|
6274
|
+ })
|
|
6275
|
+ return
|
|
6276
|
+
|
|
6277
|
+ } else {
|
|
6278
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
6279
|
+ return
|
|
6280
|
+ }
|
|
6281
|
+
|
6229
|
6282
|
}
|
6230
|
6283
|
} else {
|
6231
|
6284
|
err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
|