|
@@ -56,6 +56,14 @@ func HisManagerApiRegistRouters() {
|
56
|
56
|
beego.Router("/api/310", &HisApiController{}, "get:Check310")
|
57
|
57
|
beego.Router("/api/390", &HisApiController{}, "get:Check390")
|
58
|
58
|
|
|
59
|
+ //备案撤销相关接口
|
|
60
|
+ beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
|
|
61
|
+ beego.Router("/api/uncheckcode/get", &HisApiController{}, "get:UnCheckCode")
|
|
62
|
+ beego.Router("/api/psn/putonrecord", &HisApiController{}, "get:PsnPutOnRecord")
|
|
63
|
+ beego.Router("/api/psn/unputonrecord", &HisApiController{}, "get:PsnUnPutOnRecord")
|
|
64
|
+ beego.Router("/api/psn/ncds/putonrecord", &HisApiController{}, "get:PsnPutNCDSOnRecord")
|
|
65
|
+ beego.Router("/api/psn/ncds/unputonrecord", &HisApiController{}, "get:PsnPutUnNCDSOnRecord")
|
|
66
|
+
|
59
|
67
|
}
|
60
|
68
|
|
61
|
69
|
//func (c *HisApiController) TestPay() {
|
|
@@ -203,7 +211,6 @@ func (c *HisApiController) GetHisPatientInfo() {
|
203
|
211
|
Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
204
|
212
|
infoStr := string(Iinfos)
|
205
|
213
|
idetinfoStr := string(Idetinfos)
|
206
|
|
-
|
207
|
214
|
if res.Infcode == 0 {
|
208
|
215
|
his := models.VMHisPatient{
|
209
|
216
|
Status: 1,
|
|
@@ -231,7 +238,6 @@ func (c *HisApiController) GetHisPatientInfo() {
|
231
|
238
|
return
|
232
|
239
|
}
|
233
|
240
|
}
|
234
|
|
-
|
235
|
241
|
}
|
236
|
242
|
|
237
|
243
|
//func (c *HisApiController) Sscard() {
|
|
@@ -811,6 +817,33 @@ type ResultTwelve struct {
|
811
|
817
|
WarnMsg interface{} `json:"warn_msg"`
|
812
|
818
|
}
|
813
|
819
|
|
|
820
|
+type ResultThirteen struct {
|
|
821
|
+ ErrMsg string `json:"err_msg"`
|
|
822
|
+ InfRefmsgid string `json:"inf_refmsgid"`
|
|
823
|
+ Infcode int64 `json:"infcode"`
|
|
824
|
+ Output struct {
|
|
825
|
+ Result struct {
|
|
826
|
+ TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
|
|
827
|
+ } `json:"result"`
|
|
828
|
+ } `json:"output"`
|
|
829
|
+ RefmsgTime string `json:"refmsg_time"`
|
|
830
|
+ RespondTime string `json:"respond_time"`
|
|
831
|
+ Signtype interface{} `json:"signtype"`
|
|
832
|
+ WarnInfo interface{} `json:"warn_info"`
|
|
833
|
+}
|
|
834
|
+
|
|
835
|
+type ResultFourteen struct {
|
|
836
|
+ ErrMsg string `json:"err_msg"`
|
|
837
|
+ InfRefmsgid string `json:"inf_refmsgid"`
|
|
838
|
+ Infcode int64 `json:"infcode"`
|
|
839
|
+ Output struct {
|
|
840
|
+ } `json:"output"`
|
|
841
|
+ RefmsgTime string `json:"refmsg_time"`
|
|
842
|
+ RespondTime string `json:"respond_time"`
|
|
843
|
+ Signtype interface{} `json:"signtype"`
|
|
844
|
+ WarnInfo interface{} `json:"warn_info"`
|
|
845
|
+}
|
|
846
|
+
|
814
|
847
|
type Custom struct {
|
815
|
848
|
DetItemFeeSumamt string
|
816
|
849
|
Cut string
|
|
@@ -2738,9 +2771,7 @@ func (c *HisApiController) GetCheckAccount() {
|
2738
|
2771
|
startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
2739
|
2772
|
endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
2740
|
2773
|
orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
|
2741
|
|
-
|
2742
|
2774
|
orders_two, _ := service.GetOrderByTimeThree(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, clr_type)
|
2743
|
|
-
|
2744
|
2775
|
fixmedins_setl_cnt := int64(len(orders_two))
|
2745
|
2776
|
|
2746
|
2777
|
//撤销的算2条数据为一笔
|
|
@@ -2764,7 +2795,6 @@ func (c *HisApiController) GetCheckAccount() {
|
2764
|
2795
|
} else {
|
2765
|
2796
|
user_name = role.UserName
|
2766
|
2797
|
}
|
2767
|
|
-
|
2768
|
2798
|
if config.IsOpen == 1 {
|
2769
|
2799
|
api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
|
2770
|
2800
|
"insutype=" + insutype +
|
|
@@ -2802,46 +2832,48 @@ func (c *HisApiController) GetCheckAccount() {
|
2802
|
2832
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2803
|
2833
|
return
|
2804
|
2834
|
}
|
2805
|
|
-
|
2806
|
2835
|
respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2807
|
2836
|
userJSONBytes, _ := json.Marshal(respJSON)
|
2808
|
|
-
|
2809
|
2837
|
var res ResultEight
|
2810
|
2838
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2811
|
2839
|
utils.ErrorLog("解析失败:%v", err)
|
2812
|
2840
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2813
|
2841
|
return
|
2814
|
2842
|
}
|
2815
|
|
-
|
2816
|
2843
|
if res.Infcode == 0 {
|
2817
|
|
- micc := &models.MedicalInsuranceCostCompare{
|
2818
|
|
- StartTime: startime.Unix(),
|
2819
|
|
- EndTime: endtime.Unix(),
|
2820
|
|
- Insutype: insutype,
|
2821
|
|
- CheckType: 1,
|
2822
|
|
- Num: fixmedins_setl_cnt,
|
2823
|
|
- Mtime: time.Now().Unix(),
|
2824
|
|
- Status: 1,
|
2825
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2826
|
|
- CostTotal: medfee_sumamt,
|
2827
|
|
- FuncTotal: fund_pay_sumamt,
|
2828
|
|
- PsnPay: acct_pay,
|
2829
|
|
- Creator: admin_user_id,
|
2830
|
|
- Ctime: time.Now().Unix(),
|
2831
|
|
- }
|
2832
|
|
-
|
2833
|
|
- err := service.CreateMedicalInsuranceCostCompareRecord(micc)
|
|
2844
|
+ if res.Output.Stmtinfo.StmtRslt == "0" {
|
|
2845
|
+ micc := &models.MedicalInsuranceCostCompare{
|
|
2846
|
+ StartTime: startime.Unix(),
|
|
2847
|
+ EndTime: endtime.Unix(),
|
|
2848
|
+ Insutype: insutype,
|
|
2849
|
+ CheckType: 1,
|
|
2850
|
+ Num: fixmedins_setl_cnt,
|
|
2851
|
+ Mtime: time.Now().Unix(),
|
|
2852
|
+ Status: 1,
|
|
2853
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
2854
|
+ CostTotal: medfee_sumamt,
|
|
2855
|
+ FuncTotal: fund_pay_sumamt,
|
|
2856
|
+ PsnPay: acct_pay,
|
|
2857
|
+ Creator: admin_user_id,
|
|
2858
|
+ Ctime: time.Now().Unix(),
|
|
2859
|
+ }
|
|
2860
|
+ err := service.CreateMedicalInsuranceCostCompareRecord(micc)
|
|
2861
|
+ if err == nil {
|
|
2862
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2863
|
+ "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
|
|
2864
|
+ "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
|
|
2865
|
+ })
|
2834
|
2866
|
|
2835
|
|
- if err == nil {
|
|
2867
|
+ } else {
|
|
2868
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2869
|
+ }
|
|
2870
|
+ } else {
|
2836
|
2871
|
c.ServeSuccessJSON(map[string]interface{}{
|
2837
|
|
- "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
|
2838
|
|
- "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
|
|
2872
|
+ "code": -10,
|
|
2873
|
+ "msg": res.ErrMsg,
|
2839
|
2874
|
})
|
2840
|
2875
|
|
2841
|
|
- } else {
|
2842
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2843
|
2876
|
}
|
2844
|
|
-
|
2845
|
2877
|
} else {
|
2846
|
2878
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2847
|
2879
|
}
|
|
@@ -3347,46 +3379,6 @@ func (c *HisApiController) GetSettleAccounts() {
|
3347
|
3379
|
|
3348
|
3380
|
}
|
3349
|
3381
|
|
3350
|
|
-func (c *HisApiController) GetCode() {
|
3351
|
|
-
|
3352
|
|
- name := c.GetString("name")
|
3353
|
|
- codg := c.GetString("codg")
|
3354
|
|
-
|
3355
|
|
- adminUser := c.GetAdminUserInfo()
|
3356
|
|
-
|
3357
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
3358
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
3359
|
|
-
|
3360
|
|
- var user_name string
|
3361
|
|
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
3362
|
|
- if role.ID == 0 {
|
3363
|
|
- user_name = "xxx"
|
3364
|
|
- } else {
|
3365
|
|
- user_name = role.UserName
|
3366
|
|
- }
|
3367
|
|
-
|
3368
|
|
- baseParams := &models.BaseParams{
|
3369
|
|
- SecretKey: miConfig.SecretKey,
|
3370
|
|
- FixmedinsCode: miConfig.Code,
|
3371
|
|
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
|
3372
|
|
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
|
3373
|
|
- OrgName: miConfig.OrgName,
|
3374
|
|
- Doctor: user_name,
|
3375
|
|
- }
|
3376
|
|
-
|
3377
|
|
- if config.IsOpen == 1 {
|
3378
|
|
- result := service.Gdyb3301(baseParams, name, codg)
|
3379
|
|
- var dat map[string]interface{}
|
3380
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
3381
|
|
- fmt.Println(dat)
|
3382
|
|
- } else {
|
3383
|
|
- fmt.Println(err)
|
3384
|
|
- }
|
3385
|
|
-
|
3386
|
|
- }
|
3387
|
|
-
|
3388
|
|
-}
|
3389
|
|
-
|
3390
|
3382
|
func (c *HisApiController) CheckTreatment() {
|
3391
|
3383
|
patient_id, _ := c.GetInt64("patient_id", 0)
|
3392
|
3384
|
record_time := c.GetString("record_time")
|
|
@@ -3647,6 +3639,396 @@ func (c *HisApiController) GetUploadDiag() {
|
3647
|
3639
|
|
3648
|
3640
|
}
|
3649
|
3641
|
|
|
3642
|
+func (c *HisApiController) GetCheckCode() {
|
|
3643
|
+ name := c.GetString("name")
|
|
3644
|
+ codg := c.GetString("codg")
|
|
3645
|
+ list_type_code := c.GetString("list_type_code")
|
|
3646
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3647
|
+
|
|
3648
|
+ adminUser := c.GetAdminUserInfo()
|
|
3649
|
+
|
|
3650
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
3651
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
3652
|
+
|
|
3653
|
+ var user_name string
|
|
3654
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
3655
|
+ if role.ID == 0 {
|
|
3656
|
+ user_name = "xxx"
|
|
3657
|
+ } else {
|
|
3658
|
+ user_name = role.UserName
|
|
3659
|
+ }
|
|
3660
|
+
|
|
3661
|
+ baseParams := &models.BaseParams{
|
|
3662
|
+ SecretKey: miConfig.SecretKey,
|
|
3663
|
+ FixmedinsCode: miConfig.Code,
|
|
3664
|
+ InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
|
|
3665
|
+ MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
|
|
3666
|
+ OrgName: miConfig.OrgName,
|
|
3667
|
+ Doctor: user_name,
|
|
3668
|
+ }
|
|
3669
|
+
|
|
3670
|
+ if config.IsOpen == 1 {
|
|
3671
|
+ result := service.Gdyb3301(baseParams, name, codg, list_type_code)
|
|
3672
|
+ var dat map[string]interface{}
|
|
3673
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3674
|
+ fmt.Println(dat)
|
|
3675
|
+ } else {
|
|
3676
|
+ fmt.Println(err)
|
|
3677
|
+ }
|
|
3678
|
+
|
|
3679
|
+ }
|
|
3680
|
+
|
|
3681
|
+}
|
|
3682
|
+func (c *HisApiController) UnCheckCode() {
|
|
3683
|
+ name := c.GetString("name")
|
|
3684
|
+ codg := c.GetString("codg")
|
|
3685
|
+ list_type_code := c.GetString("list_type_code")
|
|
3686
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3687
|
+
|
|
3688
|
+ adminUser := c.GetAdminUserInfo()
|
|
3689
|
+
|
|
3690
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
3691
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
3692
|
+
|
|
3693
|
+ var user_name string
|
|
3694
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
3695
|
+ if role.ID == 0 {
|
|
3696
|
+ user_name = "xxx"
|
|
3697
|
+ } else {
|
|
3698
|
+ user_name = role.UserName
|
|
3699
|
+ }
|
|
3700
|
+
|
|
3701
|
+ baseParams := &models.BaseParams{
|
|
3702
|
+ SecretKey: miConfig.SecretKey,
|
|
3703
|
+ FixmedinsCode: miConfig.Code,
|
|
3704
|
+ InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
|
|
3705
|
+ MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
|
|
3706
|
+ OrgName: miConfig.OrgName,
|
|
3707
|
+ Doctor: user_name,
|
|
3708
|
+ }
|
|
3709
|
+
|
|
3710
|
+ if config.IsOpen == 1 {
|
|
3711
|
+ result := service.Gdyb3302(baseParams, name, codg, list_type_code)
|
|
3712
|
+ var dat map[string]interface{}
|
|
3713
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3714
|
+ fmt.Println(dat)
|
|
3715
|
+ } else {
|
|
3716
|
+ fmt.Println(err)
|
|
3717
|
+ }
|
|
3718
|
+
|
|
3719
|
+ }
|
|
3720
|
+
|
|
3721
|
+}
|
|
3722
|
+func (c *HisApiController) PsnPutOnRecord() {
|
|
3723
|
+ record_type, _ := c.GetInt64("type")
|
|
3724
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
3725
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3726
|
+ start_time := c.GetString("start_time")
|
|
3727
|
+ end_time := c.GetString("end_time")
|
|
3728
|
+
|
|
3729
|
+ adminUser := c.GetAdminUserInfo()
|
|
3730
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
3731
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
3732
|
+
|
|
3733
|
+ var patients []*models.Patients
|
|
3734
|
+ if record_type == 1 { //全部备案
|
|
3735
|
+
|
|
3736
|
+ patient, _ := service.GetAllPatient(adminUser.CurrentOrgId)
|
|
3737
|
+ patients = append(patients, patient...)
|
|
3738
|
+
|
|
3739
|
+ } else { //单个备案
|
|
3740
|
+ patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
|
|
3741
|
+ patients = append(patients, patient)
|
|
3742
|
+
|
|
3743
|
+ }
|
|
3744
|
+
|
|
3745
|
+ var user_name string
|
|
3746
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
3747
|
+ if role.ID == 0 {
|
|
3748
|
+ user_name = "xxx"
|
|
3749
|
+ } else {
|
|
3750
|
+ user_name = role.UserName
|
|
3751
|
+ }
|
|
3752
|
+
|
|
3753
|
+ if config.IsOpen == 1 {
|
|
3754
|
+ for _, item := range patients {
|
|
3755
|
+ api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + item.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + user_name + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
3756
|
+ resp, requestErr := http.Get(api)
|
|
3757
|
+ if requestErr != nil {
|
|
3758
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3759
|
+ return
|
|
3760
|
+ }
|
|
3761
|
+ defer resp.Body.Close()
|
|
3762
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
3763
|
+ if ioErr != nil {
|
|
3764
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
3765
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3766
|
+ return
|
|
3767
|
+ }
|
|
3768
|
+ var respJSON map[string]interface{}
|
|
3769
|
+
|
|
3770
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
3771
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
3772
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3773
|
+ return
|
|
3774
|
+ }
|
|
3775
|
+
|
|
3776
|
+ userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
3777
|
+ userJSONBytes, _ := json.Marshal(userJSON)
|
|
3778
|
+ var res ResultTwo
|
|
3779
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
3780
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3781
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3782
|
+ return
|
|
3783
|
+ }
|
|
3784
|
+
|
|
3785
|
+ if res.Infcode == 0 {
|
|
3786
|
+ result := service.Gdyb2505(res.Output.Baseinfo.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, start_time, end_time)
|
|
3787
|
+ var dat map[string]interface{}
|
|
3788
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3789
|
+ fmt.Println(dat)
|
|
3790
|
+ } else {
|
|
3791
|
+ fmt.Println(err)
|
|
3792
|
+ }
|
|
3793
|
+
|
|
3794
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
3795
|
+
|
|
3796
|
+ var res2 ResultThirteen
|
|
3797
|
+ if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
|
3798
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3799
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3800
|
+ return
|
|
3801
|
+ }
|
|
3802
|
+ if res2.Infcode == 0 {
|
|
3803
|
+ psnResult := &models.GdybPsnRecord{
|
|
3804
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
3805
|
+ PatientId: item.ID,
|
|
3806
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
3807
|
+ Ctime: time.Now().Unix(),
|
|
3808
|
+ Mtime: time.Now().Unix(),
|
|
3809
|
+ Status: 1,
|
|
3810
|
+ IsCancel: 1,
|
|
3811
|
+ TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
|
|
3812
|
+ }
|
|
3813
|
+ service.CreatePsnRecord(psnResult)
|
|
3814
|
+
|
|
3815
|
+ } else {
|
|
3816
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
3817
|
+ "failed_code": -10,
|
|
3818
|
+ "msg": res2.ErrMsg,
|
|
3819
|
+ })
|
|
3820
|
+ return
|
|
3821
|
+ }
|
|
3822
|
+
|
|
3823
|
+ }
|
|
3824
|
+
|
|
3825
|
+ }
|
|
3826
|
+ }
|
|
3827
|
+
|
|
3828
|
+}
|
|
3829
|
+func (c *HisApiController) PsnUnPutOnRecord() {
|
|
3830
|
+ id, _ := c.GetInt64("id")
|
|
3831
|
+ //record_type, _ := c.GetInt64("type")
|
|
3832
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3833
|
+
|
|
3834
|
+ adminUser := c.GetAdminUserInfo()
|
|
3835
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
3836
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
3837
|
+
|
|
3838
|
+ var user_name string
|
|
3839
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
3840
|
+ if role.ID == 0 {
|
|
3841
|
+ user_name = "xxx"
|
|
3842
|
+ } else {
|
|
3843
|
+ user_name = role.UserName
|
|
3844
|
+ }
|
|
3845
|
+
|
|
3846
|
+ psn_record, _ := service.GetPsnRecordById(id)
|
|
3847
|
+ if psn_record.ID == 0 {
|
|
3848
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
|
|
3849
|
+ return
|
|
3850
|
+ }
|
|
3851
|
+ if config.IsOpen == 1 {
|
|
3852
|
+ result := service.Gdyb2506(psn_record.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
|
|
3853
|
+ var dat map[string]interface{}
|
|
3854
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3855
|
+ fmt.Println(dat)
|
|
3856
|
+ } else {
|
|
3857
|
+ fmt.Println(err)
|
|
3858
|
+ }
|
|
3859
|
+
|
|
3860
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
3861
|
+ var res ResultFourteen
|
|
3862
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
3863
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3864
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3865
|
+ return
|
|
3866
|
+ }
|
|
3867
|
+ if res.Infcode == 0 {
|
|
3868
|
+ psn_record.IsCancel = 2
|
|
3869
|
+ service.CreatePsnRecord(&psn_record)
|
|
3870
|
+ } else {
|
|
3871
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
3872
|
+ "failed_code": -10,
|
|
3873
|
+ "msg": res.ErrMsg,
|
|
3874
|
+ })
|
|
3875
|
+ return
|
|
3876
|
+ }
|
|
3877
|
+ }
|
|
3878
|
+
|
|
3879
|
+}
|
|
3880
|
+func (c *HisApiController) PsnPutNCDSOnRecord() {
|
|
3881
|
+ record_type, _ := c.GetInt64("type")
|
|
3882
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
3883
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3884
|
+ adminUser := c.GetAdminUserInfo()
|
|
3885
|
+ var patients []*models.Patients
|
|
3886
|
+ if record_type == 1 { //全部备案
|
|
3887
|
+ patient, _ := service.GetAllPatient(adminUser.CurrentOrgId)
|
|
3888
|
+ patients = append(patients, patient...)
|
|
3889
|
+ } else { //单个备案
|
|
3890
|
+ patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
|
|
3891
|
+ patients = append(patients, patient)
|
|
3892
|
+ }
|
|
3893
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
3894
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
3895
|
+ var user_name string
|
|
3896
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
3897
|
+ if role.ID == 0 {
|
|
3898
|
+ user_name = "xxx"
|
|
3899
|
+ } else {
|
|
3900
|
+ user_name = role.UserName
|
|
3901
|
+ }
|
|
3902
|
+
|
|
3903
|
+ if config.IsOpen == 1 {
|
|
3904
|
+ for _, item := range patients {
|
|
3905
|
+ api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + item.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + user_name + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
3906
|
+ resp, requestErr := http.Get(api)
|
|
3907
|
+ if requestErr != nil {
|
|
3908
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3909
|
+ return
|
|
3910
|
+ }
|
|
3911
|
+ defer resp.Body.Close()
|
|
3912
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
3913
|
+ if ioErr != nil {
|
|
3914
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
3915
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3916
|
+ return
|
|
3917
|
+ }
|
|
3918
|
+ var respJSON map[string]interface{}
|
|
3919
|
+
|
|
3920
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
3921
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
3922
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3923
|
+ return
|
|
3924
|
+ }
|
|
3925
|
+
|
|
3926
|
+ userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
3927
|
+ userJSONBytes, _ := json.Marshal(userJSON)
|
|
3928
|
+ var res ResultTwo
|
|
3929
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
3930
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3931
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3932
|
+ return
|
|
3933
|
+ }
|
|
3934
|
+
|
|
3935
|
+ if res.Infcode == 0 {
|
|
3936
|
+ result := service.Gdyb2503(res.Output.Baseinfo.PsnNo, res.Output.Iinfo[0].Insutype, miConfig.OrgName, user_name, miConfig.Code, strconv.FormatInt(admin_user_id, 10), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "慢性肾功能不全(血透治疗)", "M07803")
|
|
3937
|
+ var dat map[string]interface{}
|
|
3938
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3939
|
+ fmt.Println(dat)
|
|
3940
|
+ } else {
|
|
3941
|
+ fmt.Println(err)
|
|
3942
|
+ }
|
|
3943
|
+
|
|
3944
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
3945
|
+
|
|
3946
|
+ var res2 ResultThirteen
|
|
3947
|
+ if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
|
3948
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3949
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3950
|
+ return
|
|
3951
|
+ }
|
|
3952
|
+
|
|
3953
|
+ //patient, _ := service.GetPatientByIDCard(item.IdCardNo, adminUser.CurrentOrgId)
|
|
3954
|
+
|
|
3955
|
+ if res2.Infcode == 0 {
|
|
3956
|
+ psnResult := &models.GdybPsnNcdsRecord{
|
|
3957
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
3958
|
+ PatientId: item.ID,
|
|
3959
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
3960
|
+ Ctime: time.Now().Unix(),
|
|
3961
|
+ Mtime: time.Now().Unix(),
|
|
3962
|
+ Status: 1,
|
|
3963
|
+ IsCancel: 1,
|
|
3964
|
+ TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
|
|
3965
|
+ }
|
|
3966
|
+ service.CreatePsnNCDSRecord(psnResult)
|
|
3967
|
+
|
|
3968
|
+ } else {
|
|
3969
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
3970
|
+ "failed_code": -10,
|
|
3971
|
+ "msg": res2.ErrMsg,
|
|
3972
|
+ })
|
|
3973
|
+ return
|
|
3974
|
+ }
|
|
3975
|
+ }
|
|
3976
|
+
|
|
3977
|
+ }
|
|
3978
|
+
|
|
3979
|
+ }
|
|
3980
|
+
|
|
3981
|
+}
|
|
3982
|
+func (c *HisApiController) PsnPutUnNCDSOnRecord() {
|
|
3983
|
+ id, _ := c.GetInt64("id")
|
|
3984
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
3985
|
+ adminUser := c.GetAdminUserInfo()
|
|
3986
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
3987
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
3988
|
+
|
|
3989
|
+ var user_name string
|
|
3990
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
3991
|
+ if role.ID == 0 {
|
|
3992
|
+ user_name = "xxx"
|
|
3993
|
+ } else {
|
|
3994
|
+ user_name = role.UserName
|
|
3995
|
+ }
|
|
3996
|
+
|
|
3997
|
+ psn_record, _ := service.GetPsnNCDSRecordById(id)
|
|
3998
|
+ if psn_record.ID == 0 {
|
|
3999
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
|
|
4000
|
+ return
|
|
4001
|
+ }
|
|
4002
|
+ if config.IsOpen == 1 {
|
|
4003
|
+ result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, user_name, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
|
|
4004
|
+ var dat map[string]interface{}
|
|
4005
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
4006
|
+ fmt.Println(dat)
|
|
4007
|
+ } else {
|
|
4008
|
+ fmt.Println(err)
|
|
4009
|
+ }
|
|
4010
|
+
|
|
4011
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
4012
|
+ var res ResultFourteen
|
|
4013
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
4014
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
4015
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
4016
|
+ return
|
|
4017
|
+ }
|
|
4018
|
+ if res.Infcode == 0 {
|
|
4019
|
+ psn_record.IsCancel = 2
|
|
4020
|
+ service.CreatePsnNCDSRecord(&psn_record)
|
|
4021
|
+ } else {
|
|
4022
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4023
|
+ "failed_code": -10,
|
|
4024
|
+ "msg": res.ErrMsg,
|
|
4025
|
+ })
|
|
4026
|
+ return
|
|
4027
|
+ }
|
|
4028
|
+ }
|
|
4029
|
+
|
|
4030
|
+}
|
|
4031
|
+
|
3650
|
4032
|
func PathExists(path string) (bool, error) {
|
3651
|
4033
|
_, err := os.Stat(path)
|
3652
|
4034
|
if err == nil {
|
|
@@ -3760,23 +4142,3 @@ func RemoveRepeatedCode(arr []string) (newArr []string) {
|
3760
|
4142
|
}
|
3761
|
4143
|
return
|
3762
|
4144
|
}
|
3763
|
|
-
|
3764
|
|
-//func ShowMessage1(caption, text string, style uintptr) (result int) {
|
3765
|
|
-// user32, _ := syscall.LoadLibrary("SSCard.dll")
|
3766
|
|
-// messageBox, _ := syscall.GetProcAddress(user32, "MessageBoxW")
|
3767
|
|
-// defer syscall.FreeLibrary(user32)
|
3768
|
|
-//
|
3769
|
|
-// ret, _, _ := syscall.Syscall9(messageBox,
|
3770
|
|
-// 4,
|
3771
|
|
-// 0,
|
3772
|
|
-// StrPtr(text),
|
3773
|
|
-// StrPtr(caption),
|
3774
|
|
-// style,
|
3775
|
|
-// 0, 0, 0, 0, 0)
|
3776
|
|
-// result = int(ret)
|
3777
|
|
-// return
|
3778
|
|
-//}
|
3779
|
|
-
|
3780
|
|
-//func StrPtr3(s string) uintptr {
|
3781
|
|
-// return uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s)))
|
3782
|
|
-//}
|