|
@@ -51,7 +51,7 @@ func HisManagerApiRegistRouters() {
|
51
|
51
|
|
52
|
52
|
beego.Router("/api/pre_upload/get", &HisApiController{}, "get:GetPreUploadInfo")
|
53
|
53
|
|
54
|
|
- beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
|
|
54
|
+ //beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
|
55
|
55
|
|
56
|
56
|
beego.Router("/api/310", &HisApiController{}, "get:Check310")
|
57
|
57
|
beego.Router("/api/390", &HisApiController{}, "get:Check390")
|
|
@@ -1506,8 +1506,6 @@ func (c *HisApiController) GetUploadInfo() {
|
1506
|
1506
|
if res.Infcode == 0 {
|
1507
|
1507
|
var rf []*ResultFive
|
1508
|
1508
|
json.Unmarshal([]byte(his.Iinfo), &rf)
|
1509
|
|
- psn_no := his.PsnNo
|
1510
|
|
- mdtrt_id := his.Number
|
1511
|
1509
|
chrg_bchno := chrg_bchno
|
1512
|
1510
|
cert_no := his.Certno
|
1513
|
1511
|
|
|
@@ -1551,38 +1549,16 @@ func (c *HisApiController) GetUploadInfo() {
|
1551
|
1549
|
cert_no = his.Certno
|
1552
|
1550
|
|
1553
|
1551
|
}
|
1554
|
|
- fmt.Println(insutype)
|
1555
|
1552
|
|
1556
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
|
1557
|
|
- insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
|
1558
|
|
- "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
|
1559
|
|
- miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10)
|
1560
|
|
- resp, requestErr := http.Get(api)
|
1561
|
|
- if requestErr != nil {
|
1562
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1563
|
|
- return
|
1564
|
|
- }
|
1565
|
|
- defer resp.Body.Close()
|
1566
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
1567
|
|
- if ioErr != nil {
|
1568
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
1569
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1570
|
|
- return
|
1571
|
|
- }
|
1572
|
|
- var respJSON map[string]interface{}
|
1573
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
1574
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
1575
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1576
|
|
- return
|
|
1553
|
+ result, src_resquest := service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(patientPrescription.RegisterType, 10), his.IdCardType, 0, 0, 0, 0)
|
|
1554
|
+ var dat map[string]interface{}
|
|
1555
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
1556
|
+ fmt.Println(dat)
|
|
1557
|
+ } else {
|
|
1558
|
+ fmt.Println(err)
|
1577
|
1559
|
}
|
1578
|
|
- fmt.Println(respJSON)
|
1579
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
1580
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
1581
|
|
-
|
1582
|
|
- respJSON2 := respJSON["data"].(map[string]interface{})["pre2"].(map[string]interface{})
|
1583
|
|
- userJSONBytes2, _ := json.Marshal(respJSON2)
|
1584
|
1560
|
|
1585
|
|
- src_request := string(userJSONBytes2)
|
|
1561
|
+ userJSONBytes, _ := json.Marshal(dat)
|
1586
|
1562
|
|
1587
|
1563
|
var res ResultSeven
|
1588
|
1564
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
@@ -1590,6 +1566,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1590
|
1566
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1591
|
1567
|
return
|
1592
|
1568
|
}
|
|
1569
|
+
|
1593
|
1570
|
if res.Infcode == -1 {
|
1594
|
1571
|
errlog := &models.HisOrderError{
|
1595
|
1572
|
UserOrgId: adminUser.CurrentOrgId,
|
|
@@ -1651,7 +1628,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1651
|
1628
|
order.ClrWay = res.Output.Setlinfo.ClrWay
|
1652
|
1629
|
order.Creator = order.Creator
|
1653
|
1630
|
order.Modify = roles.AdminUserId
|
1654
|
|
- order.RequestLog = src_request
|
|
1631
|
+ order.RequestLog = src_resquest
|
1655
|
1632
|
setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
1656
|
1633
|
detailStr := string(setlDetail)
|
1657
|
1634
|
order.SetlDetail = detailStr
|
|
@@ -2394,223 +2371,211 @@ func (c *HisApiController) GetPreUploadInfo() {
|
2394
|
2371
|
}
|
2395
|
2372
|
}
|
2396
|
2373
|
|
2397
|
|
-func (c *HisApiController) GetSettleInfo() {
|
2398
|
|
- id, _ := c.GetInt64("id")
|
2399
|
|
- order_id, _ := c.GetInt64("order_id")
|
2400
|
|
-
|
2401
|
|
- record_time := c.GetString("record_time")
|
2402
|
|
- pay_way, _ := c.GetInt64("pay_way")
|
2403
|
|
- pay_price, _ := c.GetFloat("pay_price")
|
2404
|
|
- pay_card_no := c.GetString("pay_card_no")
|
2405
|
|
- discount_price, _ := c.GetFloat("discount_price")
|
2406
|
|
- preferential_price, _ := c.GetFloat("preferential_price")
|
2407
|
|
- reality_price, _ := c.GetFloat("reality_price")
|
2408
|
|
- found_price, _ := c.GetFloat("found_price")
|
2409
|
|
- medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
|
2410
|
|
- private_price, _ := c.GetFloat("private_price")
|
2411
|
|
- settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
|
2412
|
|
- admin_user_id, _ := c.GetInt64("admin_user_id")
|
2413
|
|
-
|
2414
|
|
- timeLayout := "2006-01-02"
|
2415
|
|
- loc, _ := time.LoadLocation("Local")
|
2416
|
|
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
2417
|
|
- if err != nil {
|
2418
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2419
|
|
- return
|
2420
|
|
- }
|
2421
|
|
- recordDateTime := theTime.Unix()
|
2422
|
|
- adminUser := c.GetAdminUserInfo()
|
2423
|
|
-
|
2424
|
|
- var prescriptions []*models.HisPrescription
|
2425
|
|
-
|
2426
|
|
- data := make(map[string]interface{})
|
2427
|
|
- if settle_accounts_type == 1 { //日结
|
2428
|
|
- prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
2429
|
|
- data["pre"] = prescriptions
|
2430
|
|
-
|
2431
|
|
- } else { //月结
|
2432
|
|
- start_time_str := c.GetString("start_time")
|
2433
|
|
- end_time_str := c.GetString("end_time")
|
2434
|
|
- timeLayout := "2006-01-02"
|
2435
|
|
- loc, _ := time.LoadLocation("Local")
|
2436
|
|
- theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
|
2437
|
|
- if err != nil {
|
2438
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2439
|
|
- return
|
2440
|
|
- }
|
2441
|
|
- recordStartTime := theStartTime.Unix()
|
2442
|
|
- theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
2443
|
|
- if err != nil {
|
2444
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2445
|
|
- return
|
2446
|
|
- }
|
2447
|
|
- recordEndTime := theEndTime.Unix()
|
2448
|
|
- prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
2449
|
|
- data["pre"] = prescriptions
|
2450
|
|
-
|
2451
|
|
- }
|
2452
|
|
-
|
2453
|
|
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
2454
|
|
-
|
2455
|
|
- his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2456
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2457
|
|
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2458
|
|
- strconv.FormatInt(his.PatientId, 10)
|
2459
|
|
-
|
2460
|
|
- order_src, _ := service.GetHisOrderByID(order_id)
|
2461
|
|
-
|
2462
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2463
|
|
- if config.IsOpen == 1 { //对接了医保,走医保流程
|
2464
|
|
-
|
2465
|
|
- var total float64
|
2466
|
|
- for _, item := range prescriptions {
|
2467
|
|
- if item.Type == 1 { //药品
|
2468
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
2469
|
|
- total = total + (subItem.Price * subItem.PrescribingNumber)
|
2470
|
|
- }
|
2471
|
|
- }
|
2472
|
|
- if item.Type == 2 { //项目
|
2473
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
2474
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
2475
|
|
- }
|
2476
|
|
- }
|
2477
|
|
- }
|
2478
|
|
-
|
2479
|
|
- for _, item := range prescriptions {
|
2480
|
|
- for _, subItem := range item.HisAdditionalCharge {
|
2481
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
2482
|
|
- }
|
2483
|
|
- }
|
2484
|
|
-
|
2485
|
|
- allTotal := fmt.Sprintf("%.2f", total)
|
2486
|
|
- var rf []*ResultFive
|
2487
|
|
- json.Unmarshal([]byte(his.Iinfo), &rf)
|
2488
|
|
- psn_no := order_src.PsnNo
|
2489
|
|
- mdtrt_id := order_src.MdtrtId
|
2490
|
|
- chrg_bchno := order_src.Number
|
2491
|
|
- cert_no := order_src.Certno
|
2492
|
|
- insutype := rf[0].Insutype
|
2493
|
|
-
|
2494
|
|
- if his.IdCardType == 1 {
|
2495
|
|
- cert_no = his.MedicalInsuranceNumber
|
2496
|
|
- } else {
|
2497
|
|
- cert_no = his.Certno
|
2498
|
|
- }
|
2499
|
|
-
|
2500
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
|
2501
|
|
- insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
|
2502
|
|
- "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
|
2503
|
|
- miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10) + "&fulamt_ownpay_amt=" + strconv.FormatFloat(order_src.FulamtOwnpayAmt, 'E', -1, 64) + "&overlmt_selfpay=" + strconv.FormatFloat(order_src.OverlmtSelfPay, 'E', -1, 64) + "&preselfpay_amt=" + strconv.FormatFloat(order_src.PreselfpayAmt, 'E', -1, 64) + "&inscp_scp_amt=" + strconv.FormatFloat(order_src.InscpScpAmt, 'E', -1, 64)
|
2504
|
|
- resp, requestErr := http.Get(api)
|
2505
|
|
- if requestErr != nil {
|
2506
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2507
|
|
- return
|
2508
|
|
- }
|
2509
|
|
- defer resp.Body.Close()
|
2510
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2511
|
|
- if ioErr != nil {
|
2512
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2513
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2514
|
|
- return
|
2515
|
|
- }
|
2516
|
|
- var respJSON map[string]interface{}
|
2517
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2518
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2519
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2520
|
|
- return
|
2521
|
|
- }
|
2522
|
|
- fmt.Println(respJSON)
|
2523
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2524
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2525
|
|
- var res ResultSeven
|
2526
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2527
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2528
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2529
|
|
- return
|
2530
|
|
- }
|
2531
|
|
- if res.Infcode == -1 {
|
2532
|
|
- errlog := &models.HisOrderError{
|
2533
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2534
|
|
- Ctime: time.Now().Unix(),
|
2535
|
|
- Mtime: time.Now().Unix(),
|
2536
|
|
- Number: chrg_bchno,
|
2537
|
|
- ErrMsg: res.ErrMsg,
|
2538
|
|
- Status: 1,
|
2539
|
|
- PatientId: id,
|
2540
|
|
- RecordTime: recordDateTime,
|
2541
|
|
- Stage: 6,
|
2542
|
|
- }
|
2543
|
|
- service.CreateErrMsgLog(errlog)
|
2544
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
|
2545
|
|
- return
|
2546
|
|
- } else {
|
2547
|
|
- order_src.OrderStatus = 2
|
2548
|
|
- order_src.PayWay = pay_way
|
2549
|
|
- order_src.PayPrice = pay_price
|
2550
|
|
- order_src.PayCardNo = pay_card_no
|
2551
|
|
- order_src.DiscountPrice = discount_price
|
2552
|
|
- order_src.PreferentialPrice = preferential_price
|
2553
|
|
- order_src.RealityPrice = reality_price
|
2554
|
|
- order_src.FoundPrice = found_price
|
2555
|
|
- order_src.MedicalInsurancePrice = medical_insurance_price
|
2556
|
|
- order_src.PrivatePrice = private_price
|
2557
|
|
- order_src.MdtrtId = res.Output.Setlinfo.MdtrtID
|
2558
|
|
- order_src.SetlId = res.Output.Setlinfo.SetlID
|
2559
|
|
- order_src.PsnNo = res.Output.Setlinfo.PsnNo
|
2560
|
|
- order_src.PsnName = res.Output.Setlinfo.PsnName
|
2561
|
|
- order_src.PsnCertType = res.Output.Setlinfo.PsnCertType
|
2562
|
|
- order_src.Certno = res.Output.Setlinfo.Certno
|
2563
|
|
- order_src.Gend = res.Output.Setlinfo.Gend
|
2564
|
|
- order_src.Naty = res.Output.Setlinfo.Naty
|
2565
|
|
- order_src.Age = res.Output.Setlinfo.Age
|
2566
|
|
- order_src.Insutype = res.Output.Setlinfo.Insutype
|
2567
|
|
- order_src.PsnType = res.Output.Setlinfo.PsnType
|
2568
|
|
- order_src.CvlservFlag = res.Output.Setlinfo.CvlservFlag
|
2569
|
|
- order_src.SetlTime = res.Output.Setlinfo.SetlTime
|
2570
|
|
- order_src.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
|
2571
|
|
- order_src.MedType = res.Output.Setlinfo.MedType
|
2572
|
|
- order_src.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
|
2573
|
|
- order_src.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
|
2574
|
|
- order_src.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
|
2575
|
|
- order_src.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
|
2576
|
|
- order_src.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
|
2577
|
|
- order_src.ActPayDedc = res.Output.Setlinfo.ActPayDedc
|
2578
|
|
- order_src.HifpPay = res.Output.Setlinfo.HifpPay
|
2579
|
|
- order_src.CvlservPay = res.Output.Setlinfo.CvlservPay
|
2580
|
|
- order_src.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
|
2581
|
|
- order_src.HifesPay = res.Output.Setlinfo.HifesPay
|
2582
|
|
- order_src.HifobPay = res.Output.Setlinfo.HifobPay
|
2583
|
|
- order_src.MafPay = res.Output.Setlinfo.MafPay
|
2584
|
|
- order_src.OthPay = res.Output.Setlinfo.OthPay
|
2585
|
|
- order_src.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
|
2586
|
|
- order_src.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
|
2587
|
|
- order_src.AcctPay = res.Output.Setlinfo.AcctPay
|
2588
|
|
- order_src.PsnCashPay = res.Output.Setlinfo.PsnCashPay
|
2589
|
|
- order_src.HospPartAmt = res.Output.Setlinfo.HospPartAmt
|
2590
|
|
- order_src.Balc = res.Output.Setlinfo.Balc
|
2591
|
|
- order_src.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
|
2592
|
|
- order_src.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
|
2593
|
|
- order_src.ClrOptins = res.Output.Setlinfo.ClrOptins
|
2594
|
|
- order_src.ClrWay = res.Output.Setlinfo.ClrWay
|
2595
|
|
- order_src.Creator = order_src.Creator
|
2596
|
|
- order_src.Modify = roles.ID
|
2597
|
|
- setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
2598
|
|
- detailStr := string(setlDetail)
|
2599
|
|
- order_src.SetlDetail = detailStr
|
2600
|
|
- err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
2601
|
|
- err = service.UpDateOrder(order_src)
|
2602
|
|
-
|
2603
|
|
- if err == nil {
|
2604
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2605
|
|
- "msg": "结算成功",
|
2606
|
|
- })
|
2607
|
|
- } else {
|
2608
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
2609
|
|
- return
|
2610
|
|
- }
|
2611
|
|
- }
|
2612
|
|
- }
|
2613
|
|
-}
|
|
2374
|
+//func (c *HisApiController) GetSettleInfo() {
|
|
2375
|
+// id, _ := c.GetInt64("id")
|
|
2376
|
+// order_id, _ := c.GetInt64("order_id")
|
|
2377
|
+//
|
|
2378
|
+// record_time := c.GetString("record_time")
|
|
2379
|
+// pay_way, _ := c.GetInt64("pay_way")
|
|
2380
|
+// pay_price, _ := c.GetFloat("pay_price")
|
|
2381
|
+// pay_card_no := c.GetString("pay_card_no")
|
|
2382
|
+// discount_price, _ := c.GetFloat("discount_price")
|
|
2383
|
+// preferential_price, _ := c.GetFloat("preferential_price")
|
|
2384
|
+// reality_price, _ := c.GetFloat("reality_price")
|
|
2385
|
+// found_price, _ := c.GetFloat("found_price")
|
|
2386
|
+// medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
|
|
2387
|
+// private_price, _ := c.GetFloat("private_price")
|
|
2388
|
+// settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
|
|
2389
|
+// admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
2390
|
+//
|
|
2391
|
+// timeLayout := "2006-01-02"
|
|
2392
|
+// loc, _ := time.LoadLocation("Local")
|
|
2393
|
+// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
2394
|
+// if err != nil {
|
|
2395
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2396
|
+// return
|
|
2397
|
+// }
|
|
2398
|
+// recordDateTime := theTime.Unix()
|
|
2399
|
+// adminUser := c.GetAdminUserInfo()
|
|
2400
|
+//
|
|
2401
|
+// var prescriptions []*models.HisPrescription
|
|
2402
|
+//
|
|
2403
|
+// data := make(map[string]interface{})
|
|
2404
|
+// if settle_accounts_type == 1 { //日结
|
|
2405
|
+// prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2406
|
+// data["pre"] = prescriptions
|
|
2407
|
+//
|
|
2408
|
+// } else { //月结
|
|
2409
|
+// start_time_str := c.GetString("start_time")
|
|
2410
|
+// end_time_str := c.GetString("end_time")
|
|
2411
|
+// timeLayout := "2006-01-02"
|
|
2412
|
+// loc, _ := time.LoadLocation("Local")
|
|
2413
|
+// theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
|
|
2414
|
+// if err != nil {
|
|
2415
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2416
|
+// return
|
|
2417
|
+// }
|
|
2418
|
+// recordStartTime := theStartTime.Unix()
|
|
2419
|
+// theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
|
2420
|
+// if err != nil {
|
|
2421
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2422
|
+// return
|
|
2423
|
+// }
|
|
2424
|
+// recordEndTime := theEndTime.Unix()
|
|
2425
|
+// prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
|
2426
|
+// data["pre"] = prescriptions
|
|
2427
|
+//
|
|
2428
|
+// }
|
|
2429
|
+//
|
|
2430
|
+// roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
2431
|
+//
|
|
2432
|
+// his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2433
|
+// miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
2434
|
+// patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2435
|
+// strconv.FormatInt(his.PatientId, 10)
|
|
2436
|
+//
|
|
2437
|
+// order_src, _ := service.GetHisOrderByID(order_id)
|
|
2438
|
+//
|
|
2439
|
+// config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
2440
|
+// if config.IsOpen == 1 { //对接了医保,走医保流程
|
|
2441
|
+//
|
|
2442
|
+// var total float64
|
|
2443
|
+// for _, item := range prescriptions {
|
|
2444
|
+// if item.Type == 1 { //药品
|
|
2445
|
+// for _, subItem := range item.HisDoctorAdviceInfo {
|
|
2446
|
+// total = total + (subItem.Price * subItem.PrescribingNumber)
|
|
2447
|
+// }
|
|
2448
|
+// }
|
|
2449
|
+// if item.Type == 2 { //项目
|
|
2450
|
+// for _, subItem := range item.HisPrescriptionProject {
|
|
2451
|
+// total = total + (subItem.Price * float64(subItem.Count))
|
|
2452
|
+// }
|
|
2453
|
+// }
|
|
2454
|
+// }
|
|
2455
|
+//
|
|
2456
|
+// for _, item := range prescriptions {
|
|
2457
|
+// for _, subItem := range item.HisAdditionalCharge {
|
|
2458
|
+// total = total + (subItem.Price * float64(subItem.Count))
|
|
2459
|
+// }
|
|
2460
|
+// }
|
|
2461
|
+//
|
|
2462
|
+// allTotal := fmt.Sprintf("%.2f", total)
|
|
2463
|
+// var rf []*ResultFive
|
|
2464
|
+// json.Unmarshal([]byte(his.Iinfo), &rf)
|
|
2465
|
+// psn_no := order_src.PsnNo
|
|
2466
|
+// mdtrt_id := order_src.MdtrtId
|
|
2467
|
+// chrg_bchno := order_src.Number
|
|
2468
|
+// cert_no := order_src.Certno
|
|
2469
|
+// insutype := rf[0].Insutype
|
|
2470
|
+//
|
|
2471
|
+// if his.IdCardType == 1 {
|
|
2472
|
+// cert_no = his.MedicalInsuranceNumber
|
|
2473
|
+// } else {
|
|
2474
|
+// cert_no = his.Certno
|
|
2475
|
+// }
|
|
2476
|
+//
|
|
2477
|
+// result, src_resquest := service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, strconv.FormatFloat(total, 'E', -1, 64) ,miConfig.OrgName,roles.UserName,miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(patientPrescription.RegisterType, 10),his.IdCardType, order_src.FulamtOwnpayAmt,order_src.OverlmtSelfPay,order_src.PreselfpayAmt,order_src.InscpScpAmt)
|
|
2478
|
+// var dat map[string]interface{}
|
|
2479
|
+// if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2480
|
+// fmt.Println(dat)
|
|
2481
|
+// } else {
|
|
2482
|
+// fmt.Println(err)
|
|
2483
|
+// }
|
|
2484
|
+//
|
|
2485
|
+// userJSONBytes, _ := json.Marshal(dat)
|
|
2486
|
+//
|
|
2487
|
+//
|
|
2488
|
+//
|
|
2489
|
+// var res ResultSeven
|
|
2490
|
+// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
2491
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
2492
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2493
|
+// return
|
|
2494
|
+// }
|
|
2495
|
+// if res.Infcode == -1 {
|
|
2496
|
+// errlog := &models.HisOrderError{
|
|
2497
|
+// UserOrgId: adminUser.CurrentOrgId,
|
|
2498
|
+// Ctime: time.Now().Unix(),
|
|
2499
|
+// Mtime: time.Now().Unix(),
|
|
2500
|
+// Number: chrg_bchno,
|
|
2501
|
+// ErrMsg: res.ErrMsg,
|
|
2502
|
+// Status: 1,
|
|
2503
|
+// PatientId: id,
|
|
2504
|
+// RecordTime: recordDateTime,
|
|
2505
|
+// Stage: 6,
|
|
2506
|
+// }
|
|
2507
|
+// service.CreateErrMsgLog(errlog)
|
|
2508
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
|
|
2509
|
+// return
|
|
2510
|
+// } else {
|
|
2511
|
+// order_src.OrderStatus = 2
|
|
2512
|
+// order_src.PayWay = pay_way
|
|
2513
|
+// order_src.PayPrice = pay_price
|
|
2514
|
+// order_src.PayCardNo = pay_card_no
|
|
2515
|
+// order_src.DiscountPrice = discount_price
|
|
2516
|
+// order_src.PreferentialPrice = preferential_price
|
|
2517
|
+// order_src.RealityPrice = reality_price
|
|
2518
|
+// order_src.FoundPrice = found_price
|
|
2519
|
+// order_src.MedicalInsurancePrice = medical_insurance_price
|
|
2520
|
+// order_src.PrivatePrice = private_price
|
|
2521
|
+// order_src.MdtrtId = res.Output.Setlinfo.MdtrtID
|
|
2522
|
+// order_src.SetlId = res.Output.Setlinfo.SetlID
|
|
2523
|
+// order_src.PsnNo = res.Output.Setlinfo.PsnNo
|
|
2524
|
+// order_src.PsnName = res.Output.Setlinfo.PsnName
|
|
2525
|
+// order_src.PsnCertType = res.Output.Setlinfo.PsnCertType
|
|
2526
|
+// order_src.Certno = res.Output.Setlinfo.Certno
|
|
2527
|
+// order_src.Gend = res.Output.Setlinfo.Gend
|
|
2528
|
+// order_src.Naty = res.Output.Setlinfo.Naty
|
|
2529
|
+// order_src.Age = res.Output.Setlinfo.Age
|
|
2530
|
+// order_src.Insutype = res.Output.Setlinfo.Insutype
|
|
2531
|
+// order_src.PsnType = res.Output.Setlinfo.PsnType
|
|
2532
|
+// order_src.CvlservFlag = res.Output.Setlinfo.CvlservFlag
|
|
2533
|
+// order_src.SetlTime = res.Output.Setlinfo.SetlTime
|
|
2534
|
+// order_src.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
|
|
2535
|
+// order_src.MedType = res.Output.Setlinfo.MedType
|
|
2536
|
+// order_src.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
|
|
2537
|
+// order_src.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
|
|
2538
|
+// order_src.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
|
|
2539
|
+// order_src.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
|
|
2540
|
+// order_src.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
|
|
2541
|
+// order_src.ActPayDedc = res.Output.Setlinfo.ActPayDedc
|
|
2542
|
+// order_src.HifpPay = res.Output.Setlinfo.HifpPay
|
|
2543
|
+// order_src.CvlservPay = res.Output.Setlinfo.CvlservPay
|
|
2544
|
+// order_src.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
|
|
2545
|
+// order_src.HifesPay = res.Output.Setlinfo.HifesPay
|
|
2546
|
+// order_src.HifobPay = res.Output.Setlinfo.HifobPay
|
|
2547
|
+// order_src.MafPay = res.Output.Setlinfo.MafPay
|
|
2548
|
+// order_src.OthPay = res.Output.Setlinfo.OthPay
|
|
2549
|
+// order_src.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
|
|
2550
|
+// order_src.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
|
|
2551
|
+// order_src.AcctPay = res.Output.Setlinfo.AcctPay
|
|
2552
|
+// order_src.PsnCashPay = res.Output.Setlinfo.PsnCashPay
|
|
2553
|
+// order_src.HospPartAmt = res.Output.Setlinfo.HospPartAmt
|
|
2554
|
+// order_src.Balc = res.Output.Setlinfo.Balc
|
|
2555
|
+// order_src.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
|
|
2556
|
+// order_src.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
|
|
2557
|
+// order_src.ClrOptins = res.Output.Setlinfo.ClrOptins
|
|
2558
|
+// order_src.ClrWay = res.Output.Setlinfo.ClrWay
|
|
2559
|
+// order_src.Creator = order_src.Creator
|
|
2560
|
+// order_src.Modify = roles.ID
|
|
2561
|
+// order_src.RequestLog = src_resquest
|
|
2562
|
+// setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
|
2563
|
+// detailStr := string(setlDetail)
|
|
2564
|
+// order_src.SetlDetail = detailStr
|
|
2565
|
+// err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
|
2566
|
+// err = service.UpDateOrder(order_src)
|
|
2567
|
+//
|
|
2568
|
+// if err == nil {
|
|
2569
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
2570
|
+// "msg": "结算成功",
|
|
2571
|
+// })
|
|
2572
|
+// } else {
|
|
2573
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
|
2574
|
+// return
|
|
2575
|
+// }
|
|
2576
|
+// }
|
|
2577
|
+// }
|
|
2578
|
+//}
|
2614
|
2579
|
|
2615
|
2580
|
//退款
|
2616
|
2581
|
func (c *HisApiController) Refund() {
|
|
@@ -2638,7 +2603,7 @@ func (c *HisApiController) Refund() {
|
2638
|
2603
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2639
|
2604
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
2640
|
2605
|
|
2641
|
|
- result, src_resquest := service.Gdyb2208(order.PsnNo, order.MdtrtId, roles.UserName, order.SetlId, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
|
|
2606
|
+ result, src_resquest := service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
|
2642
|
2607
|
|
2643
|
2608
|
var dat map[string]interface{}
|
2644
|
2609
|
if err := json.Unmarshal([]byte(result), &dat); err == nil {
|