|
@@ -821,6 +821,64 @@ type ResultFourteen struct {
|
821
|
821
|
WarnInfo interface{} `json:"warn_info"`
|
822
|
822
|
}
|
823
|
823
|
|
|
824
|
+type ResultSixteen struct {
|
|
825
|
+ Cainfo string `json:"cainfo"`
|
|
826
|
+ ErrMsg string `json:"err_msg"`
|
|
827
|
+ InfRefmsgid string `json:"inf_refmsgid"`
|
|
828
|
+ Infcode int64 `json:"infcode"`
|
|
829
|
+ Output struct {
|
|
830
|
+ Setldetail []interface{} `json:"setldetail"`
|
|
831
|
+ Setlinfo struct {
|
|
832
|
+ MdtrtID string `json:"mdtrt_id"`
|
|
833
|
+ SetlID string `json:"setl_id"`
|
|
834
|
+ ClrOptins string `json:"clr_optins"`
|
|
835
|
+ SetlTime string `json:"setl_time"`
|
|
836
|
+ MedfeeSumamt float64 `json:"medfee_sumamt"`
|
|
837
|
+ FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
|
|
838
|
+ OverlmtSelfpay float64 `json:"overlmt_selfpay"`
|
|
839
|
+ PreselfpayAmt float64 `json:"preselfpay_amt"`
|
|
840
|
+ InscpScpAmt float64 `json:"inscp_scp_amt"`
|
|
841
|
+ ActPayDedc float64 `json:"act_pay_dedc"`
|
|
842
|
+ HifpPay float64 `json:"hifp_pay"`
|
|
843
|
+ PoolPropSe float64 `json:"pool_prop_selfpay"`
|
|
844
|
+ Lfpay float64 `json:"selfpay"`
|
|
845
|
+ CvlservPay float64 `json:"cvlserv_pay"`
|
|
846
|
+ HifesPay float64 `json:"hifes_pay"`
|
|
847
|
+ HifmiPay float64 `json:"hifmi_pay"`
|
|
848
|
+ HifobPay float64 `json:"hifob_pay"`
|
|
849
|
+ MafPay float64 `json:"maf_pay"`
|
|
850
|
+ OthPay float64 `json:"oth_pay"`
|
|
851
|
+ FundPaySumamt float64 `json:"fund_pay_sumamt"`
|
|
852
|
+ PsnPartAmt float64 `json:"psn_part_amt"`
|
|
853
|
+ AcctPay float64 `json:"acct_pay"`
|
|
854
|
+ Balc float64 `json:"balc"`
|
|
855
|
+ AcctMulaidPay float64 `json:"acct_mulaid_pay"`
|
|
856
|
+ HospPartAmt float64 `json:"hosp_part_amt"`
|
|
857
|
+ MedinsSetlID string `json:"medins_setl_id"`
|
|
858
|
+ Age float64 `json:"age"`
|
|
859
|
+ Brdy string `json:"brdy"`
|
|
860
|
+ Certno string `json:"certno"`
|
|
861
|
+ ClrType string `json:"clr_type"`
|
|
862
|
+ ClrWay string `json:"clr_way"`
|
|
863
|
+ CvlservFlag string `json:"cvlserv_flag"`
|
|
864
|
+ Gend string `json:"gend"`
|
|
865
|
+ Insutype string `json:"insutype"`
|
|
866
|
+ MdtrtCertType string `json:"mdtrt_cert_type"`
|
|
867
|
+ MedType string `json:"med_type"`
|
|
868
|
+ Naty string `json:"naty"`
|
|
869
|
+ PsnCashPay float64 `json:"psn_cash_pay"`
|
|
870
|
+ PsnCertType string `json:"psn_cert_type"`
|
|
871
|
+ PsnName string `json:"psn_name"`
|
|
872
|
+ PsnNo string `json:"psn_no"`
|
|
873
|
+ PsnType string `json:"psn_type"`
|
|
874
|
+ } `json:"setlinfo"`
|
|
875
|
+ } `json:"output"`
|
|
876
|
+ RefmsgTime string `json:"refmsg_time"`
|
|
877
|
+ RespondTime string `json:"respond_time"`
|
|
878
|
+ Signtype interface{} `json:"signtype"`
|
|
879
|
+ WarnMsg interface{} `json:"warn_msg"`
|
|
880
|
+}
|
|
881
|
+
|
824
|
882
|
type Custom struct {
|
825
|
883
|
DetItemFeeSumamt string
|
826
|
884
|
Cut string
|
|
@@ -976,7 +1034,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
976
|
1034
|
timeFormat := tempTime.Format("20060102150405")
|
977
|
1035
|
chrgBchno := rand.Intn(100000) + 10000
|
978
|
1036
|
ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
|
979
|
|
- count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
|
|
1037
|
+ //count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
|
980
|
1038
|
department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
|
981
|
1039
|
doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
|
982
|
1040
|
|
|
@@ -992,13 +1050,11 @@ func (c *HisApiController) GetRegisterInfo() {
|
992
|
1050
|
var insutype string
|
993
|
1051
|
var is390 int = 0
|
994
|
1052
|
var is310 int = 0
|
995
|
|
-
|
996
|
1053
|
for _, item := range res.Output.Iinfo {
|
997
|
1054
|
if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
998
|
1055
|
insutypes = append(insutypes, item.Insutype)
|
999
|
1056
|
}
|
1000
|
1057
|
}
|
1001
|
|
-
|
1002
|
1058
|
if len(insutypes) == 1 {
|
1003
|
1059
|
insutype = insutypes[0]
|
1004
|
1060
|
} else {
|
|
@@ -1018,138 +1074,131 @@ func (c *HisApiController) GetRegisterInfo() {
|
1018
|
1074
|
if is310 == 1 {
|
1019
|
1075
|
insutype = "310"
|
1020
|
1076
|
}
|
1021
|
|
- fmt.Println(insutype)
|
|
1077
|
+ api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + IdCardNo + "&insutype=" +
|
|
1078
|
+ insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
|
|
1079
|
+ "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
|
|
1080
|
+ "&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 + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
|
|
1081
|
+ resp, requestErr := http.Get(api)
|
|
1082
|
+ if requestErr != nil {
|
|
1083
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1084
|
+ return
|
|
1085
|
+ }
|
|
1086
|
+ defer resp.Body.Close()
|
|
1087
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
1088
|
+ if ioErr != nil {
|
|
1089
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
1090
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1091
|
+ return
|
|
1092
|
+ }
|
|
1093
|
+ var respJSON map[string]interface{}
|
|
1094
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
1095
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
1096
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1097
|
+ return
|
|
1098
|
+ }
|
1022
|
1099
|
|
1023
|
|
- if count <= 0 {
|
1024
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + IdCardNo + "&insutype=" +
|
1025
|
|
- insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
|
1026
|
|
- "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
|
1027
|
|
- "&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 + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
|
1028
|
|
- resp, requestErr := http.Get(api)
|
1029
|
|
- if requestErr != nil {
|
|
1100
|
+ respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
1101
|
+ userJSONBytes, _ := json.Marshal(respJSON)
|
|
1102
|
+ var res ResultThree
|
|
1103
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1104
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1105
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1106
|
+ return
|
|
1107
|
+ }
|
|
1108
|
+ if res.Infcode == -1 {
|
|
1109
|
+ adminUser := c.GetAdminUserInfo()
|
|
1110
|
+ errlog := &models.HisOrderError{
|
|
1111
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
1112
|
+ Ctime: time.Now().Unix(),
|
|
1113
|
+ Mtime: time.Now().Unix(),
|
|
1114
|
+ ErrMsg: res.ErrMsg,
|
|
1115
|
+ Status: 1,
|
|
1116
|
+ PatientId: id,
|
|
1117
|
+ RecordTime: recordDateTime,
|
|
1118
|
+ Stage: 2,
|
|
1119
|
+ }
|
|
1120
|
+ service.CreateErrMsgLog(errlog)
|
|
1121
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1122
|
+ "failed_code": -10,
|
|
1123
|
+ "msg": res.ErrMsg,
|
|
1124
|
+ })
|
|
1125
|
+ return
|
|
1126
|
+ //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterTwoException)
|
|
1127
|
+ //return
|
|
1128
|
+ }
|
|
1129
|
+
|
|
1130
|
+ his.Number = res.Output.Data.MdtrtID
|
|
1131
|
+ his.PsnNo = res.Output.Data.PsnNo
|
|
1132
|
+ his.IptOtpNo = res.Output.Data.IptOtpNo
|
|
1133
|
+ his.IdCardNo = patient.IdCardNo
|
|
1134
|
+ his.PhoneNumber = patient.Phone
|
|
1135
|
+ his.UserOrgId = adminInfo.CurrentOrgId
|
|
1136
|
+ his.Ctime = time.Now().Unix()
|
|
1137
|
+ his.Mtime = time.Now().Unix()
|
|
1138
|
+ his.Status = 1
|
|
1139
|
+ err := service.CreateHisPatientTwo(&his)
|
|
1140
|
+ if err == nil {
|
|
1141
|
+ api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
|
1142
|
+ "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
|
1143
|
+ "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + reg_type + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
|
1144
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
|
|
1145
|
+ resp2, requestErr2 := http.Get(api2)
|
|
1146
|
+ if requestErr2 != nil {
|
1030
|
1147
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1031
|
1148
|
return
|
1032
|
1149
|
}
|
1033
|
|
- defer resp.Body.Close()
|
1034
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
1035
|
|
- if ioErr != nil {
|
1036
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
1150
|
+ body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
|
1151
|
+ if ioErr2 != nil {
|
|
1152
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
1037
|
1153
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1038
|
1154
|
return
|
1039
|
1155
|
}
|
1040
|
|
- var respJSON map[string]interface{}
|
1041
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
1156
|
+ var respJSON2 map[string]interface{}
|
|
1157
|
+ if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
1042
|
1158
|
utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
1043
|
1159
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1044
|
1160
|
return
|
1045
|
1161
|
}
|
|
1162
|
+ respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
1163
|
+ userJSONBytes2, _ := json.Marshal(respJSON2)
|
1046
|
1164
|
|
1047
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
1048
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
1049
|
|
- var res ResultThree
|
1050
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1165
|
+ var res2 ResultSix
|
|
1166
|
+ if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
1051
|
1167
|
utils.ErrorLog("解析失败:%v", err)
|
1052
|
1168
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1053
|
1169
|
return
|
1054
|
1170
|
}
|
1055
|
|
- if res.Infcode == -1 {
|
|
1171
|
+ if res2.Infcode == -1 {
|
1056
|
1172
|
adminUser := c.GetAdminUserInfo()
|
1057
|
1173
|
errlog := &models.HisOrderError{
|
1058
|
1174
|
UserOrgId: adminUser.CurrentOrgId,
|
1059
|
1175
|
Ctime: time.Now().Unix(),
|
1060
|
1176
|
Mtime: time.Now().Unix(),
|
1061
|
|
- ErrMsg: res.ErrMsg,
|
|
1177
|
+ ErrMsg: res2.ErrMsg,
|
1062
|
1178
|
Status: 1,
|
1063
|
1179
|
PatientId: id,
|
1064
|
1180
|
RecordTime: recordDateTime,
|
1065
|
|
- Stage: 2,
|
|
1181
|
+ Stage: 3,
|
1066
|
1182
|
}
|
1067
|
1183
|
service.CreateErrMsgLog(errlog)
|
1068
|
1184
|
c.ServeSuccessJSON(map[string]interface{}{
|
1069
|
1185
|
"failed_code": -10,
|
1070
|
|
- "msg": res.ErrMsg,
|
|
1186
|
+ "msg": res2.ErrMsg,
|
1071
|
1187
|
})
|
1072
|
1188
|
return
|
1073
|
|
- //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterTwoException)
|
1074
|
|
- //return
|
1075
|
|
- }
|
1076
|
|
-
|
1077
|
|
- his.Number = res.Output.Data.MdtrtID
|
1078
|
|
- his.PsnNo = res.Output.Data.PsnNo
|
1079
|
|
- his.IptOtpNo = res.Output.Data.IptOtpNo
|
1080
|
|
- his.IdCardNo = patient.IdCardNo
|
1081
|
|
- his.PhoneNumber = patient.Phone
|
1082
|
|
- his.UserOrgId = adminInfo.CurrentOrgId
|
1083
|
|
- his.Ctime = time.Now().Unix()
|
1084
|
|
- his.Mtime = time.Now().Unix()
|
1085
|
|
- his.Status = 1
|
1086
|
|
- err := service.CreateHisPatientTwo(&his)
|
1087
|
|
- if err == nil {
|
1088
|
|
- api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
1089
|
|
- "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
1090
|
|
- "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + reg_type + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
1091
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
|
1092
|
|
- resp2, requestErr2 := http.Get(api2)
|
1093
|
|
- if requestErr2 != nil {
|
1094
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1095
|
|
- return
|
1096
|
|
- }
|
1097
|
|
- body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
1098
|
|
- if ioErr2 != nil {
|
1099
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
1100
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1101
|
|
- return
|
1102
|
|
- }
|
1103
|
|
- var respJSON2 map[string]interface{}
|
1104
|
|
- if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
1105
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
1106
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1107
|
|
- return
|
1108
|
|
- }
|
1109
|
|
- respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
1110
|
|
- userJSONBytes2, _ := json.Marshal(respJSON2)
|
1111
|
|
-
|
1112
|
|
- var res2 ResultSix
|
1113
|
|
- if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
1114
|
|
- utils.ErrorLog("解析失败:%v", err)
|
1115
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1116
|
|
- return
|
1117
|
|
- }
|
1118
|
|
- if res2.Infcode == -1 {
|
1119
|
|
- adminUser := c.GetAdminUserInfo()
|
1120
|
|
- errlog := &models.HisOrderError{
|
1121
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
1122
|
|
- Ctime: time.Now().Unix(),
|
1123
|
|
- Mtime: time.Now().Unix(),
|
1124
|
|
- ErrMsg: res2.ErrMsg,
|
1125
|
|
- Status: 1,
|
1126
|
|
- PatientId: id,
|
1127
|
|
- RecordTime: recordDateTime,
|
1128
|
|
- Stage: 3,
|
1129
|
|
- }
|
1130
|
|
- service.CreateErrMsgLog(errlog)
|
1131
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
1132
|
|
- "failed_code": -10,
|
1133
|
|
- "msg": res2.ErrMsg,
|
1134
|
|
- })
|
1135
|
|
- return
|
1136
|
|
-
|
1137
|
|
- } else {
|
1138
|
|
-
|
1139
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
1140
|
|
- "his_info": his,
|
1141
|
|
- })
|
1142
|
|
- }
|
1143
|
1189
|
|
1144
|
1190
|
} else {
|
1145
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1146
|
|
- return
|
|
1191
|
+
|
|
1192
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1193
|
+ "his_info": his,
|
|
1194
|
+ })
|
1147
|
1195
|
}
|
1148
|
1196
|
|
1149
|
1197
|
} else {
|
1150
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
|
|
1198
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1151
|
1199
|
return
|
1152
|
1200
|
}
|
|
1201
|
+
|
1153
|
1202
|
} else {
|
1154
|
1203
|
adminUser := c.GetAdminUserInfo()
|
1155
|
1204
|
errlog := &models.HisOrderError{
|
|
@@ -1368,8 +1417,8 @@ func (c *HisApiController) GetUploadInfo() {
|
1368
|
1417
|
SettleType: settle_accounts_type,
|
1369
|
1418
|
SettleStartTime: start_time,
|
1370
|
1419
|
SettleEndTime: end_time,
|
1371
|
|
- Creator: roles.ID,
|
1372
|
|
- Modify: roles.ID,
|
|
1420
|
+ Creator: roles.AdminUserId,
|
|
1421
|
+ Modify: roles.AdminUserId,
|
1373
|
1422
|
}
|
1374
|
1423
|
err = service.CreateOrder(order)
|
1375
|
1424
|
if err != nil {
|
|
@@ -1529,6 +1578,12 @@ func (c *HisApiController) GetUploadInfo() {
|
1529
|
1578
|
fmt.Println(respJSON)
|
1530
|
1579
|
respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
1531
|
1580
|
userJSONBytes, _ := json.Marshal(respJSON)
|
|
1581
|
+
|
|
1582
|
+ respJSON2 := respJSON["data"].(map[string]interface{})["pre2"].(map[string]interface{})
|
|
1583
|
+ userJSONBytes2, _ := json.Marshal(respJSON2)
|
|
1584
|
+
|
|
1585
|
+ src_request := string(userJSONBytes2)
|
|
1586
|
+
|
1532
|
1587
|
var res ResultSeven
|
1533
|
1588
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
1534
|
1589
|
utils.ErrorLog("解析失败:%v", err)
|
|
@@ -1595,7 +1650,8 @@ func (c *HisApiController) GetUploadInfo() {
|
1595
|
1650
|
order.ClrOptins = res.Output.Setlinfo.ClrOptins
|
1596
|
1651
|
order.ClrWay = res.Output.Setlinfo.ClrWay
|
1597
|
1652
|
order.Creator = order.Creator
|
1598
|
|
- order.Modify = roles.ID
|
|
1653
|
+ order.Modify = roles.AdminUserId
|
|
1654
|
+ order.RequestLog = src_request
|
1599
|
1655
|
setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
1600
|
1656
|
detailStr := string(setlDetail)
|
1601
|
1657
|
order.SetlDetail = detailStr
|
|
@@ -2560,35 +2616,26 @@ func (c *HisApiController) GetSettleInfo() {
|
2560
|
2616
|
func (c *HisApiController) Refund() {
|
2561
|
2617
|
order_id, _ := c.GetInt64("order_id")
|
2562
|
2618
|
admin_user_id, _ := c.GetInt64("admin_user_id")
|
2563
|
|
-
|
2564
|
|
- number := c.GetString("number")
|
2565
|
2619
|
record_time := c.GetString("record_time")
|
2566
|
2620
|
patient_id, _ := c.GetInt64("patient_id")
|
2567
|
2621
|
timeLayout := "2006-01-02"
|
2568
|
2622
|
loc, _ := time.LoadLocation("Local")
|
2569
|
2623
|
adminUser := c.GetAdminUserInfo()
|
2570
|
2624
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
2571
|
|
- fmt.Println(err)
|
2572
|
2625
|
if err != nil {
|
2573
|
2626
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2574
|
2627
|
return
|
2575
|
2628
|
}
|
2576
|
2629
|
recordDateTime := theTime.Unix()
|
2577
|
2630
|
his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
2578
|
|
- //patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
2579
|
2631
|
var order models.HisOrder
|
2580
|
2632
|
order, _ = service.GetHisOrderByID(order_id)
|
2581
|
|
-
|
2582
|
2633
|
roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
2583
|
|
-
|
2584
|
2634
|
if order.ID == 0 {
|
2585
|
2635
|
order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
|
2586
|
|
-
|
2587
|
2636
|
}
|
2588
|
|
-
|
2589
|
2637
|
miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2590
|
2638
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2591
|
|
-
|
2592
|
2639
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
2593
|
2640
|
api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + his.PsnNo +
|
2594
|
2641
|
"&mdtrt_id=" + his.Number + "&doctor=" + roles.UserName + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
@@ -2612,65 +2659,69 @@ func (c *HisApiController) Refund() {
|
2612
|
2659
|
}
|
2613
|
2660
|
respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2614
|
2661
|
userJSONBytes, _ := json.Marshal(respJSON)
|
2615
|
|
- fmt.Println(respJSON)
|
2616
|
|
- fmt.Println(userJSONBytes)
|
2617
|
2662
|
|
2618
|
|
- api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
|
2619
|
|
- "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2620
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2621
|
|
- resp2, requestErr2 := http.Get(api2)
|
2622
|
|
- if requestErr2 != nil {
|
2623
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2624
|
|
- return
|
2625
|
|
- }
|
|
2663
|
+ respJSON2 := respJSON["data"].(map[string]interface{})["pre2"].(map[string]interface{})
|
|
2664
|
+ userJSONBytes2, _ := json.Marshal(respJSON2)
|
2626
|
2665
|
|
2627
|
|
- body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
2628
|
|
- if ioErr2 != nil {
|
2629
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
2630
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2631
|
|
- return
|
2632
|
|
- }
|
2633
|
|
- var respJSON2 map[string]interface{}
|
2634
|
|
- if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
2635
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2666
|
+ var res ResultSixteen
|
|
2667
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
2668
|
+ utils.ErrorLog("解析失败:%v", err)
|
2636
|
2669
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2637
|
2670
|
return
|
2638
|
2671
|
}
|
2639
|
|
-
|
2640
|
|
- //api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
|
2641
|
|
- // "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2642
|
|
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2643
|
|
- //resp3, requestErr3 := http.Get(api3)
|
2644
|
|
- //if requestErr3 != nil {
|
2645
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2646
|
|
- // return
|
2647
|
|
- //}
|
2648
|
|
- //
|
2649
|
|
- //body3, ioErr3 := ioutil.ReadAll(resp3.Body)
|
2650
|
|
- //if ioErr3 != nil {
|
2651
|
|
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
|
2652
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2653
|
|
- // return
|
2654
|
|
- //}
|
2655
|
|
- //var respJSON3 map[string]interface{}
|
2656
|
|
- //if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
|
2657
|
|
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2658
|
|
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2659
|
|
- // return
|
2660
|
|
- //}
|
2661
|
|
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
2662
|
|
- //service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
|
2663
|
|
-
|
2664
|
|
- if err == nil {
|
|
2672
|
+ if res.Infcode == 0 {
|
|
2673
|
+ api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
|
|
2674
|
+ "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
2675
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
2676
|
+ resp2, requestErr2 := http.Get(api2)
|
|
2677
|
+ if requestErr2 != nil {
|
|
2678
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2679
|
+ return
|
|
2680
|
+ }
|
|
2681
|
+ body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
|
2682
|
+ if ioErr2 != nil {
|
|
2683
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
|
2684
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2685
|
+ return
|
|
2686
|
+ }
|
|
2687
|
+ var respJSON2 map[string]interface{}
|
|
2688
|
+ if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
|
2689
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2690
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2691
|
+ return
|
|
2692
|
+ }
|
|
2693
|
+ respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
2694
|
+ userJSONBytes, _ := json.Marshal(respJSON)
|
|
2695
|
+ var res2 ResultSix
|
|
2696
|
+ if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
|
2697
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
2698
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2699
|
+ return
|
|
2700
|
+ }
|
|
2701
|
+ if res2.Infcode == 0 {
|
|
2702
|
+ err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, string(userJSONBytes2))
|
|
2703
|
+ if err == nil {
|
|
2704
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2705
|
+ "msg": "退费成功",
|
|
2706
|
+ })
|
|
2707
|
+ } else {
|
|
2708
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2709
|
+ return
|
|
2710
|
+ }
|
|
2711
|
+ } else {
|
|
2712
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2713
|
+ "code": -10,
|
|
2714
|
+ "msg": res2.ErrMsg,
|
|
2715
|
+ })
|
|
2716
|
+ }
|
|
2717
|
+ } else {
|
2665
|
2718
|
c.ServeSuccessJSON(map[string]interface{}{
|
2666
|
|
- "msg": "退费成功",
|
|
2719
|
+ "code": -10,
|
|
2720
|
+ "msg": res.ErrMsg,
|
2667
|
2721
|
})
|
2668
|
|
- } else {
|
2669
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2670
|
|
- return
|
2671
|
2722
|
}
|
2672
|
2723
|
} else {
|
2673
|
|
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
|
2724
|
+ err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, "")
|
2674
|
2725
|
if err == nil {
|
2675
|
2726
|
c.ServeSuccessJSON(map[string]interface{}{
|
2676
|
2727
|
"msg": "退费成功",
|
|
@@ -2802,7 +2853,7 @@ func (c *HisApiController) RefundDetail() {
|
2802
|
2853
|
return
|
2803
|
2854
|
}
|
2804
|
2855
|
|
2805
|
|
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
|
2856
|
+ err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "")
|
2806
|
2857
|
if err == nil {
|
2807
|
2858
|
c.ServeSuccessJSON(map[string]interface{}{
|
2808
|
2859
|
"msg": "退费成功",
|
|
@@ -2812,7 +2863,7 @@ func (c *HisApiController) RefundDetail() {
|
2812
|
2863
|
return
|
2813
|
2864
|
}
|
2814
|
2865
|
} else {
|
2815
|
|
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
|
2866
|
+ err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "")
|
2816
|
2867
|
if err == nil {
|
2817
|
2868
|
c.ServeSuccessJSON(map[string]interface{}{
|
2818
|
2869
|
"msg": "退费成功",
|