|
@@ -57,13 +57,6 @@ func HisManagerApiRegistRouters() {
|
57
|
57
|
|
58
|
58
|
beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
|
59
|
59
|
|
60
|
|
- //beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
|
61
|
|
-
|
62
|
|
- //新增附加费用
|
63
|
|
- //beego.Router("/api/his/additionalcharge", &HisApiController{}, "Post:AdditionalCharge")
|
64
|
|
-
|
65
|
|
- //beego.Router("/api/additionalcharge/get", &HisApiController{}, "Get:GetAdditionalcharge")
|
66
|
|
-
|
67
|
60
|
beego.Router("/api/hisprescription/get", &DialysisApiController{}, "Get:GetLastOrNextHisPrescription")
|
68
|
61
|
|
69
|
62
|
beego.Router("/api/callhisprescription/get", &DialysisApiController{}, "Get:GetCallHisPrescription")
|
|
@@ -2013,11 +2006,82 @@ func (c *HisApiController) GetUploadInfo() {
|
2013
|
2006
|
func (c *HisApiController) Refund() {
|
2014
|
2007
|
order_id, _ := c.GetInt64("order_id")
|
2015
|
2008
|
number := c.GetString("number")
|
|
2009
|
+ record_time := c.GetString("record_time")
|
|
2010
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
2011
|
+
|
|
2012
|
+ timeLayout := "2006-01-02"
|
|
2013
|
+ loc, _ := time.LoadLocation("Local")
|
2016
|
2014
|
|
2017
|
2015
|
adminUser := c.GetAdminUserInfo()
|
|
2016
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
2017
|
+ if err != nil {
|
|
2018
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2019
|
+ return
|
|
2020
|
+ }
|
|
2021
|
+ recordDateTime := theTime.Unix()
|
|
2022
|
+
|
|
2023
|
+ his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
|
2024
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
2025
|
+ patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
|
2026
|
+ order, _ := service.GetHisOrderByID(order_id)
|
|
2027
|
+
|
2018
|
2028
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2019
|
2029
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
|
2030
|
+ api := "http://127.0.0.1:9531/" + "gdyb/nine?psn_no=" + his.PsnNo +
|
|
2031
|
+ "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
2032
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
2033
|
+ resp, requestErr := http.Get(api)
|
|
2034
|
+ if requestErr != nil {
|
|
2035
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2036
|
+ return
|
|
2037
|
+ }
|
|
2038
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
2039
|
+ if ioErr != nil {
|
|
2040
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
2041
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2042
|
+ return
|
|
2043
|
+ }
|
|
2044
|
+ var respJSON map[string]interface{}
|
|
2045
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
2046
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2047
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2048
|
+ return
|
|
2049
|
+ }
|
|
2050
|
+ respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
2051
|
+ userJSONBytes, _ := json.Marshal(respJSON)
|
|
2052
|
+ fmt.Println(respJSON)
|
|
2053
|
+ fmt.Println(userJSONBytes)
|
|
2054
|
+
|
|
2055
|
+ api2 := "http://127.0.0.1:9531/" + "gdyb/six?psn_no=" + his.PsnNo +
|
|
2056
|
+ "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
|
2057
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
2058
|
+ resp2, requestErr2 := http.Get(api2)
|
|
2059
|
+ if requestErr2 != nil {
|
|
2060
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2061
|
+ return
|
|
2062
|
+ }
|
2020
|
2063
|
|
|
2064
|
+ body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
|
2065
|
+ if ioErr2 != nil {
|
|
2066
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
|
2067
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2068
|
+ return
|
|
2069
|
+ }
|
|
2070
|
+ var respJSON2 map[string]interface{}
|
|
2071
|
+ if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
|
2072
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
2073
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2074
|
+ return
|
|
2075
|
+ }
|
|
2076
|
+ err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
|
2077
|
+ if err == nil {
|
|
2078
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2079
|
+ "msg": "退费成功",
|
|
2080
|
+ })
|
|
2081
|
+ } else {
|
|
2082
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2083
|
+ return
|
|
2084
|
+ }
|
2021
|
2085
|
} else {
|
2022
|
2086
|
err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
2023
|
2087
|
if err == nil {
|
|
@@ -2028,9 +2092,7 @@ func (c *HisApiController) Refund() {
|
2028
|
2092
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2029
|
2093
|
return
|
2030
|
2094
|
}
|
2031
|
|
-
|
2032
|
2095
|
}
|
2033
|
|
-
|
2034
|
2096
|
}
|
2035
|
2097
|
|
2036
|
2098
|
func (this *HisApiController) AdditionalCharge() {
|