|
@@ -57,12 +57,9 @@ 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")
|
|
60
|
+ beego.Router("/api/hisprescription/get", &DialysisApiController{}, "Get:GetLastOrNextHisPrescription")
|
61
|
61
|
|
62
|
|
- //新增附加费用
|
63
|
|
- //beego.Router("/api/his/additionalcharge", &HisApiController{}, "Post:AdditionalCharge")
|
64
|
|
-
|
65
|
|
- //beego.Router("/api/additionalcharge/get", &HisApiController{}, "Get:GetAdditionalcharge")
|
|
62
|
+ beego.Router("/api/callhisprescription/get", &DialysisApiController{}, "Get:GetCallHisPrescription")
|
66
|
63
|
|
67
|
64
|
}
|
68
|
65
|
|
|
@@ -357,7 +354,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
357
|
354
|
s.Status = 1
|
358
|
355
|
s.UserOrgId = adminInfo.CurrentOrgId
|
359
|
356
|
s.RecordDate = recordDateTime
|
360
|
|
- s.StartTime = recordDateTime
|
|
357
|
+ s.StartTime = time.Now().Unix()
|
361
|
358
|
s.Groupno = groupNo
|
362
|
359
|
s.CreatedTime = ctime
|
363
|
360
|
s.UpdatedTime = mtime
|
|
@@ -1304,7 +1301,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1304
|
1301
|
|
1305
|
1302
|
if config.IsOpen == 1 {
|
1306
|
1303
|
|
1307
|
|
- api := "http://127.0.0.1:9531/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
1304
|
+ api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
1308
|
1305
|
resp, requestErr := http.Get(api)
|
1309
|
1306
|
|
1310
|
1307
|
if requestErr != nil {
|
|
@@ -1387,7 +1384,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1387
|
1384
|
doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
|
1388
|
1385
|
|
1389
|
1386
|
if count <= 0 {
|
1390
|
|
- api := "http://127.0.0.1:9531/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
|
|
1387
|
+ api := "http://127.0.0.1:9532/" + "gdyb/two?cert_no=" + patient.IdCardNo + "&insutype=" +
|
1391
|
1388
|
res.Output.Iinfo[0].Insutype + "&psn_no=" + res.Output.Baseinfo.PsnNo +
|
1392
|
1389
|
"&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&ipt_otp_no=" + ipt_otp_no +
|
1393
|
1390
|
"&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
|
|
@@ -1442,7 +1439,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
1442
|
1439
|
diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
|
1443
|
1440
|
|
1444
|
1441
|
if err == nil {
|
1445
|
|
- api := "http://127.0.0.1:9531/" + "gdyb/four?psn_no=" + his.PsnNo +
|
|
1442
|
+ api := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
|
1446
|
1443
|
"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
|
1447
|
1444
|
"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + "11" + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
|
1448
|
1445
|
"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
|
@@ -1602,7 +1599,7 @@ func (c *HisApiController) GetUploadInfo() {
|
1602
|
1599
|
|
1603
|
1600
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
1604
|
1601
|
bytesData, _ := json.Marshal(data)
|
1605
|
|
- req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
|
|
1602
|
+ req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
|
1606
|
1603
|
resp, _ := client.Do(req)
|
1607
|
1604
|
defer resp.Body.Close()
|
1608
|
1605
|
body, ioErr := ioutil.ReadAll(resp.Body)
|
|
@@ -2009,11 +2006,82 @@ func (c *HisApiController) GetUploadInfo() {
|
2009
|
2006
|
func (c *HisApiController) Refund() {
|
2010
|
2007
|
order_id, _ := c.GetInt64("order_id")
|
2011
|
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")
|
2012
|
2014
|
|
2013
|
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
|
+
|
2014
|
2028
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2015
|
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
|
+ }
|
2016
|
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
|
+ }
|
2017
|
2085
|
} else {
|
2018
|
2086
|
err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
|
2019
|
2087
|
if err == nil {
|
|
@@ -2024,9 +2092,7 @@ func (c *HisApiController) Refund() {
|
2024
|
2092
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2025
|
2093
|
return
|
2026
|
2094
|
}
|
2027
|
|
-
|
2028
|
2095
|
}
|
2029
|
|
-
|
2030
|
2096
|
}
|
2031
|
2097
|
|
2032
|
2098
|
func (this *HisApiController) AdditionalCharge() {
|
|
@@ -2115,3 +2181,51 @@ func (this *HisApiController) GetAdminUsers() {
|
2115
|
2181
|
"doctors": doctors,
|
2116
|
2182
|
})
|
2117
|
2183
|
}
|
|
2184
|
+
|
|
2185
|
+func (this *DialysisApiController) GetLastOrNextHisPrescription() {
|
|
2186
|
+ change_type, _ := this.GetInt64("type", 0)
|
|
2187
|
+ record_date := this.GetString("record_time")
|
|
2188
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
|
2189
|
+
|
|
2190
|
+ timeLayout := "2006-01-02"
|
|
2191
|
+ loc, _ := time.LoadLocation("Local")
|
|
2192
|
+ theAdviceRecordTime, _ := time.ParseInLocation(timeLayout, record_date, loc)
|
|
2193
|
+ record_time := theAdviceRecordTime.Unix()
|
|
2194
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
2195
|
+ prescriptions, err := service.GetHisPrescriptionByType(change_type, record_time, adminUserInfo.CurrentOrgId, patient_id)
|
|
2196
|
+ if err == nil {
|
|
2197
|
+ if len(prescriptions) == 0 {
|
|
2198
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceEmpty)
|
|
2199
|
+ return
|
|
2200
|
+ } else {
|
|
2201
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2202
|
+ "prescriptions": prescriptions,
|
|
2203
|
+ })
|
|
2204
|
+ return
|
|
2205
|
+ }
|
|
2206
|
+ } else {
|
|
2207
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2208
|
+ return
|
|
2209
|
+ }
|
|
2210
|
+}
|
|
2211
|
+
|
|
2212
|
+func (this *DialysisApiController) GetCallHisPrescription() {
|
|
2213
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
|
2214
|
+ timeLayout := "2006-01-02"
|
|
2215
|
+ loc, _ := time.LoadLocation("Local")
|
|
2216
|
+ start_time := this.GetString("start_time")
|
|
2217
|
+ startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
2218
|
+ end_time := this.GetString("end_time")
|
|
2219
|
+ endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
2220
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
2221
|
+ prescriptions, err := service.GetCallHisPrescriptions(startime.Unix(), endtime.Unix(), adminUserInfo.CurrentOrgId, patient_id)
|
|
2222
|
+ if err == nil {
|
|
2223
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2224
|
+ "prescriptions": prescriptions,
|
|
2225
|
+ })
|
|
2226
|
+ return
|
|
2227
|
+ } else {
|
|
2228
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2229
|
+ return
|
|
2230
|
+ }
|
|
2231
|
+}
|