|
@@ -1494,20 +1494,13 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
|
1494
|
1494
|
if miConfig.MdtrtareaAdmvs == "150499" {
|
1495
|
1495
|
if id_card_type == 2 {
|
1496
|
1496
|
mdtrt_cert_no := ""
|
1497
|
|
- card_sn := ""
|
1498
|
1497
|
|
1499
|
|
- if record.IdCardType == 1 {
|
1500
|
|
- bas := strings.Split(psn_info.CardInfo, "|")
|
1501
|
|
- cardNumber := bas[2]
|
1502
|
|
- mdtrt_cert_no = cardNumber
|
1503
|
|
- card_sn = bas[3]
|
1504
|
|
- } else {
|
1505
|
|
- mdtrt_cert_no = id_card_no
|
1506
|
|
- }
|
|
1498
|
+ mdtrt_cert_no = id_card_no
|
|
1499
|
+
|
1507
|
1500
|
//请求内网数据
|
1508
|
1501
|
api := "http://172.16.13.254:9532/" + "nmyb/1101?cert_no=" + mdtrt_cert_no +
|
1509
|
1502
|
"&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
|
1510
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + card_sn + "&certificates=" + strconv.FormatInt(certificates, 10) + "&name=" + patient.Name
|
|
1503
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10) + "&name=" + patient.Name
|
1511
|
1504
|
resp, requestErr := http.Get(api)
|
1512
|
1505
|
if requestErr != nil {
|
1513
|
1506
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -1559,8 +1552,15 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
|
1559
|
1552
|
res2.Output.Baseinfo.Certno = patient.IdCardNo
|
1560
|
1553
|
}
|
1561
|
1554
|
} else if miConfig.MdtrtareaAdmvs == "360399" {
|
1562
|
|
- result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, "", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
|
1563
|
|
- saveLog(result_log, request_log, "1101", "人员基本信息获取")
|
|
1555
|
+ //res2.Infcode = 0
|
|
1556
|
+ //res2.Output.Baseinfo.PsnNo = psn_info.PsnNo
|
|
1557
|
+ //res2.Output.Baseinfo.Certno = patient.IdCardNo
|
|
1558
|
+ //result, request_log = service.JxybZY1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, ca, certificates, miConfig.Url, miConfig.AccessKey, "", patient.IdCardNo, "")
|
|
1559
|
+ bas := strings.Split(psn_info.CardInfo, "|")
|
|
1560
|
+ cardNumber := bas[3]
|
|
1561
|
+ result, request_log = service.Jxyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, cardNumber, "1", miConfig.Url, miConfig.AccessKey, "")
|
|
1562
|
+ saveLog(result, request_log, "1101", "人员基本信息获取")
|
|
1563
|
+
|
1564
|
1564
|
} else {
|
1565
|
1565
|
result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates, name)
|
1566
|
1566
|
saveLog(result_log, request_log, "1101", "人员基本信息获取")
|
|
@@ -1694,7 +1694,6 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
|
1694
|
1694
|
|
1695
|
1695
|
timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
1696
|
1696
|
var struct2401 service.Struct2401
|
1697
|
|
- struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
|
1698
|
1697
|
//insutype = "310"
|
1699
|
1698
|
struct2401.Insutype = insutype
|
1700
|
1699
|
psn_info, _ := service.GetPsnByPatientId(patient.ID)
|
|
@@ -1704,11 +1703,16 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
|
1704
|
1703
|
bas := strings.Split(psn_info.CardInfo, "|")
|
1705
|
1704
|
cardNumber := bas[2]
|
1706
|
1705
|
struct2401.MdtrtCertNo = cardNumber
|
|
1706
|
+ struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
|
|
1707
|
+ } else if id_card_type == 4 {
|
|
1708
|
+ struct2401.MdtrtCertType = "01"
|
|
1709
|
+ struct2401.MdtrtCertNo = psn_info.VerifyNumber
|
|
1710
|
+ struct2401.PsnNo = psn_info.PsnNo
|
1707
|
1711
|
} else {
|
1708
|
1712
|
struct2401.MdtrtCertType = "02"
|
1709
|
|
- struct2401.MdtrtCertNo = res2.Output.Baseinfo.Certno
|
|
1713
|
+ struct2401.MdtrtCertNo = id_card_no
|
|
1714
|
+ struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
|
1710
|
1715
|
}
|
1711
|
|
-
|
1712
|
1716
|
if miConfig.Code == "H15049901371" {
|
1713
|
1717
|
if med_type == 14 {
|
1714
|
1718
|
if insutype == "390" {
|
|
@@ -1724,8 +1728,8 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
|
1724
|
1728
|
}
|
1725
|
1729
|
} else {
|
1726
|
1730
|
if med_type == 11 {
|
1727
|
|
- struct2401.MedType = "24"
|
1728
|
|
- med_type = 24
|
|
1731
|
+ struct2401.MedType = "21"
|
|
1732
|
+ med_type = 21
|
1729
|
1733
|
} else {
|
1730
|
1734
|
struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
|
1731
|
1735
|
}
|
|
@@ -1750,7 +1754,12 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
|
1750
|
1754
|
for index, item := range diagnosisConfig {
|
1751
|
1755
|
var dise service.DiseinfoStruct
|
1752
|
1756
|
|
1753
|
|
- dise.PsnNo = res2.Output.Baseinfo.PsnNo
|
|
1757
|
+ if id_card_type == 4 || id_card_type == 1 {
|
|
1758
|
+ dise.PsnNo = psn_info.PsnNo
|
|
1759
|
+ } else {
|
|
1760
|
+ dise.PsnNo = res2.Output.Baseinfo.PsnNo
|
|
1761
|
+
|
|
1762
|
+ }
|
1754
|
1763
|
dise.DiagType = "1"
|
1755
|
1764
|
if index == 0 {
|
1756
|
1765
|
dise.MaindiagFlag = "1"
|
|
@@ -2668,6 +2677,9 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
|
2668
|
2677
|
cardNumber := bas[2]
|
2669
|
2678
|
cert_no = cardNumber
|
2670
|
2679
|
|
|
2680
|
+ } else if record.IdCardType == 4 {
|
|
2681
|
+ cert_no = psn_info.VerifyNumber
|
|
2682
|
+
|
2671
|
2683
|
} else {
|
2672
|
2684
|
cert_no = record.Certno
|
2673
|
2685
|
}
|
|
@@ -2722,48 +2734,104 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
|
2722
|
2734
|
var res2 ResultSevenTwo
|
2723
|
2735
|
var res ResultSeven
|
2724
|
2736
|
var resSeven10265 ResultSeven10265
|
2725
|
|
- if miConfig.Code == "H15049901371" {
|
2726
|
|
- if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
|
|
2737
|
+
|
|
2738
|
+ if miConfig.MdtrtareaAdmvs == "360399" {
|
|
2739
|
+ if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
2727
|
2740
|
utils.ErrorLog("解析失败:%v", err)
|
2728
|
2741
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2729
|
2742
|
return
|
2730
|
2743
|
}
|
2731
|
|
- Infcode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
|
2732
|
|
- res.Infcode = Infcode
|
2733
|
|
- res.InfRefmsgid = resSeven10265.InfRefmsgid
|
2734
|
|
- res.RespondTime = resSeven10265.RespondTime
|
2735
|
|
- res.ErrMsg = resSeven10265.ErrMsg
|
2736
|
|
- res.Output = resSeven10265.Output
|
2737
|
|
- res.WarnMsg = resSeven10265.WarnMsg
|
2738
|
|
- res.Cainfo = resSeven10265.Cainfo
|
2739
|
2744
|
|
2740
|
|
- } else {
|
2741
|
|
- if miConfig.MdtrtareaAdmvs == "360399" {
|
2742
|
|
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
2743
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2744
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2745
|
|
- return
|
|
2745
|
+ if res2.Infcode != 0 {
|
|
2746
|
+ errlog := &models.HisOrderError{
|
|
2747
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2748
|
+ Ctime: time.Now().Unix(),
|
|
2749
|
+ Mtime: time.Now().Unix(),
|
|
2750
|
+ Number: chrg_bchno,
|
|
2751
|
+ ErrMsg: res.ErrMsg,
|
|
2752
|
+ Status: 1,
|
|
2753
|
+ PatientId: patient_id,
|
|
2754
|
+ RecordTime: time.Now().Unix(),
|
|
2755
|
+ Stage: 6,
|
2746
|
2756
|
}
|
|
2757
|
+ service.CreateErrMsgLog(errlog)
|
|
2758
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2759
|
+ "failed_code": -10,
|
|
2760
|
+ "msg": res.ErrMsg,
|
|
2761
|
+ })
|
|
2762
|
+ return
|
|
2763
|
+ } else {
|
|
2764
|
+ //order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
|
2765
|
+ order.OrderStatus = 1
|
|
2766
|
+ order.MdtrtId = res2.Output.Setlinfo.MdtrtID
|
|
2767
|
+ order.SetlId = res2.Output.Setlinfo.SetlID
|
|
2768
|
+ order.PsnNo = res2.Output.Setlinfo.PsnNo
|
|
2769
|
+ order.PsnName = res2.Output.Setlinfo.PsnName
|
|
2770
|
+ order.PsnCertType = res2.Output.Setlinfo.PsnCertType
|
|
2771
|
+ order.Certno = res2.Output.Setlinfo.Certno
|
|
2772
|
+ order.Gend = res2.Output.Setlinfo.Gend
|
|
2773
|
+ order.Naty = res2.Output.Setlinfo.Naty
|
|
2774
|
+ val, _ := strconv.ParseFloat(res2.Output.Setlinfo.Age, 64)
|
|
2775
|
+ order.Age = val
|
|
2776
|
+ order.Insutype = res2.Output.Setlinfo.Insutype
|
|
2777
|
+ order.PsnType = res2.Output.Setlinfo.PsnType
|
|
2778
|
+ order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
|
|
2779
|
+ order.SetlTime = res2.Output.Setlinfo.SetlTime
|
|
2780
|
+ order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
|
|
2781
|
+ if res.Output.Setlinfo.MedType == "140104" {
|
|
2782
|
+
|
|
2783
|
+ order.MedType = "14"
|
2747
|
2784
|
|
2748
|
|
- if res2.Infcode != 0 {
|
2749
|
|
- errlog := &models.HisOrderError{
|
2750
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2751
|
|
- Ctime: time.Now().Unix(),
|
2752
|
|
- Mtime: time.Now().Unix(),
|
2753
|
|
- Number: chrg_bchno,
|
2754
|
|
- ErrMsg: res.ErrMsg,
|
2755
|
|
- Status: 1,
|
2756
|
|
- PatientId: patient_id,
|
2757
|
|
- RecordTime: time.Now().Unix(),
|
2758
|
|
- Stage: 6,
|
2759
|
|
- }
|
2760
|
|
- service.CreateErrMsgLog(errlog)
|
2761
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2762
|
|
- "failed_code": -10,
|
2763
|
|
- "msg": res.ErrMsg,
|
2764
|
|
- })
|
2765
|
|
- return
|
2766
|
2785
|
} else {
|
|
2786
|
+
|
|
2787
|
+ order.MedType = res2.Output.Setlinfo.MedType
|
|
2788
|
+
|
|
2789
|
+ }
|
|
2790
|
+ order.MedfeeSumamt = res2.Output.Setlinfo.MedfeeSumamt
|
|
2791
|
+ order.FulamtOwnpayAmt = res2.Output.Setlinfo.FulamtOwnpayAmt
|
|
2792
|
+ order.OverlmtSelfPay = res2.Output.Setlinfo.OverlmtSelfpay
|
|
2793
|
+ order.PreselfpayAmt = res2.Output.Setlinfo.PreselfpayAmt
|
|
2794
|
+ order.InscpScpAmt = res2.Output.Setlinfo.InscpScpAmt
|
|
2795
|
+ order.ActPayDedc = res2.Output.Setlinfo.ActPayDedc
|
|
2796
|
+ order.HifmiPay = res2.Output.Setlinfo.HifmiPay
|
|
2797
|
+ order.HifpPay = res2.Output.Setlinfo.HifpPay
|
|
2798
|
+ order.HifesPay = res2.Output.Setlinfo.HifesPay
|
|
2799
|
+ order.HifobPay = res2.Output.Setlinfo.HifobPay
|
|
2800
|
+ order.MafPay = res2.Output.Setlinfo.MafPay
|
|
2801
|
+ order.OthPay = res2.Output.Setlinfo.OthPay
|
|
2802
|
+ order.CvlservPay = res2.Output.Setlinfo.CvlservPay
|
|
2803
|
+ order.PoolPropSelfpay = res2.Output.Setlinfo.PoolPropSelfpay
|
|
2804
|
+ order.FundPaySumamt = res2.Output.Setlinfo.FundPaySumamt
|
|
2805
|
+ order.PsnPartAmt = res2.Output.Setlinfo.PsnPartAmt
|
|
2806
|
+ order.AcctPay = res2.Output.Setlinfo.AcctPay
|
|
2807
|
+ order.PsnCashPay = res2.Output.Setlinfo.PsnCashPay
|
|
2808
|
+ order.HospPartAmt = res2.Output.Setlinfo.HospPartAmt
|
|
2809
|
+ order.Balc = res2.Output.Setlinfo.Balc
|
|
2810
|
+ order.AcctMulaidPay = res2.Output.Setlinfo.AcctMulaidPay
|
|
2811
|
+ order.MedinsSetlId = res2.Output.Setlinfo.MedinsSetlID
|
|
2812
|
+ order.ClrOptins = res2.Output.Setlinfo.ClrOptins
|
|
2813
|
+ order.ClrWay = res2.Output.Setlinfo.ClrWay
|
|
2814
|
+ order.Creator = order.Creator
|
|
2815
|
+ order.Modify = roles.AdminUserId
|
|
2816
|
+ order.RequestLog = src_resquest
|
|
2817
|
+ setlDetail, _ := json.Marshal(res2.Output.Setldetail)
|
|
2818
|
+ detailStr := string(setlDetail)
|
|
2819
|
+ order.SetlDetail = detailStr
|
|
2820
|
+ //err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
|
|
2821
|
+ if record.OutHospitalStatus == 1 && order.ID > 0 {
|
|
2822
|
+ err := service.UpDateOrder(order)
|
|
2823
|
+ if err == nil {
|
|
2824
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2825
|
+ "msg": "预结算成功",
|
|
2826
|
+ "order_way": 1,
|
|
2827
|
+ })
|
|
2828
|
+ } else {
|
|
2829
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
|
2830
|
+ return
|
|
2831
|
+ }
|
|
2832
|
+ } else if record.OutHospitalStatus == 0 && order.ID == 0 {
|
|
2833
|
+
|
|
2834
|
+ var order models.HisOrder
|
2767
|
2835
|
//order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
2768
|
2836
|
order.OrderStatus = 1
|
2769
|
2837
|
order.MdtrtId = res2.Output.Setlinfo.MdtrtID
|
|
@@ -2781,7 +2849,7 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
|
2781
|
2849
|
order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
|
2782
|
2850
|
order.SetlTime = res2.Output.Setlinfo.SetlTime
|
2783
|
2851
|
order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
|
2784
|
|
- if res.Output.Setlinfo.MedType == "140104" {
|
|
2852
|
+ if res2.Output.Setlinfo.MedType == "140104" {
|
2785
|
2853
|
|
2786
|
2854
|
order.MedType = "14"
|
2787
|
2855
|
|
|
@@ -2820,184 +2888,129 @@ func (c *ZHHisApiController) GetPreSettleInfo() {
|
2820
|
2888
|
setlDetail, _ := json.Marshal(res2.Output.Setldetail)
|
2821
|
2889
|
detailStr := string(setlDetail)
|
2822
|
2890
|
order.SetlDetail = detailStr
|
2823
|
|
- //err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
|
2824
|
|
- if record.OutHospitalStatus == 1 && order.ID > 0 {
|
2825
|
|
- err := service.UpDateOrder(order)
|
2826
|
|
- if err == nil {
|
2827
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2828
|
|
- "msg": "预结算成功",
|
2829
|
|
- "order_way": 1,
|
2830
|
|
- })
|
2831
|
|
- } else {
|
2832
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
2833
|
|
- return
|
2834
|
|
- }
|
2835
|
|
- } else if record.OutHospitalStatus == 0 && order.ID == 0 {
|
2836
|
|
-
|
2837
|
|
- var order models.HisOrder
|
2838
|
|
- //order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
2839
|
|
- order.OrderStatus = 1
|
2840
|
|
- order.MdtrtId = res2.Output.Setlinfo.MdtrtID
|
2841
|
|
- order.SetlId = res2.Output.Setlinfo.SetlID
|
2842
|
|
- order.PsnNo = res2.Output.Setlinfo.PsnNo
|
2843
|
|
- order.PsnName = res2.Output.Setlinfo.PsnName
|
2844
|
|
- order.PsnCertType = res2.Output.Setlinfo.PsnCertType
|
2845
|
|
- order.Certno = res2.Output.Setlinfo.Certno
|
2846
|
|
- order.Gend = res2.Output.Setlinfo.Gend
|
2847
|
|
- order.Naty = res2.Output.Setlinfo.Naty
|
2848
|
|
- val, _ := strconv.ParseFloat(res2.Output.Setlinfo.Age, 64)
|
2849
|
|
- order.Age = val
|
2850
|
|
- order.Insutype = res2.Output.Setlinfo.Insutype
|
2851
|
|
- order.PsnType = res2.Output.Setlinfo.PsnType
|
2852
|
|
- order.CvlservFlag = res2.Output.Setlinfo.CvlservFlag
|
2853
|
|
- order.SetlTime = res2.Output.Setlinfo.SetlTime
|
2854
|
|
- order.MdtrtCertType = res2.Output.Setlinfo.MdtrtCertType
|
2855
|
|
- if res2.Output.Setlinfo.MedType == "140104" {
|
2856
|
|
-
|
2857
|
|
- order.MedType = "14"
|
2858
|
2891
|
|
2859
|
|
- } else {
|
2860
|
|
-
|
2861
|
|
- order.MedType = res2.Output.Setlinfo.MedType
|
2862
|
|
-
|
2863
|
|
- }
|
2864
|
|
- order.MedfeeSumamt = res2.Output.Setlinfo.MedfeeSumamt
|
2865
|
|
- order.FulamtOwnpayAmt = res2.Output.Setlinfo.FulamtOwnpayAmt
|
2866
|
|
- order.OverlmtSelfPay = res2.Output.Setlinfo.OverlmtSelfpay
|
2867
|
|
- order.PreselfpayAmt = res2.Output.Setlinfo.PreselfpayAmt
|
2868
|
|
- order.InscpScpAmt = res2.Output.Setlinfo.InscpScpAmt
|
2869
|
|
- order.ActPayDedc = res2.Output.Setlinfo.ActPayDedc
|
2870
|
|
- order.HifmiPay = res2.Output.Setlinfo.HifmiPay
|
2871
|
|
- order.HifpPay = res2.Output.Setlinfo.HifpPay
|
2872
|
|
- order.HifesPay = res2.Output.Setlinfo.HifesPay
|
2873
|
|
- order.HifobPay = res2.Output.Setlinfo.HifobPay
|
2874
|
|
- order.MafPay = res2.Output.Setlinfo.MafPay
|
2875
|
|
- order.OthPay = res2.Output.Setlinfo.OthPay
|
2876
|
|
- order.CvlservPay = res2.Output.Setlinfo.CvlservPay
|
2877
|
|
- order.PoolPropSelfpay = res2.Output.Setlinfo.PoolPropSelfpay
|
2878
|
|
- order.FundPaySumamt = res2.Output.Setlinfo.FundPaySumamt
|
2879
|
|
- order.PsnPartAmt = res2.Output.Setlinfo.PsnPartAmt
|
2880
|
|
- order.AcctPay = res2.Output.Setlinfo.AcctPay
|
2881
|
|
- order.PsnCashPay = res2.Output.Setlinfo.PsnCashPay
|
2882
|
|
- order.HospPartAmt = res2.Output.Setlinfo.HospPartAmt
|
2883
|
|
- order.Balc = res2.Output.Setlinfo.Balc
|
2884
|
|
- order.AcctMulaidPay = res2.Output.Setlinfo.AcctMulaidPay
|
2885
|
|
- order.MedinsSetlId = res2.Output.Setlinfo.MedinsSetlID
|
2886
|
|
- order.ClrOptins = res2.Output.Setlinfo.ClrOptins
|
2887
|
|
- order.ClrWay = res2.Output.Setlinfo.ClrWay
|
2888
|
|
- order.Creator = order.Creator
|
2889
|
|
- order.Modify = roles.AdminUserId
|
2890
|
|
- order.RequestLog = src_resquest
|
2891
|
|
- setlDetail, _ := json.Marshal(res2.Output.Setldetail)
|
2892
|
|
- detailStr := string(setlDetail)
|
2893
|
|
- order.SetlDetail = detailStr
|
2894
|
|
-
|
2895
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2896
|
|
- "msg": "预结算成功",
|
2897
|
|
- "order": order,
|
2898
|
|
- "order_way": 2,
|
2899
|
|
- })
|
2900
|
|
- }
|
|
2892
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2893
|
+ "msg": "预结算成功",
|
|
2894
|
+ "order": order,
|
|
2895
|
+ "order_way": 2,
|
|
2896
|
+ })
|
|
2897
|
+ }
|
|
2898
|
+ }
|
|
2899
|
+ } else {
|
|
2900
|
+ if miConfig.Code == "H15049901371" {
|
|
2901
|
+ if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
|
|
2902
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2903
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2904
|
+ return
|
2901
|
2905
|
}
|
|
2906
|
+ Infcode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
|
|
2907
|
+ res.Infcode = Infcode
|
|
2908
|
+ res.InfRefmsgid = resSeven10265.InfRefmsgid
|
|
2909
|
+ res.RespondTime = resSeven10265.RespondTime
|
|
2910
|
+ res.ErrMsg = resSeven10265.ErrMsg
|
|
2911
|
+ res.Output = resSeven10265.Output
|
|
2912
|
+ res.WarnMsg = resSeven10265.WarnMsg
|
|
2913
|
+ res.Cainfo = resSeven10265.Cainfo
|
|
2914
|
+
|
2902
|
2915
|
} else {
|
2903
|
2916
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2904
|
2917
|
utils.ErrorLog("解析失败:%v", err)
|
2905
|
2918
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2906
|
2919
|
return
|
2907
|
2920
|
}
|
2908
|
|
- if res.Infcode != 0 {
|
2909
|
|
- errlog := &models.HisOrderError{
|
2910
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2911
|
|
- Ctime: time.Now().Unix(),
|
2912
|
|
- Mtime: time.Now().Unix(),
|
2913
|
|
- Number: chrg_bchno,
|
2914
|
|
- ErrMsg: res.ErrMsg,
|
2915
|
|
- Status: 1,
|
2916
|
|
- PatientId: patient_id,
|
2917
|
|
- RecordTime: time.Now().Unix(),
|
2918
|
|
- Stage: 6,
|
2919
|
|
- }
|
2920
|
|
- service.CreateErrMsgLog(errlog)
|
2921
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2922
|
|
- "failed_code": -10,
|
2923
|
|
- "msg": res.ErrMsg,
|
2924
|
|
- })
|
2925
|
|
- return
|
2926
|
|
- } else {
|
2927
|
|
- //order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
2928
|
|
- order.OrderStatus = 1
|
2929
|
|
- order.MdtrtId = res.Output.Setlinfo.MdtrtID
|
2930
|
|
- order.SetlId = res.Output.Setlinfo.SetlID
|
2931
|
|
- order.PsnNo = res.Output.Setlinfo.PsnNo
|
2932
|
|
- order.PsnName = res.Output.Setlinfo.PsnName
|
2933
|
|
- order.PsnCertType = res.Output.Setlinfo.PsnCertType
|
2934
|
|
- order.Certno = res.Output.Setlinfo.Certno
|
2935
|
|
- order.Gend = res.Output.Setlinfo.Gend
|
2936
|
|
- order.Naty = res.Output.Setlinfo.Naty
|
2937
|
|
- order.Age = res.Output.Setlinfo.Age
|
2938
|
|
- order.Insutype = res.Output.Setlinfo.Insutype
|
2939
|
|
- order.PsnType = res.Output.Setlinfo.PsnType
|
2940
|
|
- order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
|
2941
|
|
- order.SetlTime = res.Output.Setlinfo.SetlTime
|
2942
|
|
- order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
|
2943
|
|
- if res.Output.Setlinfo.MedType == "140104" {
|
2944
|
|
-
|
2945
|
|
- order.MedType = "14"
|
|
2921
|
+ }
|
|
2922
|
+ if res.Infcode != 0 {
|
|
2923
|
+ errlog := &models.HisOrderError{
|
|
2924
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2925
|
+ Ctime: time.Now().Unix(),
|
|
2926
|
+ Mtime: time.Now().Unix(),
|
|
2927
|
+ Number: chrg_bchno,
|
|
2928
|
+ ErrMsg: res.ErrMsg,
|
|
2929
|
+ Status: 1,
|
|
2930
|
+ PatientId: patient_id,
|
|
2931
|
+ RecordTime: time.Now().Unix(),
|
|
2932
|
+ Stage: 6,
|
|
2933
|
+ }
|
|
2934
|
+ service.CreateErrMsgLog(errlog)
|
|
2935
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2936
|
+ "failed_code": -10,
|
|
2937
|
+ "msg": res.ErrMsg,
|
|
2938
|
+ })
|
|
2939
|
+ return
|
|
2940
|
+ } else {
|
|
2941
|
+ //order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
|
2942
|
+ order.OrderStatus = 1
|
|
2943
|
+ order.MdtrtId = res.Output.Setlinfo.MdtrtID
|
|
2944
|
+ order.SetlId = res.Output.Setlinfo.SetlID
|
|
2945
|
+ order.PsnNo = res.Output.Setlinfo.PsnNo
|
|
2946
|
+ order.PsnName = res.Output.Setlinfo.PsnName
|
|
2947
|
+ order.PsnCertType = res.Output.Setlinfo.PsnCertType
|
|
2948
|
+ order.Certno = res.Output.Setlinfo.Certno
|
|
2949
|
+ order.Gend = res.Output.Setlinfo.Gend
|
|
2950
|
+ order.Naty = res.Output.Setlinfo.Naty
|
|
2951
|
+ order.Age = res.Output.Setlinfo.Age
|
|
2952
|
+ order.Insutype = res.Output.Setlinfo.Insutype
|
|
2953
|
+ order.PsnType = res.Output.Setlinfo.PsnType
|
|
2954
|
+ order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
|
|
2955
|
+ order.SetlTime = res.Output.Setlinfo.SetlTime
|
|
2956
|
+ order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
|
|
2957
|
+ if res.Output.Setlinfo.MedType == "140104" {
|
|
2958
|
+
|
|
2959
|
+ order.MedType = "14"
|
2946
|
2960
|
|
2947
|
|
- } else {
|
|
2961
|
+ } else {
|
2948
|
2962
|
|
2949
|
|
- order.MedType = res.Output.Setlinfo.MedType
|
|
2963
|
+ order.MedType = res.Output.Setlinfo.MedType
|
2950
|
2964
|
|
2951
|
|
- }
|
2952
|
|
- order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
|
2953
|
|
- order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
|
2954
|
|
- order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
|
2955
|
|
- order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
|
2956
|
|
- order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
|
2957
|
|
- order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
|
2958
|
|
- order.HifmiPay = res.Output.Setlinfo.HifmiPay
|
2959
|
|
- order.HifpPay = res.Output.Setlinfo.HifpPay
|
2960
|
|
- order.HifesPay = res.Output.Setlinfo.HifesPay
|
2961
|
|
- order.HifobPay = res.Output.Setlinfo.HifobPay
|
2962
|
|
- order.MafPay = res.Output.Setlinfo.MafPay
|
2963
|
|
- order.OthPay = res.Output.Setlinfo.OthPay
|
2964
|
|
- order.CvlservPay = res.Output.Setlinfo.CvlservPay
|
2965
|
|
- order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
|
2966
|
|
- order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
|
2967
|
|
- order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
|
2968
|
|
- order.AcctPay = res.Output.Setlinfo.AcctPay
|
2969
|
|
- order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
|
2970
|
|
- order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
|
2971
|
|
- order.Balc = res.Output.Setlinfo.Balc
|
2972
|
|
- order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
|
2973
|
|
- order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
|
2974
|
|
- order.ClrOptins = res.Output.Setlinfo.ClrOptins
|
2975
|
|
- order.ClrWay = res.Output.Setlinfo.ClrWay
|
2976
|
|
- order.Creator = order.Creator
|
2977
|
|
- order.Modify = roles.AdminUserId
|
2978
|
|
- order.RequestLog = src_resquest
|
2979
|
|
- setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
2980
|
|
- detailStr := string(setlDetail)
|
2981
|
|
- order.SetlDetail = detailStr
|
2982
|
|
- //err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
|
2983
|
|
- if record.OutHospitalStatus == 1 && order.ID > 0 {
|
2984
|
|
- err := service.UpDateOrder(order)
|
2985
|
|
- if err == nil {
|
2986
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2987
|
|
- "msg": "预结算成功",
|
2988
|
|
- "order_way": 1,
|
2989
|
|
- })
|
2990
|
|
- } else {
|
2991
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
2992
|
|
- return
|
2993
|
|
- }
|
2994
|
|
- } else if record.OutHospitalStatus == 0 && order.ID == 0 {
|
|
2965
|
+ }
|
|
2966
|
+ order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
|
|
2967
|
+ order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
|
|
2968
|
+ order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
|
|
2969
|
+ order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
|
|
2970
|
+ order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
|
|
2971
|
+ order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
|
|
2972
|
+ order.HifmiPay = res.Output.Setlinfo.HifmiPay
|
|
2973
|
+ order.HifpPay = res.Output.Setlinfo.HifpPay
|
|
2974
|
+ order.HifesPay = res.Output.Setlinfo.HifesPay
|
|
2975
|
+ order.HifobPay = res.Output.Setlinfo.HifobPay
|
|
2976
|
+ order.MafPay = res.Output.Setlinfo.MafPay
|
|
2977
|
+ order.OthPay = res.Output.Setlinfo.OthPay
|
|
2978
|
+ order.CvlservPay = res.Output.Setlinfo.CvlservPay
|
|
2979
|
+ order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
|
|
2980
|
+ order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
|
|
2981
|
+ order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
|
|
2982
|
+ order.AcctPay = res.Output.Setlinfo.AcctPay
|
|
2983
|
+ order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
|
|
2984
|
+ order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
|
|
2985
|
+ order.Balc = res.Output.Setlinfo.Balc
|
|
2986
|
+ order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
|
|
2987
|
+ order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
|
|
2988
|
+ order.ClrOptins = res.Output.Setlinfo.ClrOptins
|
|
2989
|
+ order.ClrWay = res.Output.Setlinfo.ClrWay
|
|
2990
|
+ order.Creator = order.Creator
|
|
2991
|
+ order.Modify = roles.AdminUserId
|
|
2992
|
+ order.RequestLog = src_resquest
|
|
2993
|
+ setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
|
2994
|
+ detailStr := string(setlDetail)
|
|
2995
|
+ order.SetlDetail = detailStr
|
|
2996
|
+ //err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
|
|
2997
|
+ if record.OutHospitalStatus == 1 && order.ID > 0 {
|
|
2998
|
+ err := service.UpDateOrder(order)
|
|
2999
|
+ if err == nil {
|
2995
|
3000
|
c.ServeSuccessJSON(map[string]interface{}{
|
2996
|
3001
|
"msg": "预结算成功",
|
2997
|
|
- "order": order,
|
2998
|
|
- "order_way": 2,
|
|
3002
|
+ "order_way": 1,
|
2999
|
3003
|
})
|
|
3004
|
+ } else {
|
|
3005
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
|
3006
|
+ return
|
3000
|
3007
|
}
|
|
3008
|
+ } else if record.OutHospitalStatus == 0 && order.ID == 0 {
|
|
3009
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
3010
|
+ "msg": "预结算成功",
|
|
3011
|
+ "order": order,
|
|
3012
|
+ "order_way": 2,
|
|
3013
|
+ })
|
3001
|
3014
|
}
|
3002
|
3015
|
}
|
3003
|
3016
|
}
|
|
@@ -4282,9 +4295,49 @@ type ELeData struct {
|
4282
|
4295
|
|
4283
|
4296
|
var initFlagTwo int64 = 0
|
4284
|
4297
|
|
|
4298
|
+func (c *ZHHisApiController) TestGetJiangXiBasBaseInit() {
|
|
4299
|
+ DllDef := syscall.MustLoadDLL("SSCard.dll")
|
|
4300
|
+ Iinit := DllDef.MustFindProc("Init")
|
|
4301
|
+ //miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
|
4302
|
+ //http://10.77.211.236/CSB/hsa-fsi-1303
|
|
4303
|
+ ret, _, err := Iinit.Call(StrPtr("http://10.77.224.18:9001/1.0.0/agent-card-init"), StrPtr("360399"))
|
|
4304
|
+ if ret != 0 {
|
|
4305
|
+ fmt.Println("SSCard的报错原因:", err)
|
|
4306
|
+ fmt.Println("SSCard的运算结果为:", ret)
|
|
4307
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
4308
|
+ return
|
|
4309
|
+ }
|
|
4310
|
+
|
|
4311
|
+ result := int(ret)
|
|
4312
|
+ fmt.Println("SSCard的运算结果为1:", result)
|
|
4313
|
+ initFlag = 1
|
|
4314
|
+ return
|
|
4315
|
+}
|
|
4316
|
+func (c *ZHHisApiController) GetBasBaseInfoxxx() string {
|
|
4317
|
+ DllDef := syscall.MustLoadDLL("SSCard.dll")
|
|
4318
|
+ readCard := DllDef.MustFindProc("ReadCardBas")
|
|
4319
|
+ if readCard == nil {
|
|
4320
|
+ fmt.Println("readcard is nil")
|
|
4321
|
+ readCard = DllDef.MustFindProc("ReadCardBas")
|
|
4322
|
+ }
|
|
4323
|
+ str := make([]byte, 1024)
|
|
4324
|
+ str1 := make([]byte, 1024)
|
|
4325
|
+ ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
|
|
4326
|
+ fmt.Println(string(str1))
|
|
4327
|
+ fmt.Println(string(str))
|
|
4328
|
+ fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
|
|
4329
|
+ fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
|
|
4330
|
+ if ret2 != 0 {
|
|
4331
|
+ return ""
|
|
4332
|
+ }
|
|
4333
|
+ return string(str)
|
|
4334
|
+}
|
|
4335
|
+
|
4285
|
4336
|
func (c *ZHHisApiController) ReadCard() {
|
4286
|
4337
|
id_card_type, _ := c.GetInt64("id_card_type")
|
4287
|
4338
|
admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
4339
|
+ is_settle := c.GetString("is_settle")
|
|
4340
|
+
|
4288
|
4341
|
roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
4289
|
4342
|
miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
4290
|
4343
|
|
|
@@ -4488,6 +4541,125 @@ func (c *ZHHisApiController) ReadCard() {
|
4488
|
4541
|
|
4489
|
4542
|
}
|
4490
|
4543
|
|
|
4544
|
+ } else if miConfig.MdtrtareaAdmvs == "360399" {
|
|
4545
|
+ fmt.Println(initFlag)
|
|
4546
|
+ fmt.Println("initFlag")
|
|
4547
|
+
|
|
4548
|
+ if initFlag == 0 {
|
|
4549
|
+ c.TestGetJiangXiBasBaseInit()
|
|
4550
|
+ }
|
|
4551
|
+ basStr := c.GetBasBaseInfoxxx()
|
|
4552
|
+ if len(basStr) == 0 {
|
|
4553
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
4554
|
+ return
|
|
4555
|
+ }
|
|
4556
|
+ fmt.Println(basStr)
|
|
4557
|
+ bas := strings.Split(basStr, "|")
|
|
4558
|
+ basNumber := bas[1]
|
|
4559
|
+ fmt.Println(basNumber)
|
|
4560
|
+ card_sn := bas[3]
|
|
4561
|
+ fmt.Println(card_sn)
|
|
4562
|
+ result, _ := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, "1", miConfig.Url, miConfig.AccessKey, "")
|
|
4563
|
+
|
|
4564
|
+ //result := service.Jxyb1101(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
|
|
4565
|
+ var dat map[string]interface{}
|
|
4566
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
4567
|
+ fmt.Println(dat)
|
|
4568
|
+ } else {
|
|
4569
|
+ fmt.Println(err)
|
|
4570
|
+ }
|
|
4571
|
+
|
|
4572
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
4573
|
+ var res ResultTwo
|
|
4574
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
4575
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
4576
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
4577
|
+ return
|
|
4578
|
+ }
|
|
4579
|
+
|
|
4580
|
+ if res.Infcode == 0 {
|
|
4581
|
+ patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
|
|
4582
|
+ if err == gorm.ErrRecordNotFound {
|
|
4583
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
4584
|
+ return
|
|
4585
|
+ } else if err != nil {
|
|
4586
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
4587
|
+ return
|
|
4588
|
+
|
|
4589
|
+ } else {
|
|
4590
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
4591
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
4592
|
+ infoStr := string(Iinfos)
|
|
4593
|
+ idetinfoStr := string(Idetinfos)
|
|
4594
|
+ psn := &models.HisPsn{
|
|
4595
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
4596
|
+ Age: res.Output.Baseinfo.Age,
|
|
4597
|
+ PatientId: patient.ID,
|
|
4598
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
4599
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
4600
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
4601
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
4602
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
4603
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
4604
|
+ Idetinfo: idetinfoStr,
|
|
4605
|
+ Insuinfo: infoStr,
|
|
4606
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
4607
|
+ CardInfo: basStr,
|
|
4608
|
+ VerifyNumber: "",
|
|
4609
|
+ }
|
|
4610
|
+ service.CreateHisPsn(psn)
|
|
4611
|
+ var rf []*ResultFive
|
|
4612
|
+ json.Unmarshal([]byte(infoStr), &rf)
|
|
4613
|
+
|
|
4614
|
+ var insutypes []*ResultFive
|
|
4615
|
+ var insutype string
|
|
4616
|
+ var is390 int = 0
|
|
4617
|
+ var is310 int = 0
|
|
4618
|
+
|
|
4619
|
+ for _, item := range rf {
|
|
4620
|
+ if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
|
4621
|
+ insutypes = append(insutypes, item)
|
|
4622
|
+ }
|
|
4623
|
+ }
|
|
4624
|
+
|
|
4625
|
+ if len(insutypes) == 1 {
|
|
4626
|
+ insutype = insutypes[0].Insutype
|
|
4627
|
+ //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
|
|
4628
|
+ } else {
|
|
4629
|
+ for _, i := range insutypes {
|
|
4630
|
+ if i.Insutype == "390" {
|
|
4631
|
+ is390 = 1
|
|
4632
|
+ }
|
|
4633
|
+
|
|
4634
|
+ if i.Insutype == "310" {
|
|
4635
|
+ is310 = 1
|
|
4636
|
+ }
|
|
4637
|
+ }
|
|
4638
|
+ }
|
|
4639
|
+ if is390 == 1 {
|
|
4640
|
+ insutype = "390"
|
|
4641
|
+ }
|
|
4642
|
+
|
|
4643
|
+ if is310 == 1 {
|
|
4644
|
+ insutype = "310"
|
|
4645
|
+ }
|
|
4646
|
+
|
|
4647
|
+ if len(insutypes) == 0 {
|
|
4648
|
+ insutype = "310"
|
|
4649
|
+ }
|
|
4650
|
+
|
|
4651
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4652
|
+ "patient": patient,
|
|
4653
|
+ "number": basNumber,
|
|
4654
|
+ "info": res,
|
|
4655
|
+ "insutype": insutype,
|
|
4656
|
+ })
|
|
4657
|
+ }
|
|
4658
|
+ } else {
|
|
4659
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
4660
|
+ return
|
|
4661
|
+ }
|
|
4662
|
+
|
4491
|
4663
|
} else {
|
4492
|
4664
|
|
4493
|
4665
|
if initFlagTwo == 0 {
|
|
@@ -4601,7 +4773,7 @@ func (c *ZHHisApiController) ReadCard() {
|
4601
|
4773
|
if miConfig.MdtrtareaAdmvs == "150499" {
|
4602
|
4774
|
var api string
|
4603
|
4775
|
api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
|
4604
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
|
|
4776
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName + "&is_settle=" + is_settle
|
4605
|
4777
|
|
4606
|
4778
|
resp, requestErr := http.Get(api)
|
4607
|
4779
|
if requestErr != nil {
|
|
@@ -4641,13 +4813,81 @@ func (c *ZHHisApiController) ReadCard() {
|
4641
|
4813
|
res.Infcode = infocode
|
4642
|
4814
|
res.Output = res10265.Output
|
4643
|
4815
|
res.InfRefmsgid = res10265.InfRefmsgid
|
|
4816
|
+
|
4644
|
4817
|
if res.Infcode == 0 {
|
4645
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
4646
|
|
- "number": token,
|
4647
|
|
- })
|
|
4818
|
+ patient, err := service.GetPatientByNumber(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
|
4819
|
+ if err == gorm.ErrRecordNotFound {
|
|
4820
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
4821
|
+ return
|
|
4822
|
+ } else if err != nil {
|
|
4823
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
4824
|
+ return
|
|
4825
|
+ } else {
|
|
4826
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
4827
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
4828
|
+ infoStr := string(Iinfos)
|
|
4829
|
+ idetinfoStr := string(Idetinfos)
|
|
4830
|
+ psn := &models.HisPsn{
|
|
4831
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
4832
|
+ Age: res.Output.Baseinfo.Age,
|
|
4833
|
+ PatientId: patient.ID,
|
|
4834
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
4835
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
4836
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
4837
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
4838
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
4839
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
4840
|
+ Idetinfo: idetinfoStr,
|
|
4841
|
+ Insuinfo: infoStr,
|
|
4842
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
4843
|
+ CardInfo: "",
|
|
4844
|
+ VerifyNumber: token,
|
|
4845
|
+ }
|
|
4846
|
+ service.CreateHisPsn(psn)
|
|
4847
|
+
|
|
4848
|
+ var insutypes []string
|
|
4849
|
+ var insutype string
|
|
4850
|
+ var is390 int = 0
|
|
4851
|
+ var is310 int = 0
|
|
4852
|
+ for _, item := range res.Output.Iinfo {
|
|
4853
|
+ if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
|
4854
|
+ insutypes = append(insutypes, item.Insutype)
|
|
4855
|
+ }
|
|
4856
|
+ }
|
|
4857
|
+ if len(insutypes) == 1 {
|
|
4858
|
+ insutype = insutypes[0]
|
|
4859
|
+ } else {
|
|
4860
|
+ for _, i := range insutypes {
|
|
4861
|
+ if i == "390" {
|
|
4862
|
+ is390 = 1
|
|
4863
|
+ }
|
|
4864
|
+
|
|
4865
|
+ if i == "310" {
|
|
4866
|
+ is310 = 1
|
|
4867
|
+ }
|
|
4868
|
+ }
|
|
4869
|
+ }
|
|
4870
|
+ if is390 == 1 {
|
|
4871
|
+ insutype = "390"
|
|
4872
|
+ }
|
|
4873
|
+ if is310 == 1 {
|
|
4874
|
+ insutype = "310"
|
|
4875
|
+ }
|
|
4876
|
+ if len(insutypes) == 0 {
|
|
4877
|
+ insutype = "390"
|
|
4878
|
+ }
|
|
4879
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4880
|
+ "failed_code": 0,
|
|
4881
|
+ "info": res,
|
|
4882
|
+ "insutype": insutype,
|
|
4883
|
+ "patient": patient,
|
|
4884
|
+ })
|
|
4885
|
+ }
|
|
4886
|
+ } else {
|
|
4887
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
4888
|
+ return
|
4648
|
4889
|
}
|
4649
|
4890
|
}
|
4650
|
|
-
|
4651
|
4891
|
} else {
|
4652
|
4892
|
if initFlagTwo == 0 {
|
4653
|
4893
|
c.TestGetBasBaseInitTwo()
|