|
@@ -5,25 +5,18 @@ import (
|
5
|
5
|
"XT_New/models"
|
6
|
6
|
"XT_New/service"
|
7
|
7
|
"XT_New/utils"
|
8
|
|
- "archive/zip"
|
9
|
8
|
"bytes"
|
10
|
9
|
"encoding/json"
|
11
|
10
|
"fmt"
|
12
|
11
|
"github.com/astaxie/beego"
|
13
|
12
|
"github.com/jinzhu/gorm"
|
14
|
|
- "github.com/shopspring/decimal"
|
15
|
|
- "io"
|
16
|
13
|
"io/ioutil"
|
17
|
14
|
"math/rand"
|
18
|
15
|
"net/http"
|
19
|
|
- "os"
|
20
|
|
- "path/filepath"
|
21
|
16
|
"reflect"
|
22
|
17
|
"strconv"
|
23
|
18
|
"strings"
|
24
|
|
- "syscall"
|
25
|
19
|
"time"
|
26
|
|
- "unsafe"
|
27
|
20
|
)
|
28
|
21
|
|
29
|
22
|
type HisApiController struct {
|
|
@@ -58,25 +51,22 @@ func HisManagerApiRegistRouters() {
|
58
|
51
|
beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
|
59
|
52
|
beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
|
60
|
53
|
|
61
|
|
- beego.Router("/api/settle/query", &HisApiController{}, "get:GetSettleAccounts")
|
|
54
|
+ beego.Router("/api/refund/post", &HisApiController{}, "post:Refund")
|
62
|
55
|
|
63
|
|
- beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
|
64
|
|
- beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
|
|
56
|
+ beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
|
65
|
57
|
|
66
|
|
- beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
|
|
58
|
+ beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
|
67
|
59
|
|
68
|
|
- beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
|
|
60
|
+ //beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
|
69
|
61
|
|
70
|
|
- beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
|
|
62
|
+ //新增附加费用
|
|
63
|
+ //beego.Router("/api/his/additionalcharge", &HisApiController{}, "Post:AdditionalCharge")
|
71
|
64
|
|
72
|
|
- beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
|
|
65
|
+ //beego.Router("/api/additionalcharge/get", &HisApiController{}, "Get:GetAdditionalcharge")
|
73
|
66
|
|
74
|
67
|
beego.Router("/api/hisprescription/get", &DialysisApiController{}, "Get:GetLastOrNextHisPrescription")
|
75
|
68
|
|
76
|
69
|
beego.Router("/api/callhisprescription/get", &DialysisApiController{}, "Get:GetCallHisPrescription")
|
77
|
|
- beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
|
78
|
|
-
|
79
|
|
-}
|
80
|
70
|
|
81
|
71
|
func (c *HisApiController) Sscard() {
|
82
|
72
|
//r := CardInit()
|
|
@@ -659,7 +649,7 @@ func (c *HisApiController) CreateHisPatientCaseHistory() {
|
659
|
649
|
|
660
|
650
|
blood_fat := c.GetString("blood_fat")
|
661
|
651
|
bloodfatfloat, _ := strconv.ParseFloat(blood_fat, 64)
|
662
|
|
- //fmt.Println("33333333", bloodfatfloat)
|
|
652
|
+ fmt.Println("33333333", bloodfatfloat)
|
663
|
653
|
blood_sugar := c.GetString("blood_sugar")
|
664
|
654
|
bloodsugarfloat, _ := strconv.ParseFloat(blood_sugar, 64)
|
665
|
655
|
fmt.Println(bloodsugarfloat)
|
|
@@ -1026,18 +1016,17 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
|
1026
|
1016
|
fmt.Println(project_id)
|
1027
|
1017
|
fmt.Println(project.ProjectId)
|
1028
|
1018
|
}
|
1029
|
|
- //if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
1030
|
|
- // //price := int64(json["price"].(float64))
|
1031
|
|
- // //fmt.Println("price--------------------------",price)
|
1032
|
|
- // //formatInt_price := strconv.FormatInt(price, 10)
|
1033
|
|
- // //float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
1034
|
|
- // //project.Price = float_price
|
1035
|
|
- //
|
1036
|
|
- //}
|
|
1019
|
+ // if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
|
1020
|
+ // price := int64(json["price"].(float64))
|
|
1021
|
+ // formatInt_price := strconv.FormatInt(price, 10)
|
|
1022
|
+ // float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
|
1023
|
+ // project.Price = float_price
|
|
1024
|
+ // }
|
1037
|
1025
|
if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "string" {
|
1038
|
1026
|
price, _ := strconv.ParseFloat(json["price"].(string), 64)
|
1039
|
1027
|
project.Price = price
|
1040
|
1028
|
}
|
|
1029
|
+
|
1041
|
1030
|
if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
|
1042
|
1031
|
total, _ := json["total"].(string)
|
1043
|
1032
|
totals, _ := strconv.ParseInt(total, 10, 64)
|
|
@@ -1092,6 +1081,12 @@ func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditi
|
1092
|
1081
|
}
|
1093
|
1082
|
}
|
1094
|
1083
|
}
|
|
1084
|
+ // if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
|
1085
|
+ // price := int64(json["price"].(float64))
|
|
1086
|
+ // formatInt_price := strconv.FormatInt(price, 10)
|
|
1087
|
+ // float_price, _ := strconv.ParseFloat(formatInt_price, 64)
|
|
1088
|
+ // additionalCharge.Price = float_price
|
|
1089
|
+ // }
|
1095
|
1090
|
|
1096
|
1091
|
//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
|
1097
|
1092
|
// price := int64(json["price"].(float64))
|
|
@@ -1336,7 +1331,6 @@ type ResultSix struct {
|
1336
|
1331
|
Signtype interface{} `json:"signtype"`
|
1337
|
1332
|
WarnMsg interface{} `json:"warn_msg"`
|
1338
|
1333
|
}
|
1339
|
|
-
|
1340
|
1334
|
type ResultSeven struct {
|
1341
|
1335
|
Cainfo string `json:"cainfo"`
|
1342
|
1336
|
ErrMsg string `json:"err_msg"`
|
|
@@ -1362,14 +1356,13 @@ type ResultSeven struct {
|
1362
|
1356
|
Gend string `json:"gend"`
|
1363
|
1357
|
HifesPay float64 `json:"hifes_pay"`
|
1364
|
1358
|
HifmiPay float64 `json:"hifmi_pay"`
|
|
1359
|
+ HifobPay float64 `json:"hifob_pay"`
|
1365
|
1360
|
HifpPay float64 `json:"hifp_pay"`
|
1366
|
1361
|
HospPartAmt float64 `json:"hosp_part_amt"`
|
1367
|
1362
|
InscpScpAmt float64 `json:"inscp_scp_amt"`
|
1368
|
1363
|
Insutype string `json:"insutype"`
|
1369
|
1364
|
MafPay float64 `json:"maf_pay"`
|
1370
|
1365
|
MdtrtCertType string `json:"mdtrt_cert_type"`
|
1371
|
|
- HifobPay float64 `json:"hifob_pay"`
|
1372
|
|
-
|
1373
|
1366
|
MdtrtID string `json:"mdtrt_id"`
|
1374
|
1367
|
MedType string `json:"med_type"`
|
1375
|
1368
|
MedfeeSumamt float64 `json:"medfee_sumamt"`
|
|
@@ -1556,7 +1549,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1556
|
1549
|
|
1557
|
1550
|
if config.IsOpen == 1 {
|
1558
|
1551
|
|
1559
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
1552
|
+ api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
1560
|
1553
|
resp, requestErr := http.Get(api)
|
1561
|
1554
|
|
1562
|
1555
|
if requestErr != nil {
|
|
@@ -1639,7 +1632,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1639
|
1632
|
doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
|
1640
|
1633
|
|
1641
|
1634
|
if count <= 0 {
|
1642
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
|
|
1635
|
+ api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
|
1643
|
1636
|
res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
|
1644
|
1637
|
"&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
|
1645
|
1638
|
"&dept=" + department.Name + "&fixmedins_code=" + miConfig.Code + "&dept_code=" + department.Number + "&doctor_id=" + doctor_id + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
@@ -1694,9 +1687,9 @@ func (c *HisApiController) GetRegisterInfo() {
|
1694
|
1687
|
diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
|
1695
|
1688
|
|
1696
|
1689
|
if err == nil {
|
1697
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
|
1690
|
+ api := "http://127.0.0.1:9531/" + "gdyb/four?psn_no=" + his.PsnNo +
|
1698
|
1691
|
"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
1699
|
|
- "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
|
1692
|
+ "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + "11" + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
1700
|
1693
|
"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
1701
|
1694
|
resp, requestErr := http.Get(api)
|
1702
|
1695
|
if requestErr != nil {
|
|
@@ -1781,7 +1774,9 @@ func (c *HisApiController) GetRegisterInfo() {
|
1781
|
1774
|
c.ServeSuccessJSON(map[string]interface{}{
|
1782
|
1775
|
"his_info": hisPatient,
|
1783
|
1776
|
})
|
|
1777
|
+
|
1784
|
1778
|
}
|
|
1779
|
+
|
1785
|
1780
|
}
|
1786
|
1781
|
|
1787
|
1782
|
//上传明细----结算
|
|
@@ -1833,9 +1828,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1833
|
1828
|
data["chrg_bchno"] = chrg_bchno
|
1834
|
1829
|
data["org_name"] = miConfig.OrgName
|
1835
|
1830
|
data["doctor"] = patientPrescription.Doctor
|
1836
|
|
- data["doctor_id"] = strconv.FormatInt(patientPrescription.DoctorId, 10)
|
1837
|
|
-
|
1838
|
|
- data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
|
|
1831
|
+ data["dept"] = patientPrescription.Departments
|
1839
|
1832
|
|
1840
|
1833
|
data["fixmedins_code"] = miConfig.Code
|
1841
|
1834
|
data["dept_code"] = department.Number
|
|
@@ -1843,21 +1836,6 @@ func (c *HisApiController) GetUploadInfo() {
|
1843
|
1836
|
data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
|
1844
|
1837
|
data["secret_key"] = miConfig.SecretKey
|
1845
|
1838
|
|
1846
|
|
- fmt.Println(his.PsnNo)
|
1847
|
|
- fmt.Println(his.Number)
|
1848
|
|
-
|
1849
|
|
- fmt.Println(miConfig.OrgName)
|
1850
|
|
-
|
1851
|
|
- fmt.Println(chrg_bchno)
|
1852
|
|
- fmt.Println(patientPrescription.Doctor)
|
1853
|
|
- fmt.Println(miConfig.Code)
|
1854
|
|
- fmt.Println(department.Number)
|
1855
|
|
- fmt.Println(strconv.FormatInt(patientPrescription.Departments, 10))
|
1856
|
|
-
|
1857
|
|
- fmt.Println(miConfig.InsuplcAdmdvs)
|
1858
|
|
- fmt.Println(miConfig.MdtrtareaAdmvs)
|
1859
|
|
- fmt.Println(miConfig.SecretKey)
|
1860
|
|
-
|
1861
|
1839
|
var ids []int64
|
1862
|
1840
|
//var idsTwo []int64
|
1863
|
1841
|
//
|
|
@@ -1869,7 +1847,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1869
|
1847
|
|
1870
|
1848
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
1871
|
1849
|
bytesData, _ := json.Marshal(data)
|
1872
|
|
- req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
|
|
1850
|
+ req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
|
1873
|
1851
|
resp, _ := client.Do(req)
|
1874
|
1852
|
defer resp.Body.Close()
|
1875
|
1853
|
body, ioErr := ioutil.ReadAll(resp.Body)
|
|
@@ -1920,7 +1898,6 @@ func (c *HisApiController) GetUploadInfo() {
|
1920
|
1898
|
FoundPrice: found_price,
|
1921
|
1899
|
MedicalInsurancePrice: medical_insurance_price,
|
1922
|
1900
|
PrivatePrice: private_price,
|
1923
|
|
- IsMedicineInsurance: 1,
|
1924
|
1901
|
}
|
1925
|
1902
|
err = service.CreateOrder(order)
|
1926
|
1903
|
if err != nil {
|
|
@@ -1995,7 +1972,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1995
|
1972
|
}
|
1996
|
1973
|
}
|
1997
|
1974
|
}
|
1998
|
|
- //org, _ := service.GetOrgById(adminUser.CurrentOrgId)
|
|
1975
|
+ org, _ := service.GetOrgById(adminUser.CurrentOrgId)
|
1999
|
1976
|
patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2000
|
1977
|
allTotal := fmt.Sprintf("%.2f", total)
|
2001
|
1978
|
if res.Infcode == 0 {
|
|
@@ -2006,9 +1983,9 @@ func (c *HisApiController) GetUploadInfo() {
|
2006
|
1983
|
chrg_bchno := chrg_bchno
|
2007
|
1984
|
cert_no := his.Certno
|
2008
|
1985
|
insutype := rf[0].Insutype
|
2009
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
|
|
1986
|
+ api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
|
2010
|
1987
|
insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
|
2011
|
|
- "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
1988
|
+ "&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2012
|
1989
|
resp, requestErr := http.Get(api)
|
2013
|
1990
|
|
2014
|
1991
|
if requestErr != nil {
|
|
@@ -2105,8 +2082,7 @@ func (c *HisApiController) GetUploadInfo() {
|
2105
|
2082
|
}
|
2106
|
2083
|
}
|
2107
|
2084
|
} else {
|
2108
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
|
2109
|
|
- return
|
|
2085
|
+
|
2110
|
2086
|
}
|
2111
|
2087
|
|
2112
|
2088
|
} else {
|
|
@@ -2278,108 +2254,11 @@ func (c *HisApiController) GetUploadInfo() {
|
2278
|
2254
|
func (c *HisApiController) Refund() {
|
2279
|
2255
|
order_id, _ := c.GetInt64("order_id")
|
2280
|
2256
|
number := c.GetString("number")
|
2281
|
|
- record_time := c.GetString("record_time")
|
2282
|
|
- patient_id, _ := c.GetInt64("patient_id")
|
2283
|
|
-
|
2284
|
|
- timeLayout := "2006-01-02"
|
2285
|
|
- loc, _ := time.LoadLocation("Local")
|
2286
|
2257
|
|
2287
|
2258
|
adminUser := c.GetAdminUserInfo()
|
2288
|
|
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
2289
|
|
- fmt.Println(err)
|
2290
|
|
- if err != nil {
|
2291
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2292
|
|
- return
|
2293
|
|
- }
|
2294
|
|
- recordDateTime := theTime.Unix()
|
2295
|
|
-
|
2296
|
|
- his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
2297
|
|
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
2298
|
|
- order, _ := service.GetHisOrderByID(order_id)
|
2299
|
|
-
|
2300
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2301
|
2259
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2302
|
2260
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
2303
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + his.PsnNo +
|
2304
|
|
- "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2305
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2306
|
|
- resp, requestErr := http.Get(api)
|
2307
|
|
- if requestErr != nil {
|
2308
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2309
|
|
- return
|
2310
|
|
- }
|
2311
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2312
|
|
- if ioErr != nil {
|
2313
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2314
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2315
|
|
- return
|
2316
|
|
- }
|
2317
|
|
- var respJSON map[string]interface{}
|
2318
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2319
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2320
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2321
|
|
- return
|
2322
|
|
- }
|
2323
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2324
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2325
|
|
- fmt.Println(respJSON)
|
2326
|
|
- fmt.Println(userJSONBytes)
|
2327
|
|
-
|
2328
|
|
- api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
|
2329
|
|
- "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2330
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2331
|
|
- resp2, requestErr2 := http.Get(api2)
|
2332
|
|
- if requestErr2 != nil {
|
2333
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2334
|
|
- return
|
2335
|
|
- }
|
2336
|
|
-
|
2337
|
|
- body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
2338
|
|
- if ioErr2 != nil {
|
2339
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
2340
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2341
|
|
- return
|
2342
|
|
- }
|
2343
|
|
- var respJSON2 map[string]interface{}
|
2344
|
|
- if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
2345
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2346
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2347
|
|
- return
|
2348
|
|
- }
|
2349
|
|
-
|
2350
|
|
- api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
|
2351
|
|
- "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2352
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2353
|
|
- resp3, requestErr3 := http.Get(api3)
|
2354
|
|
- if requestErr3 != nil {
|
2355
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2356
|
|
- return
|
2357
|
|
- }
|
2358
|
|
-
|
2359
|
|
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
|
2360
|
|
- if ioErr3 != nil {
|
2361
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
|
2362
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2363
|
|
- return
|
2364
|
|
- }
|
2365
|
|
- var respJSON3 map[string]interface{}
|
2366
|
|
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
|
2367
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2368
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2369
|
|
- return
|
2370
|
|
- }
|
2371
|
|
-
|
2372
|
|
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
2373
|
|
- service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
|
2374
|
2261
|
|
2375
|
|
- if err == nil {
|
2376
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2377
|
|
- "msg": "退费成功",
|
2378
|
|
- })
|
2379
|
|
- } else {
|
2380
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2381
|
|
- return
|
2382
|
|
- }
|
2383
|
2262
|
} else {
|
2384
|
2263
|
err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
2385
|
2264
|
if err == nil {
|
|
@@ -2390,462 +2269,7 @@ func (c *HisApiController) Refund() {
|
2390
|
2269
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2391
|
2270
|
return
|
2392
|
2271
|
}
|
2393
|
|
- }
|
2394
|
|
-}
|
2395
|
|
-
|
2396
|
|
-//对账
|
2397
|
|
-func (c *HisApiController) GetCheckAccount() {
|
2398
|
|
- start_time := c.GetString("start_time")
|
2399
|
|
- end_time := c.GetString("end_time")
|
2400
|
|
- insutype := c.GetString("insutype")
|
2401
|
|
- clr_type := c.GetString("clr_type")
|
2402
|
|
-
|
2403
|
|
- adminUser := c.GetAdminUserInfo()
|
2404
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2405
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2406
|
|
-
|
2407
|
|
- timeLayout := "2006-01-02"
|
2408
|
|
- loc, _ := time.LoadLocation("Local")
|
2409
|
|
- startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
2410
|
|
- endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
2411
|
|
- orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
|
2412
|
|
-
|
2413
|
|
- decimal.DivisionPrecision = 2
|
2414
|
|
- var medfee_sumamt float64
|
2415
|
|
- var acct_pay float64
|
2416
|
|
- var fund_pay_sumamt float64
|
2417
|
|
- fixmedins_setl_cnt := int64(len(orders))
|
2418
|
|
-
|
2419
|
|
- for _, item := range orders {
|
2420
|
|
- medfee_sumamt, _ = decimal.NewFromFloat(medfee_sumamt).Add(decimal.NewFromFloat(item.MedfeeSumamt)).Float64()
|
2421
|
|
- acct_pay, _ = decimal.NewFromFloat(acct_pay).Add(decimal.NewFromFloat(item.AcctPay)).Float64()
|
2422
|
|
- fund_pay_sumamt, _ = decimal.NewFromFloat(fund_pay_sumamt).Add(decimal.NewFromFloat(item.FundPaySumamt)).Float64()
|
2423
|
|
-
|
2424
|
|
- }
|
2425
|
|
-
|
2426
|
|
- var user_name string
|
2427
|
|
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
2428
|
|
- if role.ID == 0 {
|
2429
|
|
- user_name = "xxx"
|
2430
|
|
- } else {
|
2431
|
|
- user_name = role.UserName
|
2432
|
|
- }
|
2433
|
|
-
|
2434
|
|
- if config.IsOpen == 1 {
|
2435
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
|
2436
|
|
- "insutype=" + insutype +
|
2437
|
|
- "&clr_type=" + clr_type +
|
2438
|
|
- "&setl_optins=" + miConfig.OrgName +
|
2439
|
|
- "&stmt_begndate=" + start_time +
|
2440
|
|
- "&stm_enddate=" + end_time +
|
2441
|
|
- "&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
|
2442
|
|
- "&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
|
2443
|
|
- "&acct_pay=" + fmt.Sprintf("%.2f", acct_pay) +
|
2444
|
|
- "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
|
2445
|
|
- "&fixmedins_code=" + miConfig.Code +
|
2446
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
|
2447
|
|
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
|
2448
|
|
- "&secret_key=" + miConfig.SecretKey +
|
2449
|
|
- "&org_name=" + miConfig.OrgName +
|
2450
|
|
- "&doctor=" + user_name
|
2451
|
|
-
|
2452
|
|
- fmt.Println(api)
|
2453
|
|
- resp, requestErr := http.Get(api)
|
2454
|
|
- if requestErr != nil {
|
2455
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2456
|
|
- return
|
2457
|
|
- }
|
2458
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2459
|
|
- fmt.Println(body)
|
2460
|
|
- if ioErr != nil {
|
2461
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2462
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2463
|
|
- return
|
2464
|
|
- }
|
2465
|
|
- var respJSON map[string]interface{}
|
2466
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2467
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2468
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2469
|
|
- return
|
2470
|
|
- }
|
2471
|
|
-
|
2472
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2473
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2474
|
|
-
|
2475
|
|
- var res ResultEight
|
2476
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2477
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2478
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2479
|
|
- return
|
2480
|
|
- }
|
2481
|
|
- if res.Infcode == 0 {
|
2482
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2483
|
|
- "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
|
2484
|
|
- "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
|
2485
|
|
- })
|
2486
|
|
- } else {
|
2487
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2488
|
|
- }
|
2489
|
|
- }
|
2490
|
|
-}
|
2491
|
|
-
|
2492
|
|
-//对账明细
|
2493
|
|
-func (c *HisApiController) GetCheckDetailAccount() {
|
2494
|
|
- start_time := c.GetString("start_time")
|
2495
|
|
- end_time := c.GetString("end_time")
|
2496
|
|
-
|
2497
|
|
- adminUser := c.GetAdminUserInfo()
|
2498
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2499
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2500
|
|
-
|
2501
|
|
- timeLayout := "2006-01-02"
|
2502
|
|
- loc, _ := time.LoadLocation("Local")
|
2503
|
|
- startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
2504
|
|
- endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
2505
|
|
- orders, _ := service.GetOrderByTimeTwo(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId)
|
2506
|
|
-
|
2507
|
|
- Mkdir(miConfig.OrgName)
|
2508
|
|
- file := strconv.FormatInt(adminUser.CurrentOrgId, 10) + strconv.FormatInt(time.Now().Unix(), 10)
|
2509
|
|
- file_name := file + ".txt"
|
2510
|
|
- zip_name := file + ".zip"
|
2511
|
|
- zip_path := miConfig.OrgName + "/" + zip_name
|
2512
|
|
- file_path := miConfig.OrgName + "/" + file_name
|
2513
|
|
-
|
2514
|
|
- decimal.DivisionPrecision = 2
|
2515
|
|
- var medfee_sumamt float64
|
2516
|
|
- var psn_cash_pay float64
|
2517
|
|
- var fund_pay_sumamt float64
|
2518
|
|
- fixmedins_setl_cnt := int64(len(orders))
|
2519
|
|
-
|
2520
|
|
- for _, item := range orders {
|
2521
|
|
- medfee_sumamt, _ = decimal.NewFromFloat(medfee_sumamt).Add(decimal.NewFromFloat(item.MedfeeSumamt)).Float64()
|
2522
|
|
- psn_cash_pay, _ = decimal.NewFromFloat(psn_cash_pay).Add(decimal.NewFromFloat(item.PsnCashPay)).Float64()
|
2523
|
|
- fund_pay_sumamt, _ = decimal.NewFromFloat(fund_pay_sumamt).Add(decimal.NewFromFloat(item.FundPaySumamt)).Float64()
|
2524
|
|
- }
|
2525
|
|
-
|
2526
|
|
- f, err := os.Create(miConfig.OrgName + "/" + file_name)
|
2527
|
|
- defer f.Close()
|
2528
|
|
- if err != nil {
|
2529
|
|
- fmt.Println(err.Error())
|
2530
|
|
- } else {
|
2531
|
|
- for _, item := range orders {
|
2532
|
|
- var refd_setl_flag string
|
2533
|
|
- if item.OrderStatus == 2 {
|
2534
|
|
- refd_setl_flag = "0"
|
2535
|
|
- }
|
2536
|
|
- if item.OrderStatus == 3 {
|
2537
|
|
- refd_setl_flag = "1"
|
2538
|
|
- }
|
2539
|
|
- var str string
|
2540
|
|
- str = item.SetlId + " " +
|
2541
|
|
- item.MdtrtId + " " +
|
2542
|
|
- item.PsnNo + " " +
|
2543
|
|
- fmt.Sprintf("%.2f", item.MedfeeSumamt) + " " +
|
2544
|
|
- fmt.Sprintf("%.2f", item.FundPaySumamt) + " " +
|
2545
|
|
- fmt.Sprintf("%.2f", item.AcctPay) + " " + refd_setl_flag + "\n"
|
2546
|
|
- _, err = f.Write([]byte(str))
|
2547
|
|
- }
|
2548
|
|
-
|
2549
|
|
- }
|
2550
|
|
- Zip(file_path, zip_path)
|
2551
|
|
- fmt.Println(ReadFile(zip_path))
|
2552
|
|
- fmt.Println(string(ReadFile(zip_path)))
|
2553
|
|
-
|
2554
|
|
- if config.IsOpen == 1 {
|
2555
|
|
-
|
2556
|
|
- var user_name string
|
2557
|
|
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
2558
|
|
- if role.ID == 0 {
|
2559
|
|
- user_name = "xxx"
|
2560
|
|
- } else {
|
2561
|
|
- user_name = role.UserName
|
2562
|
|
- }
|
2563
|
|
-
|
2564
|
|
- baseParams := models.BaseParams{
|
2565
|
|
- SecretKey: miConfig.SecretKey,
|
2566
|
|
- FixmedinsCode: miConfig.Code,
|
2567
|
|
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
|
2568
|
|
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
|
2569
|
|
- OrgName: miConfig.OrgName,
|
2570
|
|
- Doctor: user_name,
|
2571
|
|
- }
|
2572
|
|
-
|
2573
|
|
- result := service.Gdyb9101(baseParams, zip_name, ReadFile(zip_path))
|
2574
|
|
-
|
2575
|
|
- var dat map[string]interface{}
|
2576
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
2577
|
|
- fmt.Println(dat)
|
2578
|
|
- } else {
|
2579
|
|
- fmt.Println(err)
|
2580
|
|
- }
|
2581
|
|
-
|
2582
|
|
- userJSONBytes, _ := json.Marshal(dat)
|
2583
|
|
-
|
2584
|
|
- var res ResultNine
|
2585
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2586
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2587
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2588
|
|
- return
|
2589
|
|
- }
|
2590
|
|
- if res.Infcode == 0 {
|
2591
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/twelve?" +
|
2592
|
|
- "file_qury_no=" + res.Output.FileQuryNo +
|
2593
|
|
- "&setl_optins=" + miConfig.OrgName +
|
2594
|
|
- "&stmt_begndate=" + start_time +
|
2595
|
|
- "&stm_enddate=" + end_time +
|
2596
|
|
- "&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
|
2597
|
|
- "&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
|
2598
|
|
- "&cash_payamt=" + fmt.Sprintf("%.2f", psn_cash_pay) +
|
2599
|
|
- "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
|
2600
|
|
- "&fixmedins_code=" + miConfig.Code +
|
2601
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
|
2602
|
|
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
|
2603
|
|
- "&secret_key=" + miConfig.SecretKey +
|
2604
|
|
- "&org_name=" + miConfig.OrgName +
|
2605
|
|
- "&doctor=" + user_name
|
2606
|
|
- resp, requestErr := http.Get(api)
|
2607
|
|
- if requestErr != nil {
|
2608
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2609
|
|
- return
|
2610
|
|
- }
|
2611
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2612
|
|
- if ioErr != nil {
|
2613
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2614
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2615
|
|
- return
|
2616
|
|
- }
|
2617
|
|
- var respJSON map[string]interface{}
|
2618
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2619
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2620
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2621
|
|
- return
|
2622
|
|
- }
|
2623
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2624
|
|
-
|
2625
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2626
|
|
- var res ResultTen
|
2627
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2628
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2629
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2630
|
|
- return
|
2631
|
|
- }
|
2632
|
2272
|
|
2633
|
|
- if res.Infcode == 0 {
|
2634
|
|
- service.Gdyb9102(baseParams, zip_name, res.Output.FileQuryNo)
|
2635
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2636
|
|
- "msg": "明细对账成功",
|
2637
|
|
- })
|
2638
|
|
- }
|
2639
|
|
-
|
2640
|
|
- } else {
|
2641
|
|
-
|
2642
|
|
- }
|
2643
|
|
- }
|
2644
|
|
-}
|
2645
|
|
-
|
2646
|
|
-func (c *HisApiController) GetSettleAccounts() {
|
2647
|
|
- //id, _ := c.GetInt64("id")
|
2648
|
|
- //record_time := c.GetString("record_time")
|
2649
|
|
- order_id, _ := c.GetInt64("order_id")
|
2650
|
|
-
|
2651
|
|
- //timeLayout := "2006-01-02"
|
2652
|
|
- //loc, _ := time.LoadLocation("Local")
|
2653
|
|
- //
|
2654
|
|
- //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
2655
|
|
- //if err != nil {
|
2656
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2657
|
|
- // return
|
2658
|
|
- //}
|
2659
|
|
- //recordDateTime := theTime.Unix()
|
2660
|
|
- adminUser := c.GetAdminUserInfo()
|
2661
|
|
- //his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2662
|
|
- order, _ := service.GetHisOrderByID(order_id)
|
2663
|
|
- orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
|
2664
|
|
-
|
2665
|
|
- var bedCostTotal float64 = 0 //床位总费
|
2666
|
|
- var bedCostSelfTotal float64 = 0 //床位自费
|
2667
|
|
- var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
|
2668
|
|
-
|
2669
|
|
- var operationCostTotal float64 = 0 //手术费
|
2670
|
|
- var operationCostSelfTotal float64 = 0 //手术费
|
2671
|
|
- var operationCostPartSelfTotal float64 = 0 //手术费
|
2672
|
|
-
|
2673
|
|
- var otherCostTotal float64 = 0 //其他费用
|
2674
|
|
- var otherCostSelfTotal float64 = 0 //其他费用
|
2675
|
|
- var otherCostPartSelfTotal float64 = 0 //其他费用
|
2676
|
|
-
|
2677
|
|
- var materialCostTotal float64 = 0 //材料费
|
2678
|
|
- var materialCostSelfTotal float64 = 0 //材料费
|
2679
|
|
- var materialCostPartSelfTotal float64 = 0 //材料费
|
2680
|
|
-
|
2681
|
|
- var westernMedicineCostTotal float64 = 0 //西药费
|
2682
|
|
- var westernMedicineCostSelfTotal float64 = 0 //西药费
|
2683
|
|
- var westernMedicineCostPartSelfTotal float64 = 0 //西药费
|
2684
|
|
-
|
2685
|
|
- var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
|
2686
|
|
- var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
|
2687
|
|
- var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
|
2688
|
|
-
|
2689
|
|
- var checkCostTotal float64 = 0 //检查费
|
2690
|
|
- var checkCostSelfTotal float64 = 0 //检查费
|
2691
|
|
- var checkCostPartSelfTotal float64 = 0 //检查费
|
2692
|
|
-
|
2693
|
|
- var laboratoryCostTotal float64 = 0 //化验费
|
2694
|
|
- var laboratoryCostSelfTotal float64 = 0 //化验费
|
2695
|
|
- var laboratoryCostPartSelfTotal float64 = 0 //化验费
|
2696
|
|
-
|
2697
|
|
- var treatCostTotal float64 = 0 //治疗费用
|
2698
|
|
- var treatCostSelfTotal float64 = 0 //治疗费用
|
2699
|
|
- var treatCostPartSelfTotal float64 = 0 //治疗费用
|
2700
|
|
-
|
2701
|
|
- decimal.DivisionPrecision = 2
|
2702
|
|
-
|
2703
|
|
- for _, item := range orderInfos {
|
2704
|
|
- if item.MedChrgitmType == "01" { //床位费
|
2705
|
|
-
|
2706
|
|
- bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2707
|
|
- bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2708
|
|
- bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2709
|
|
-
|
2710
|
|
- }
|
2711
|
|
-
|
2712
|
|
- if item.MedChrgitmType == "03" { //检查费
|
2713
|
|
-
|
2714
|
|
- checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2715
|
|
- checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2716
|
|
- checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2717
|
|
-
|
2718
|
|
- }
|
2719
|
|
-
|
2720
|
|
- if item.MedChrgitmType == "04" { //化验费
|
2721
|
|
-
|
2722
|
|
- laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2723
|
|
- laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2724
|
|
- laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2725
|
|
-
|
2726
|
|
- }
|
2727
|
|
-
|
2728
|
|
- if item.MedChrgitmType == "05" { //治疗费
|
2729
|
|
-
|
2730
|
|
- treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2731
|
|
- treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2732
|
|
- treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2733
|
|
-
|
2734
|
|
- }
|
2735
|
|
-
|
2736
|
|
- if item.MedChrgitmType == "06" { //手术费
|
2737
|
|
-
|
2738
|
|
- operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2739
|
|
- operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2740
|
|
- operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2741
|
|
-
|
2742
|
|
- }
|
2743
|
|
-
|
2744
|
|
- if item.MedChrgitmType == "08" { //材料费
|
2745
|
|
-
|
2746
|
|
- materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2747
|
|
- materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2748
|
|
- materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2749
|
|
-
|
2750
|
|
- }
|
2751
|
|
-
|
2752
|
|
- if item.MedChrgitmType == "09" { //西药费
|
2753
|
|
-
|
2754
|
|
- westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2755
|
|
- westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2756
|
|
- westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2757
|
|
-
|
2758
|
|
- }
|
2759
|
|
-
|
2760
|
|
- if item.MedChrgitmType == "11" { //中成费
|
2761
|
|
-
|
2762
|
|
- chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2763
|
|
- chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2764
|
|
- chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2765
|
|
-
|
2766
|
|
- }
|
2767
|
|
-
|
2768
|
|
- if item.MedChrgitmType == "14" { //其他费
|
2769
|
|
- otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
2770
|
|
- otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2771
|
|
- otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
2772
|
|
- }
|
2773
|
|
-
|
2774
|
|
- }
|
2775
|
|
-
|
2776
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2777
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2778
|
|
-
|
2779
|
|
- var user_name string
|
2780
|
|
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
2781
|
|
- if role.ID == 0 {
|
2782
|
|
- user_name = "xxx"
|
2783
|
|
- } else {
|
2784
|
|
- user_name = role.UserName
|
2785
|
|
- }
|
2786
|
|
-
|
2787
|
|
- baseParams := models.BaseParams{
|
2788
|
|
- SecretKey: miConfig.SecretKey,
|
2789
|
|
- FixmedinsCode: miConfig.Code,
|
2790
|
|
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
|
2791
|
|
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
|
2792
|
|
- OrgName: miConfig.OrgName,
|
2793
|
|
- Doctor: user_name,
|
2794
|
|
- }
|
2795
|
|
-
|
2796
|
|
- businessParams := models.BusinessParams{
|
2797
|
|
- PsnNo: order.PsnNo,
|
2798
|
|
- MdtrtId: order.MdtrtId,
|
2799
|
|
- SetlId: order.SetlId,
|
2800
|
|
- }
|
2801
|
|
-
|
2802
|
|
- if config.IsOpen == 1 {
|
2803
|
|
- result := service.Gdyb5203(baseParams, businessParams)
|
2804
|
|
- var dat map[string]interface{}
|
2805
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
2806
|
|
- fmt.Println(dat)
|
2807
|
|
- } else {
|
2808
|
|
- fmt.Println(err)
|
2809
|
|
- }
|
2810
|
|
- userJSONBytes, _ := json.Marshal(dat)
|
2811
|
|
- var res ResultEleven
|
2812
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2813
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2814
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2815
|
|
- return
|
2816
|
|
- }
|
2817
|
|
- if res.Infcode == 0 {
|
2818
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2819
|
|
- "info": res.Output.Setlinfo,
|
2820
|
|
- "bedCostTotal": bedCostTotal,
|
2821
|
|
- "bedCostSelfTotal": bedCostSelfTotal,
|
2822
|
|
- "bedCostPartSelfTotal": bedCostPartSelfTotal,
|
2823
|
|
- "operationCostTotal": operationCostTotal,
|
2824
|
|
- "operationCostSelfTotal": operationCostSelfTotal,
|
2825
|
|
- "operationCostPartSelfTotal": operationCostPartSelfTotal,
|
2826
|
|
- "otherCostTotal": otherCostTotal,
|
2827
|
|
- "otherCostSelfTotal": otherCostSelfTotal,
|
2828
|
|
- "otherCostPartSelfTotal": otherCostPartSelfTotal,
|
2829
|
|
- "materialCostTotal": materialCostTotal,
|
2830
|
|
- "materialCostSelfTotal": materialCostSelfTotal,
|
2831
|
|
- "materialCostPartSelfTotal": materialCostPartSelfTotal,
|
2832
|
|
- "westernMedicineCostTotal": westernMedicineCostTotal,
|
2833
|
|
- "westernMedicineCostSelfTotal": westernMedicineCostSelfTotal,
|
2834
|
|
- "westernMedicineCostPartSelfTotal": westernMedicineCostPartSelfTotal,
|
2835
|
|
- "chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
|
2836
|
|
- "chineseTraditionalMedicineCostSelfTotal": chineseTraditionalMedicineCostSelfTotal,
|
2837
|
|
- "chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
|
2838
|
|
- "checkCostTotal": checkCostTotal,
|
2839
|
|
- "checkCostSelfTotal": checkCostSelfTotal,
|
2840
|
|
- "checkCostPartSelfTotal": checkCostPartSelfTotal,
|
2841
|
|
- "laboratoryCostTotal": laboratoryCostTotal,
|
2842
|
|
- "laboratoryCostSelfTotal": laboratoryCostSelfTotal,
|
2843
|
|
- "laboratoryCostPartSelfTotal": laboratoryCostPartSelfTotal,
|
2844
|
|
- "treatCostTotal": treatCostTotal,
|
2845
|
|
- "treatCostSelfTotal": treatCostSelfTotal,
|
2846
|
|
- "treatCostPartSelfTotal": treatCostPartSelfTotal,
|
2847
|
|
- })
|
2848
|
|
- }
|
2849
|
2273
|
}
|
2850
|
2274
|
|
2851
|
2275
|
}
|
|
@@ -2984,100 +2408,3 @@ func (this *DialysisApiController) GetCallHisPrescription() {
|
2984
|
2408
|
return
|
2985
|
2409
|
}
|
2986
|
2410
|
}
|
2987
|
|
-
|
2988
|
|
-func PathExists(path string) (bool, error) {
|
2989
|
|
- _, err := os.Stat(path)
|
2990
|
|
- if err == nil {
|
2991
|
|
- return true, nil
|
2992
|
|
- }
|
2993
|
|
- if os.IsNotExist(err) {
|
2994
|
|
- return false, nil
|
2995
|
|
- }
|
2996
|
|
- return false, err
|
2997
|
|
-}
|
2998
|
|
-
|
2999
|
|
-//创建文件夹
|
3000
|
|
-func Mkdir(dir string) {
|
3001
|
|
- // 创建文件夹
|
3002
|
|
- exist, err := PathExists(dir)
|
3003
|
|
- if err != nil {
|
3004
|
|
- fmt.Println(err.Error())
|
3005
|
|
- } else {
|
3006
|
|
- if exist {
|
3007
|
|
- fmt.Println(dir + "文件夹已存在!")
|
3008
|
|
- } else {
|
3009
|
|
- // 文件夹名称,权限
|
3010
|
|
- err := os.Mkdir(dir, os.ModePerm)
|
3011
|
|
- if err != nil {
|
3012
|
|
- fmt.Println(dir+"文件夹创建失败:", err.Error())
|
3013
|
|
- } else {
|
3014
|
|
- fmt.Println(dir + "文件夹创建成功!")
|
3015
|
|
- }
|
3016
|
|
- }
|
3017
|
|
- }
|
3018
|
|
-}
|
3019
|
|
-
|
3020
|
|
-//压缩文件
|
3021
|
|
-func Zip(srcFile string, destZip string) error {
|
3022
|
|
- zipfile, err := os.Create(destZip)
|
3023
|
|
- if err != nil {
|
3024
|
|
- return err
|
3025
|
|
- }
|
3026
|
|
- defer zipfile.Close()
|
3027
|
|
-
|
3028
|
|
- archive := zip.NewWriter(zipfile)
|
3029
|
|
- defer archive.Close()
|
3030
|
|
-
|
3031
|
|
- filepath.Walk(srcFile, func(path string, info os.FileInfo, err error) error {
|
3032
|
|
- if err != nil {
|
3033
|
|
- return err
|
3034
|
|
- }
|
3035
|
|
-
|
3036
|
|
- header, err := zip.FileInfoHeader(info)
|
3037
|
|
- if err != nil {
|
3038
|
|
- return err
|
3039
|
|
- }
|
3040
|
|
-
|
3041
|
|
- header.Name = strings.TrimPrefix(path, filepath.Dir(srcFile)+"/")
|
3042
|
|
- // header.Name = path
|
3043
|
|
- if info.IsDir() {
|
3044
|
|
- header.Name += "/"
|
3045
|
|
- } else {
|
3046
|
|
- header.Method = zip.Deflate
|
3047
|
|
- }
|
3048
|
|
-
|
3049
|
|
- writer, err := archive.CreateHeader(header)
|
3050
|
|
- if err != nil {
|
3051
|
|
- return err
|
3052
|
|
- }
|
3053
|
|
-
|
3054
|
|
- if !info.IsDir() {
|
3055
|
|
- file, err := os.Open(path)
|
3056
|
|
- if err != nil {
|
3057
|
|
- return err
|
3058
|
|
- }
|
3059
|
|
- defer file.Close()
|
3060
|
|
- _, err = io.Copy(writer, file)
|
3061
|
|
- }
|
3062
|
|
- return err
|
3063
|
|
- })
|
3064
|
|
-
|
3065
|
|
- return err
|
3066
|
|
-}
|
3067
|
|
-
|
3068
|
|
-func ReadFile(filePath string) []byte {
|
3069
|
|
- f, err := os.Open(filePath)
|
3070
|
|
- if err != nil {
|
3071
|
|
- fmt.Println("read file fail", err)
|
3072
|
|
- return nil
|
3073
|
|
- }
|
3074
|
|
- defer f.Close()
|
3075
|
|
-
|
3076
|
|
- fd, err := ioutil.ReadAll(f)
|
3077
|
|
- if err != nil {
|
3078
|
|
- fmt.Println("read to fd fail", err)
|
3079
|
|
- return nil
|
3080
|
|
- }
|
3081
|
|
-
|
3082
|
|
- return fd
|
3083
|
|
-}
|