|
@@ -39,6 +39,8 @@ func HisManagerApiRegistRouters() {
|
39
|
39
|
beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
|
40
|
40
|
beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
|
41
|
41
|
|
|
42
|
+ beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
|
|
43
|
+
|
42
|
44
|
}
|
43
|
45
|
|
44
|
46
|
func (c *HisApiController) Sscard() {
|
|
@@ -55,12 +57,11 @@ func (c *HisApiController) Sscard() {
|
55
|
57
|
func GetBaseInfo() error {
|
56
|
58
|
handle := syscall.MustLoadDLL("SSCard.dll")
|
57
|
59
|
ReadCardBas := handle.MustFindProc("ReadCardBas")
|
58
|
|
-
|
|
60
|
+
|
59
|
61
|
str := make([]byte, 256)
|
60
|
62
|
str1 := make([]byte, 256)
|
61
|
63
|
r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
62
|
64
|
|
63
|
|
-
|
64
|
65
|
fmt.Println(string(str))
|
65
|
66
|
fmt.Println(r)
|
66
|
67
|
return nil
|
|
@@ -1350,6 +1351,73 @@ func (c *HisApiController) Refund() {
|
1350
|
1351
|
}
|
1351
|
1352
|
}
|
1352
|
1353
|
|
|
1354
|
+func (c *HisApiController) RefundNumber() {
|
|
1355
|
+ record_time := c.GetString("record_time")
|
|
1356
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
1357
|
+ timeLayout := "2006-01-02"
|
|
1358
|
+ loc, _ := time.LoadLocation("Local")
|
|
1359
|
+ adminUser := c.GetAdminUserInfo()
|
|
1360
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
1361
|
+ fmt.Println(err)
|
|
1362
|
+ if err != nil {
|
|
1363
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1364
|
+ return
|
|
1365
|
+ }
|
|
1366
|
+ recordDateTime := theTime.Unix()
|
|
1367
|
+ his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
|
1368
|
+ patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
|
1369
|
+ //order, _ := service.GetHisOrderByID(order_id)
|
|
1370
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
1371
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
1372
|
+
|
|
1373
|
+ if config.IsOpen == 1 { //对接了医保,走医保流程
|
|
1374
|
+
|
|
1375
|
+ api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
|
|
1376
|
+ "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
1377
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
1378
|
+ resp3, requestErr3 := http.Get(api3)
|
|
1379
|
+ if requestErr3 != nil {
|
|
1380
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1381
|
+ return
|
|
1382
|
+ }
|
|
1383
|
+
|
|
1384
|
+ body3, ioErr3 := ioutil.ReadAll(resp3.Body)
|
|
1385
|
+ if ioErr3 != nil {
|
|
1386
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
|
|
1387
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1388
|
+ return
|
|
1389
|
+ }
|
|
1390
|
+ var respJSON3 map[string]interface{}
|
|
1391
|
+ if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
|
|
1392
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
1393
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1394
|
+ return
|
|
1395
|
+ }
|
|
1396
|
+
|
|
1397
|
+ //err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
|
1398
|
+ service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
|
|
1399
|
+
|
|
1400
|
+ if err == nil {
|
|
1401
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1402
|
+ "msg": "退费成功",
|
|
1403
|
+ })
|
|
1404
|
+ } else {
|
|
1405
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1406
|
+ return
|
|
1407
|
+ }
|
|
1408
|
+ } else {
|
|
1409
|
+ //err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
|
1410
|
+ //if err == nil {
|
|
1411
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
1412
|
+ // "msg": "退费成功",
|
|
1413
|
+ // })
|
|
1414
|
+ //} else {
|
|
1415
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1416
|
+ // return
|
|
1417
|
+ //}
|
|
1418
|
+ }
|
|
1419
|
+}
|
|
1420
|
+
|
1353
|
1421
|
//对账
|
1354
|
1422
|
func (c *HisApiController) GetCheckAccount() {
|
1355
|
1423
|
start_time := c.GetString("start_time")
|