|
@@ -493,8 +493,71 @@ func ZHHisManagerApiRegistRouters() {
|
493
|
493
|
beego.Router("/zh/api/readcard", &ZHHisApiController{}, "get:ReadCard")
|
494
|
494
|
|
495
|
495
|
beego.Router("/zh/api/clearsettle", &ZHHisApiController{}, "get:ClearSettle")
|
|
496
|
+ beego.Router("/zh/api/readelecard", &ZHHisApiController{}, "get:ReadEleCard")
|
496
|
497
|
|
497
|
498
|
}
|
|
499
|
+func (c *ZHHisApiController) ReadEleCard() {
|
|
500
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
501
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
502
|
+ roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
|
503
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
|
504
|
+
|
|
505
|
+ var api string
|
|
506
|
+ api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
|
|
507
|
+ "&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
|
|
508
|
+
|
|
509
|
+ fmt.Println(api)
|
|
510
|
+
|
|
511
|
+ resp, requestErr := http.Get(api)
|
|
512
|
+ if requestErr != nil {
|
|
513
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
514
|
+ return
|
|
515
|
+ }
|
|
516
|
+
|
|
517
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
518
|
+ if ioErr != nil {
|
|
519
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
520
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
521
|
+ return
|
|
522
|
+ }
|
|
523
|
+ var respJSON map[string]interface{}
|
|
524
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
525
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
526
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
527
|
+ return
|
|
528
|
+ }
|
|
529
|
+ var status string
|
|
530
|
+ status = respJSON["data"].(map[string]interface{})["status"].(string)
|
|
531
|
+ //card_type := respJSON["data"].(map[string]interface{})["type"].(string)
|
|
532
|
+ var token string
|
|
533
|
+ var res ResultTwo //1101结果
|
|
534
|
+ var res10265 ResultTwo10265 //1101结果
|
|
535
|
+ if status == "0" { //读卡成功
|
|
536
|
+ token = respJSON["data"].(map[string]interface{})["token"].(string)
|
|
537
|
+ respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
|
|
538
|
+ result, _ := json.Marshal(respJSON)
|
|
539
|
+ if err := json.Unmarshal([]byte(result), &res10265); err != nil {
|
|
540
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
541
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
542
|
+ return
|
|
543
|
+ }
|
|
544
|
+ res.ErrMsg = res10265.ErrMsg
|
|
545
|
+ infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
|
|
546
|
+ res.Infcode = infocode
|
|
547
|
+ res.Output = res10265.Output
|
|
548
|
+ res.InfRefmsgid = res10265.InfRefmsgid
|
|
549
|
+ if res.Infcode == 0 {
|
|
550
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
551
|
+ "number": token,
|
|
552
|
+ })
|
|
553
|
+ }
|
|
554
|
+ } else {
|
|
555
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
556
|
+ return
|
|
557
|
+ }
|
|
558
|
+
|
|
559
|
+}
|
|
560
|
+
|
498
|
561
|
func (c *ZHHisApiController) ClearSettle() {
|
499
|
562
|
order_id, _ := c.GetInt64("order_id")
|
500
|
563
|
admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
@@ -2824,79 +2887,172 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
|
2824
|
2887
|
|
2825
|
2888
|
var result string
|
2826
|
2889
|
var requestLog string
|
|
2890
|
+ orders, _ := service.GetHisOrderInfoByNumber(record.Number)
|
2827
|
2891
|
|
2828
|
|
- if miConfig.MdtrtareaAdmvs == "150499" {
|
2829
|
|
- //请求内网数据
|
2830
|
|
- api := "http://172.16.13.254:9532/" + "nmyb/2302?psn_no=" + record.PsnNo + "&mdtrtId=" + record.Number + "&number=" + "0000" +
|
2831
|
|
- "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
|
2832
|
|
- "&insuplc_admdvs=" + record.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&refund_type=0"
|
2833
|
|
- resp, requestErr := http.Get(api)
|
2834
|
|
- if requestErr != nil {
|
2835
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2836
|
|
- return
|
2837
|
|
- }
|
|
2892
|
+ if len(orders) > 0 { //判断是否上传过明细,有的话需要退明细,后撤销入院
|
|
2893
|
+ if miConfig.MdtrtareaAdmvs == "150499" {
|
|
2894
|
+ //请求内网数据
|
|
2895
|
+ api := "http://172.16.13.254:9532/" + "nmyb/2302?psn_no=" + record.PsnNo + "&mdtrtId=" + record.Number + "&number=" + "0000" +
|
|
2896
|
+ "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
|
|
2897
|
+ "&insuplc_admdvs=" + record.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&refund_type=0"
|
|
2898
|
+ resp, requestErr := http.Get(api)
|
|
2899
|
+ if requestErr != nil {
|
|
2900
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2901
|
+ return
|
|
2902
|
+ }
|
2838
|
2903
|
|
2839
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
|
2904
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
2905
|
+
|
|
2906
|
+ if ioErr != nil {
|
|
2907
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
2908
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2909
|
+ return
|
|
2910
|
+ }
|
|
2911
|
+
|
|
2912
|
+ var respJSON map[string]interface{}
|
|
2913
|
+
|
|
2914
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
2915
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2916
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2917
|
+ return
|
|
2918
|
+ }
|
|
2919
|
+
|
|
2920
|
+ respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
2921
|
+ result_byte, _ := json.Marshal(respJSON)
|
|
2922
|
+ result = string(result_byte)
|
|
2923
|
+ saveLog(result, requestLog, "2302", "月结退明细")
|
|
2924
|
+
|
|
2925
|
+ } else {
|
|
2926
|
+ result, requestLog = service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
|
|
2927
|
+ saveLog(result, requestLog, "2302", "月结退明细")
|
2840
|
2928
|
|
2841
|
|
- if ioErr != nil {
|
2842
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2843
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2844
|
|
- return
|
2845
|
2929
|
}
|
2846
|
2930
|
|
2847
|
|
- var respJSON map[string]interface{}
|
|
2931
|
+ var dat map[string]interface{}
|
|
2932
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2933
|
+ fmt.Println(dat)
|
|
2934
|
+ } else {
|
|
2935
|
+ fmt.Println(err)
|
|
2936
|
+ }
|
2848
|
2937
|
|
2849
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2850
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2851
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2852
|
|
- return
|
|
2938
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
2939
|
+
|
|
2940
|
+ var res2 ResultEmpty
|
|
2941
|
+ var resEmpty10265 ResultEmpty10265
|
|
2942
|
+ if miConfig.Code == "H15049901371" {
|
|
2943
|
+ if err := json.Unmarshal(userJSONBytes, &resEmpty10265); err != nil {
|
|
2944
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2945
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2946
|
+ return
|
|
2947
|
+ }
|
|
2948
|
+ Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
|
|
2949
|
+ res2.Infcode = Infcode
|
|
2950
|
+ res2.RespondTime = resEmpty10265.RespondTime
|
|
2951
|
+ res2.ErrMsg = resEmpty10265.ErrMsg
|
|
2952
|
+ res2.Output = resEmpty10265.Output
|
|
2953
|
+ res2.WarnMsg = resEmpty10265.WarnMsg
|
|
2954
|
+ } else {
|
|
2955
|
+ if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
|
2956
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2957
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2958
|
+ return
|
|
2959
|
+ }
|
2853
|
2960
|
}
|
2854
|
2961
|
|
2855
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2856
|
|
- result_byte, _ := json.Marshal(respJSON)
|
2857
|
|
- result = string(result_byte)
|
2858
|
|
- saveLog(result, requestLog, "2302", "月结退明细")
|
|
2962
|
+ if res2.Infcode == 0 {
|
2859
|
2963
|
|
2860
|
|
- } else {
|
2861
|
|
- result, requestLog = service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
|
2862
|
|
- saveLog(result, requestLog, "2302", "月结退明细")
|
|
2964
|
+ service.UpdataHospitalOrderStatus(record.Number, adminInfo.CurrentOrgId)
|
2863
|
2965
|
|
2864
|
|
- }
|
|
2966
|
+ var result string
|
|
2967
|
+ var requestLog string
|
|
2968
|
+ if miConfig.MdtrtareaAdmvs == "150499" {
|
|
2969
|
+ //请求内网数据
|
|
2970
|
+ api := "http://172.16.13.254:9532/" + "nmyb/2404?mdtrt_id=" + record.Number + "&psn_no=" + record.PsnNo +
|
|
2971
|
+ "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
|
|
2972
|
+ "&insuplc_admdvs=" + record.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
2973
|
+ resp, requestErr := http.Get(api)
|
|
2974
|
+ if requestErr != nil {
|
|
2975
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2976
|
+ return
|
|
2977
|
+ }
|
2865
|
2978
|
|
2866
|
|
- var dat map[string]interface{}
|
2867
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
2868
|
|
- fmt.Println(dat)
|
2869
|
|
- } else {
|
2870
|
|
- fmt.Println(err)
|
2871
|
|
- }
|
|
2979
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
2872
|
2980
|
|
2873
|
|
- userJSONBytes, _ := json.Marshal(dat)
|
|
2981
|
+ if ioErr != nil {
|
|
2982
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
2983
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2984
|
+ return
|
|
2985
|
+ }
|
2874
|
2986
|
|
2875
|
|
- var res2 ResultEmpty
|
2876
|
|
- var resEmpty10265 ResultEmpty10265
|
2877
|
|
- if miConfig.Code == "H15049901371" {
|
2878
|
|
- if err := json.Unmarshal(userJSONBytes, &resEmpty10265); err != nil {
|
2879
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2880
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2881
|
|
- return
|
2882
|
|
- }
|
2883
|
|
- Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
|
2884
|
|
- res2.Infcode = Infcode
|
2885
|
|
- res2.RespondTime = resEmpty10265.RespondTime
|
2886
|
|
- res2.ErrMsg = resEmpty10265.ErrMsg
|
2887
|
|
- res2.Output = resEmpty10265.Output
|
2888
|
|
- res2.WarnMsg = resEmpty10265.WarnMsg
|
2889
|
|
- } else {
|
2890
|
|
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
2891
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2892
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2893
|
|
- return
|
2894
|
|
- }
|
2895
|
|
- }
|
|
2987
|
+ var respJSON map[string]interface{}
|
2896
|
2988
|
|
2897
|
|
- if res2.Infcode == 0 {
|
|
2989
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
2990
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2991
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2992
|
+ return
|
|
2993
|
+ }
|
|
2994
|
+
|
|
2995
|
+ respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
2996
|
+ result_byte, _ := json.Marshal(respJSON)
|
|
2997
|
+ result = string(result_byte)
|
|
2998
|
+
|
|
2999
|
+ } else {
|
|
3000
|
+ result, requestLog = service.ZHGdyb2404(record.Number, record.PsnNo, miConfig.SecretKey, miConfig.OrgName, miConfig.Code, role.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
|
|
3001
|
+ saveLog(result, requestLog, "2404", "入院登记撤销")
|
2898
|
3002
|
|
2899
|
|
- service.UpdataHospitalOrderStatus(record.Number, adminInfo.CurrentOrgId)
|
|
3003
|
+ }
|
|
3004
|
+
|
|
3005
|
+ var dat map[string]interface{}
|
|
3006
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
3007
|
+ fmt.Println(dat)
|
|
3008
|
+ } else {
|
|
3009
|
+ fmt.Println(err)
|
|
3010
|
+ }
|
|
3011
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
3012
|
+ var res ResultEmpty
|
|
3013
|
+ var resEmpty10265 ResultEmpty10265
|
|
3014
|
+ if miConfig.Code == "H15049901371" {
|
|
3015
|
+ if err := json.Unmarshal(userJSONBytes, &resEmpty10265); err != nil {
|
|
3016
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3017
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3018
|
+ return
|
|
3019
|
+ }
|
|
3020
|
+ Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
|
|
3021
|
+ res.Infcode = Infcode
|
|
3022
|
+ res.RespondTime = resEmpty10265.RespondTime
|
|
3023
|
+ res.ErrMsg = resEmpty10265.ErrMsg
|
|
3024
|
+ res.Output = resEmpty10265.Output
|
|
3025
|
+ res.WarnMsg = resEmpty10265.WarnMsg
|
|
3026
|
+ } else {
|
|
3027
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
3028
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
3029
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
3030
|
+ return
|
|
3031
|
+ }
|
|
3032
|
+ }
|
|
3033
|
+
|
|
3034
|
+ if res.Infcode == 0 {
|
|
3035
|
+ record.Status = 0
|
|
3036
|
+ service.CreateHospitalRecord(&record)
|
|
3037
|
+
|
|
3038
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3039
|
+ "msg": "撤销入院成功",
|
|
3040
|
+ })
|
|
3041
|
+
|
|
3042
|
+ } else {
|
|
3043
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3044
|
+ "failed_code": -10,
|
|
3045
|
+ "msg": res.ErrMsg,
|
|
3046
|
+ })
|
|
3047
|
+ }
|
|
3048
|
+
|
|
3049
|
+ } else {
|
|
3050
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3051
|
+ "code": -10,
|
|
3052
|
+ "msg": res2.ErrMsg,
|
|
3053
|
+ })
|
|
3054
|
+ }
|
|
3055
|
+ } else { //没有上传过明细的,直接撤销入院
|
2900
|
3056
|
|
2901
|
3057
|
var result string
|
2902
|
3058
|
var requestLog string
|
|
@@ -2969,7 +3125,6 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
|
2969
|
3125
|
if res.Infcode == 0 {
|
2970
|
3126
|
record.Status = 0
|
2971
|
3127
|
service.CreateHospitalRecord(&record)
|
2972
|
|
-
|
2973
|
3128
|
this.ServeSuccessJSON(map[string]interface{}{
|
2974
|
3129
|
"msg": "撤销入院成功",
|
2975
|
3130
|
})
|
|
@@ -2980,14 +3135,7 @@ func (this *ZHHisApiController) GetZHInHospitalUnCheck() {
|
2980
|
3135
|
"msg": res.ErrMsg,
|
2981
|
3136
|
})
|
2982
|
3137
|
}
|
2983
|
|
-
|
2984
|
|
- } else {
|
2985
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
2986
|
|
- "code": -10,
|
2987
|
|
- "msg": res2.ErrMsg,
|
2988
|
|
- })
|
2989
|
3138
|
}
|
2990
|
|
-
|
2991
|
3139
|
}
|
2992
|
3140
|
|
2993
|
3141
|
func saveLog(result string, request string, infno string, desc string) {
|
|
@@ -3074,6 +3222,7 @@ func (c *ZHHisApiController) ReadCard() {
|
3074
|
3222
|
var api string
|
3075
|
3223
|
api = "http://172.16.13.254:9532/" + "nmyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
|
3076
|
3224
|
"&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
|
|
3225
|
+
|
3077
|
3226
|
fmt.Println(api)
|
3078
|
3227
|
|
3079
|
3228
|
resp, requestErr := http.Get(api)
|