|
@@ -5,14 +5,11 @@ import (
|
5
|
5
|
"XT_New/models"
|
6
|
6
|
"XT_New/service"
|
7
|
7
|
"XT_New/utils"
|
8
|
|
- "bytes"
|
9
|
8
|
"encoding/json"
|
10
|
9
|
"fmt"
|
11
|
10
|
"github.com/astaxie/beego"
|
12
|
11
|
"github.com/jinzhu/gorm"
|
13
|
|
- "io/ioutil"
|
14
|
12
|
"math/rand"
|
15
|
|
- "net/http"
|
16
|
13
|
"reflect"
|
17
|
14
|
"strconv"
|
18
|
15
|
"strings"
|
|
@@ -74,6 +71,7 @@ func HisManagerApiRegistRouters() {
|
74
|
71
|
beego.Router("/api/dayprescription/get", &HisApiController{}, "get:GetHisDayPrescription")
|
75
|
72
|
|
76
|
73
|
beego.Router("/api/charge/list", &HisApiController{}, "get:GetHisChargePatientList")
|
|
74
|
+ beego.Router("/api/charge/info", &HisApiController{}, "get:GetHisChargePatientInfo")
|
77
|
75
|
|
78
|
76
|
beego.Router("/api/unregister/list", &HisApiController{}, "get:GetHisUnRegisterPatientList")
|
79
|
77
|
|
|
@@ -241,7 +239,7 @@ func (c *HisApiController) GetHisPatientInfo() {
|
241
|
239
|
his_patient_info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
242
|
240
|
xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
|
243
|
241
|
prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
|
244
|
|
- monthPrescriptions, _ := service.GetMonthHisPrescription(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
|
242
|
+ monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
245
|
243
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
246
|
244
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
247
|
245
|
order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
|
|
@@ -2023,7 +2021,7 @@ func (c *HisApiController) GetRegisterInfo() {
|
2023
|
2021
|
medical_care, _ := c.GetInt64("medical_care")
|
2024
|
2022
|
birthday := c.GetString("birthday")
|
2025
|
2023
|
age, _ := c.GetInt64("age")
|
2026
|
|
- id_card := c.GetString("idCard")
|
|
2024
|
+ id_card := c.GetString("id_card")
|
2027
|
2025
|
register_type, _ := c.GetInt64("register")
|
2028
|
2026
|
doctor, _ := c.GetInt64("doctor")
|
2029
|
2027
|
department, _ := c.GetInt64("department")
|
|
@@ -2066,62 +2064,56 @@ func (c *HisApiController) GetRegisterInfo() {
|
2066
|
2064
|
return
|
2067
|
2065
|
}
|
2068
|
2066
|
|
2069
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
|
2070
|
|
-
|
2071
|
|
- if config.IsOpen == 1 {
|
2072
|
|
-
|
2073
|
|
- } else {
|
2074
|
|
- timeStr := time.Now().Format("2006-01-02")
|
2075
|
|
- timeArr := strings.Split(timeStr, "-")
|
2076
|
|
- var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)
|
2077
|
|
-
|
2078
|
|
- his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
|
2079
|
|
- var hisPatient models.XtHisPatient
|
2080
|
|
- if err == gorm.ErrRecordNotFound || his.ID == 0 {
|
2081
|
|
- hisPatient = models.XtHisPatient{
|
2082
|
|
- Name: name,
|
2083
|
|
- Age: age,
|
2084
|
|
- Gender: gender,
|
2085
|
|
- Birthday: birthUnix,
|
2086
|
|
- Phone: phone,
|
2087
|
|
- MedicalTreatmentType: medical_care,
|
2088
|
|
- IdType: certificates,
|
2089
|
|
- IdCardNo: id_card,
|
2090
|
|
- BalanceAccountsType: settlementValue,
|
2091
|
|
- SocialType: social_type,
|
2092
|
|
- MedicalInsuranceNumber: medical_insurance_card,
|
2093
|
|
- RegisterType: register_type,
|
2094
|
|
- RegisterCost: registration_fee,
|
2095
|
|
- TreatmentCost: medical_expenses,
|
2096
|
|
- AdminUserId: adminInfo.AdminUser.Id,
|
2097
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
2098
|
|
- Status: 1,
|
2099
|
|
- RecordDate: recordDateTime,
|
2100
|
|
- IsReturn: 1,
|
2101
|
|
- PatientId: patient.ID,
|
2102
|
|
- Ctime: time.Now().Unix(),
|
2103
|
|
- Mtime: time.Now().Unix(),
|
2104
|
|
- Number: str,
|
2105
|
|
- IdCardType: id_card_type,
|
2106
|
|
- Departments: department,
|
2107
|
|
- Doctor: doctor,
|
2108
|
|
- }
|
2109
|
|
- service.CreateHisPatient(&hisPatient)
|
2110
|
|
-
|
|
2067
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
2068
|
+ timeArr := strings.Split(timeStr, "-")
|
|
2069
|
+ var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)
|
|
2070
|
+
|
|
2071
|
+ his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
|
|
2072
|
+
|
|
2073
|
+ var hisPatient models.XtHisPatient
|
|
2074
|
+ if err == gorm.ErrRecordNotFound || his.ID == 0 {
|
|
2075
|
+ hisPatient = models.XtHisPatient{
|
|
2076
|
+ Name: name,
|
|
2077
|
+ Age: age,
|
|
2078
|
+ Gender: gender,
|
|
2079
|
+ Birthday: birthUnix,
|
|
2080
|
+ Phone: phone,
|
|
2081
|
+ MedicalTreatmentType: medical_care,
|
|
2082
|
+ IdType: certificates,
|
|
2083
|
+ IdCardNo: id_card,
|
|
2084
|
+ BalanceAccountsType: settlementValue,
|
|
2085
|
+ SocialType: social_type,
|
|
2086
|
+ MedicalInsuranceNumber: medical_insurance_card,
|
|
2087
|
+ RegisterType: register_type,
|
|
2088
|
+ RegisterCost: registration_fee,
|
|
2089
|
+ TreatmentCost: medical_expenses,
|
|
2090
|
+ AdminUserId: adminInfo.AdminUser.Id,
|
|
2091
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
2092
|
+ Status: 1,
|
|
2093
|
+ RecordDate: recordDateTime,
|
|
2094
|
+ IsReturn: 1,
|
|
2095
|
+ PatientId: patient.ID,
|
|
2096
|
+ Ctime: time.Now().Unix(),
|
|
2097
|
+ Mtime: time.Now().Unix(),
|
|
2098
|
+ Number: str,
|
|
2099
|
+ IdCardType: id_card_type,
|
|
2100
|
+ Departments: department,
|
|
2101
|
+ Doctor: doctor,
|
2111
|
2102
|
}
|
|
2103
|
+ service.CreateHisPatient(&hisPatient)
|
2112
|
2104
|
c.ServeSuccessJSON(map[string]interface{}{
|
2113
|
2105
|
"his_info": hisPatient,
|
2114
|
2106
|
})
|
2115
|
|
-
|
|
2107
|
+ } else {
|
|
2108
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisRegisterException)
|
|
2109
|
+ return
|
2116
|
2110
|
}
|
2117
|
|
-
|
2118
|
2111
|
}
|
2119
|
2112
|
|
2120
|
2113
|
//上传明细----结算
|
2121
|
2114
|
func (c *HisApiController) GetUploadInfo() {
|
2122
|
2115
|
id, _ := c.GetInt64("id")
|
2123
|
2116
|
record_time := c.GetString("record_time")
|
2124
|
|
-
|
2125
|
2117
|
pay_way, _ := c.GetInt64("pay_way")
|
2126
|
2118
|
pay_price, _ := c.GetFloat("pay_price")
|
2127
|
2119
|
pay_card_no := c.GetString("pay_card_no")
|
|
@@ -2131,9 +2123,9 @@ func (c *HisApiController) GetUploadInfo() {
|
2131
|
2123
|
found_price, _ := c.GetFloat("found_price")
|
2132
|
2124
|
medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
|
2133
|
2125
|
private_price, _ := c.GetFloat("private_price")
|
2134
|
|
-
|
2135
|
2126
|
timeLayout := "2006-01-02"
|
2136
|
2127
|
loc, _ := time.LoadLocation("Local")
|
|
2128
|
+ settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
|
2137
|
2129
|
|
2138
|
2130
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
2139
|
2131
|
if err != nil {
|
|
@@ -2142,449 +2134,208 @@ func (c *HisApiController) GetUploadInfo() {
|
2142
|
2134
|
}
|
2143
|
2135
|
recordDateTime := theTime.Unix()
|
2144
|
2136
|
adminUser := c.GetAdminUserInfo()
|
2145
|
|
- prescriptions, _ := service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2137
|
+ var prescriptions []*models.HisPrescription
|
|
2138
|
+ var start_time int64
|
|
2139
|
+ var end_time int64
|
2146
|
2140
|
|
2147
|
|
- his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2141
|
+ if settle_accounts_type == 1 { //日结
|
|
2142
|
+
|
|
2143
|
+ prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
2148
|
2144
|
|
|
2145
|
+ } else { //月结
|
|
2146
|
+ start_time_str := c.GetString("start_time")
|
|
2147
|
+ end_time_str := c.GetString("end_time")
|
|
2148
|
+ timeLayout := "2006-01-02"
|
|
2149
|
+ loc, _ := time.LoadLocation("Local")
|
|
2150
|
+ theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
|
|
2151
|
+ if err != nil {
|
|
2152
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2153
|
+ return
|
|
2154
|
+ }
|
|
2155
|
+ recordStartTime := theStartTime.Unix()
|
|
2156
|
+ start_time = recordStartTime
|
|
2157
|
+ theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
|
2158
|
+ if err != nil {
|
|
2159
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2160
|
+ return
|
|
2161
|
+ }
|
|
2162
|
+ recordEndTime := theEndTime.Unix()
|
|
2163
|
+ end_time = recordEndTime
|
|
2164
|
+ prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
|
2165
|
+ }
|
|
2166
|
+
|
|
2167
|
+ his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2149
|
2168
|
timestamp := time.Now().Unix()
|
2150
|
2169
|
tempTime := time.Unix(timestamp, 0)
|
2151
|
2170
|
timeFormat := tempTime.Format("20060102150405")
|
2152
|
2171
|
chrgBchno := rand.Intn(100000) + 10000
|
2153
|
2172
|
chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
|
2154
|
|
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2155
|
|
-
|
2156
|
|
- //org, _ := service.GetOrgById(adminUser.CurrentOrgId)
|
2157
|
|
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2158
|
|
- department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
|
2159
|
|
-
|
2160
|
2173
|
strconv.FormatInt(his.PatientId, 10)
|
2161
|
|
- client := &http.Client{}
|
2162
|
|
- data := make(map[string]interface{})
|
2163
|
|
- data["psn_no"] = his.PsnNo
|
2164
|
|
- data["mdtrt_id"] = his.Number
|
2165
|
|
- data["pre"] = prescriptions
|
2166
|
|
- data["chrg_bchno"] = chrg_bchno
|
2167
|
|
- data["org_name"] = miConfig.OrgName
|
2168
|
|
- data["doctor"] = patientPrescription.Doctor
|
2169
|
|
- data["dept"] = patientPrescription.Departments
|
2170
|
|
-
|
2171
|
|
- data["fixmedins_code"] = miConfig.Code
|
2172
|
|
- data["dept_code"] = department.Number
|
2173
|
|
- data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
|
2174
|
|
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
|
2175
|
|
- data["secret_key"] = miConfig.SecretKey
|
2176
|
2174
|
|
2177
|
2175
|
var ids []int64
|
2178
|
|
- //var idsTwo []int64
|
2179
|
|
- //
|
|
2176
|
+
|
2180
|
2177
|
for _, item := range prescriptions {
|
2181
|
2178
|
ids = append(ids, item.ID)
|
2182
|
2179
|
}
|
2183
|
2180
|
|
2184
|
|
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2185
|
|
-
|
2186
|
|
- if config.IsOpen == 1 { //对接了医保,走医保流程
|
2187
|
|
- bytesData, _ := json.Marshal(data)
|
2188
|
|
- req, _ := http.NewRequest("POST", "http://127.0.0.1:9531/"+"gdyb/five", bytes.NewReader(bytesData))
|
2189
|
|
- resp, _ := client.Do(req)
|
2190
|
|
- defer resp.Body.Close()
|
2191
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2192
|
|
- if ioErr != nil {
|
2193
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2194
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2195
|
|
- return
|
|
2181
|
+ var total float64
|
|
2182
|
+ for _, item := range prescriptions {
|
|
2183
|
+ if item.Type == 1 { //药品
|
|
2184
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
2185
|
+ total = total + (subItem.Price * subItem.PrescribingNumber)
|
|
2186
|
+ }
|
2196
|
2187
|
}
|
2197
|
|
- var respJSON map[string]interface{}
|
2198
|
|
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
|
2199
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2200
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2201
|
|
- return
|
|
2188
|
+ if item.Type == 2 { //项目
|
|
2189
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
2190
|
+ total = total + (subItem.Price * float64(subItem.Count))
|
|
2191
|
+ }
|
2202
|
2192
|
}
|
2203
|
2193
|
|
2204
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2205
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2206
|
|
- var res ResultFour
|
2207
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2208
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2209
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2210
|
|
- return
|
|
2194
|
+ for _, subItem := range item.HisAdditionalCharge {
|
|
2195
|
+ total = total + (subItem.Price * float64(subItem.Count))
|
2211
|
2196
|
}
|
|
2197
|
+ }
|
2212
|
2198
|
|
2213
|
|
- if res.Infcode == 0 {
|
2214
|
|
- order := &models.HisOrder{
|
2215
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2216
|
|
- HisPatientId: his.ID,
|
2217
|
|
- PatientId: his.PatientId,
|
2218
|
|
- SettleAccountsDate: recordDateTime,
|
2219
|
|
- Ctime: time.Now().Unix(),
|
2220
|
|
- Mtime: time.Now().Unix(),
|
2221
|
|
- Status: 1,
|
2222
|
|
- Number: chrg_bchno,
|
2223
|
|
- Infcode: res.Infcode,
|
2224
|
|
- WarnMsg: res.WarnMsg,
|
2225
|
|
- Cainfo: res.Cainfo,
|
2226
|
|
- ErrMsg: res.ErrMsg,
|
2227
|
|
- RespondTime: res.RefmsgTime,
|
2228
|
|
- InfRefmsgid: res.InfRefmsgid,
|
2229
|
|
- OrderStatus: 1,
|
2230
|
|
- PayWay: pay_way,
|
2231
|
|
- PayPrice: pay_price,
|
2232
|
|
- PayCardNo: pay_card_no,
|
2233
|
|
- DiscountPrice: discount_price,
|
2234
|
|
- PreferentialPrice: preferential_price,
|
2235
|
|
- RealityPrice: reality_price,
|
2236
|
|
- FoundPrice: found_price,
|
2237
|
|
- MedicalInsurancePrice: medical_insurance_price,
|
2238
|
|
- PrivatePrice: private_price,
|
2239
|
|
- }
|
2240
|
|
- err = service.CreateOrder(order)
|
2241
|
|
- if err != nil {
|
2242
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
2243
|
|
- return
|
2244
|
|
- }
|
|
2199
|
+ allTotal := fmt.Sprintf("%.2f", total)
|
|
2200
|
+ totals, _ := strconv.ParseFloat(allTotal, 64)
|
|
2201
|
+ order := &models.HisOrder{
|
|
2202
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
2203
|
+ HisPatientId: his.ID,
|
|
2204
|
+ PatientId: id,
|
|
2205
|
+ SettleAccountsDate: recordDateTime,
|
|
2206
|
+ Ctime: time.Now().Unix(),
|
|
2207
|
+ Mtime: time.Now().Unix(),
|
|
2208
|
+ Status: 1,
|
|
2209
|
+ OrderStatus: 2,
|
|
2210
|
+ Number: chrg_bchno,
|
|
2211
|
+ MedfeeSumamt: totals,
|
|
2212
|
+ PayWay: pay_way,
|
|
2213
|
+ PayPrice: pay_price,
|
|
2214
|
+ PayCardNo: pay_card_no,
|
|
2215
|
+ DiscountPrice: discount_price,
|
|
2216
|
+ PreferentialPrice: preferential_price,
|
|
2217
|
+ RealityPrice: reality_price,
|
|
2218
|
+ FoundPrice: found_price,
|
|
2219
|
+ MedicalInsurancePrice: medical_insurance_price,
|
|
2220
|
+ PrivatePrice: private_price,
|
|
2221
|
+ SettleEndTime: end_time,
|
|
2222
|
+ SettleStartTime: start_time,
|
|
2223
|
+ SettleType: settle_accounts_type,
|
|
2224
|
+ }
|
|
2225
|
+ err = service.CreateOrder(order)
|
|
2226
|
+ if err != nil {
|
|
2227
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
|
2228
|
+ return
|
|
2229
|
+ }
|
2245
|
2230
|
|
2246
|
|
- for _, item := range res.Output.Result {
|
2247
|
|
- temp := strings.Split(item.FeedetlSn, "-")
|
2248
|
|
- var advice_id int64 = 0
|
2249
|
|
- var project_id int64 = 0
|
2250
|
|
- var types int64 = 0
|
2251
|
|
-
|
2252
|
|
- id, _ := strconv.ParseInt(temp[2], 10, 64)
|
2253
|
|
- types, _ = strconv.ParseInt(temp[1], 10, 64)
|
2254
|
|
-
|
2255
|
|
- if temp[1] == "1" {
|
2256
|
|
- advice_id = id
|
2257
|
|
- project_id = 0
|
2258
|
|
- } else if temp[1] == "2" {
|
2259
|
|
- advice_id = 0
|
2260
|
|
- project_id = id
|
2261
|
|
- }
|
|
2231
|
+ var customs []*Custom
|
|
2232
|
+ for _, item := range prescriptions {
|
2262
|
2233
|
|
2263
|
|
- info := &models.HisOrderInfo{
|
2264
|
|
- OrderNumber: order.Number,
|
2265
|
|
- FeedetlSn: item.FeedetlSn,
|
2266
|
|
- UploadDate: time.Now().Unix(),
|
2267
|
|
- AdviceId: advice_id,
|
2268
|
|
- DetItemFeeSumamt: item.DetItemFeeSumamt,
|
2269
|
|
- Cnt: item.Cnt,
|
2270
|
|
- Pric: float64(item.Pric),
|
2271
|
|
- PatientId: his.PatientId,
|
2272
|
|
- PricUplmtAmt: item.PricUplmtAmt,
|
2273
|
|
- SelfpayProp: item.SelfpayProp,
|
2274
|
|
- FulamtOwnpayAmt: item.FulamtOwnpayAmt,
|
2275
|
|
- OverlmtAmt: item.OverlmtAmt,
|
2276
|
|
- PreselfpayAmt: item.PreselfpayAmt,
|
2277
|
|
- BasMednFlag: item.BasMednFlag,
|
2278
|
|
- MedChrgitmType: item.MedChrgitmType,
|
2279
|
|
- HiNegoDrugFlag: item.HiNegoDrugFlag,
|
2280
|
|
- Status: 1,
|
2281
|
|
- Memo: item.Memo,
|
2282
|
|
- Mtime: time.Now().Unix(),
|
2283
|
|
- InscpScpAmt: item.InscpScpAmt,
|
2284
|
|
- DrtReimFlag: item.DrtReimFlag,
|
2285
|
|
- Ctime: time.Now().Unix(),
|
2286
|
|
- ListSpItemFlag: item.ListSpItemFlag,
|
2287
|
|
- ChldMedcFlag: item.ChldMedcFlag,
|
2288
|
|
- LmtUsedFlag: item.LmtUsedFlag,
|
2289
|
|
- ChrgitmLv: item.ChrgitmLv,
|
2290
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2291
|
|
- HisPatientId: his.ID,
|
2292
|
|
- OrderId: order.ID,
|
2293
|
|
- ProjectId: project_id,
|
2294
|
|
- Type: types,
|
2295
|
|
- }
|
2296
|
|
- service.CreateOrderInfo(info)
|
2297
|
|
- }
|
2298
|
|
- service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
2299
|
|
- service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, chrg_bchno, recordDateTime)
|
2300
|
|
- var total float64
|
2301
|
|
- for _, item := range prescriptions {
|
2302
|
|
- if item.Type == 1 { //药品
|
2303
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
2304
|
|
- total = total + (subItem.Price * subItem.PrescribingNumber)
|
2305
|
|
- }
|
2306
|
|
- }
|
2307
|
|
- if item.Type == 2 { //项目
|
2308
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
2309
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
2310
|
|
- }
|
|
2234
|
+ if item.Type == 1 { //药品
|
|
2235
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
2236
|
+ cus := &Custom{
|
|
2237
|
+ AdviceId: subItem.ID,
|
|
2238
|
+ ProjectId: 0,
|
|
2239
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
|
|
2240
|
+ Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
|
|
2241
|
+ FeedetlSn: subItem.FeedetlSn,
|
|
2242
|
+ Price: fmt.Sprintf("%.2f", subItem.Price),
|
|
2243
|
+ MedListCodg: subItem.MedListCodg,
|
|
2244
|
+ Type: 1,
|
2311
|
2245
|
}
|
|
2246
|
+ customs = append(customs, cus)
|
2312
|
2247
|
}
|
2313
|
|
- org, _ := service.GetOrgById(adminUser.CurrentOrgId)
|
2314
|
|
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
2315
|
|
- allTotal := fmt.Sprintf("%.2f", total)
|
2316
|
|
- if res.Infcode == 0 {
|
2317
|
|
- var rf []*ResultFive
|
2318
|
|
- json.Unmarshal([]byte(his.Iinfo), &rf)
|
2319
|
|
- psn_no := his.PsnNo
|
2320
|
|
- mdtrt_id := his.Number
|
2321
|
|
- chrg_bchno := chrg_bchno
|
2322
|
|
- cert_no := his.Certno
|
2323
|
|
- insutype := rf[0].Insutype
|
2324
|
|
- api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
|
2325
|
|
- insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
|
2326
|
|
- "&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2327
|
|
- resp, requestErr := http.Get(api)
|
2328
|
|
-
|
2329
|
|
- if requestErr != nil {
|
2330
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2331
|
|
- return
|
2332
|
|
- }
|
2333
|
|
- defer resp.Body.Close()
|
2334
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2335
|
|
- if ioErr != nil {
|
2336
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2337
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2338
|
|
- return
|
2339
|
|
- }
|
2340
|
|
- var respJSON map[string]interface{}
|
2341
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2342
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2343
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2344
|
|
- return
|
2345
|
|
- }
|
2346
|
|
- fmt.Println(respJSON)
|
2347
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2348
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2349
|
|
- var res ResultSeven
|
2350
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
2351
|
|
- utils.ErrorLog("解析失败:%v", err)
|
2352
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2353
|
|
- return
|
2354
|
|
- }
|
2355
|
|
- if res.Infcode == -1 {
|
2356
|
|
- errlog := &models.HisOrderError{
|
2357
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2358
|
|
- Ctime: time.Now().Unix(),
|
2359
|
|
- Mtime: time.Now().Unix(),
|
2360
|
|
- Number: chrg_bchno,
|
2361
|
|
- ErrMsg: res.ErrMsg,
|
2362
|
|
- Status: 1,
|
2363
|
|
- PatientId: id,
|
2364
|
|
- RecordTime: recordDateTime,
|
2365
|
|
- Stage: 7,
|
2366
|
|
- }
|
|
2248
|
+ }
|
2367
|
2249
|
|
2368
|
|
- service.CreateErrMsgLog(errlog)
|
2369
|
|
-
|
2370
|
|
- } else {
|
2371
|
|
- order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
2372
|
|
- order.OrderStatus = 2
|
2373
|
|
- order.MdtrtId = res.Output.Setlinfo.MdtrtID
|
2374
|
|
- order.SetlId = res.Output.Setlinfo.SetlID
|
2375
|
|
- order.PsnNo = res.Output.Setlinfo.PsnNo
|
2376
|
|
- order.PsnName = res.Output.Setlinfo.PsnName
|
2377
|
|
- order.PsnCertType = res.Output.Setlinfo.PsnCertType
|
2378
|
|
- order.Certno = res.Output.Setlinfo.Certno
|
2379
|
|
- order.Gend = res.Output.Setlinfo.Gend
|
2380
|
|
- order.Naty = res.Output.Setlinfo.Naty
|
2381
|
|
- order.Age = res.Output.Setlinfo.Age
|
2382
|
|
- order.Insutype = res.Output.Setlinfo.Insutype
|
2383
|
|
- order.PsnType = res.Output.Setlinfo.PsnType
|
2384
|
|
- order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
|
2385
|
|
- order.SetlTime = res.Output.Setlinfo.SetlTime
|
2386
|
|
- order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
|
2387
|
|
- order.MedType = res.Output.Setlinfo.MedType
|
2388
|
|
- order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
|
2389
|
|
- order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
|
2390
|
|
- order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
|
2391
|
|
- order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
|
2392
|
|
- order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
|
2393
|
|
- order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
|
2394
|
|
- order.HifpPay = res.Output.Setlinfo.HifpPay
|
2395
|
|
- order.CvlservPay = res.Output.Setlinfo.CvlservPay
|
2396
|
|
- order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
|
2397
|
|
- order.HifesPay = res.Output.Setlinfo.HifesPay
|
2398
|
|
- order.HifobPay = res.Output.Setlinfo.HifobPay
|
2399
|
|
- order.MafPay = res.Output.Setlinfo.MafPay
|
2400
|
|
- order.OthPay = res.Output.Setlinfo.OthPay
|
2401
|
|
- order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
|
2402
|
|
- order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
|
2403
|
|
- order.AcctPay = res.Output.Setlinfo.AcctPay
|
2404
|
|
- order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
|
2405
|
|
- order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
|
2406
|
|
- order.Balc = res.Output.Setlinfo.Balc
|
2407
|
|
- order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
|
2408
|
|
- order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
|
2409
|
|
- order.ClrOptins = res.Output.Setlinfo.ClrOptins
|
2410
|
|
- order.ClrWay = res.Output.Setlinfo.ClrWay
|
2411
|
|
- setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
2412
|
|
- detailStr := string(setlDetail)
|
2413
|
|
- order.SetlDetail = detailStr
|
2414
|
|
- err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
2415
|
|
- err = service.UpDateOrder(order)
|
2416
|
|
- if err == nil {
|
2417
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2418
|
|
- "msg": "结算成功",
|
2419
|
|
- })
|
2420
|
|
- }
|
|
2250
|
+ if item.Type == 2 { //项目
|
|
2251
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
2252
|
+
|
|
2253
|
+ cus := &Custom{
|
|
2254
|
+ AdviceId: 0,
|
|
2255
|
+ ProjectId: subItem.ID,
|
|
2256
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
|
|
2257
|
+ Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
|
|
2258
|
+ FeedetlSn: subItem.FeedetlSn,
|
|
2259
|
+ Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
|
|
2260
|
+ MedListCodg: subItem.MedListCodg,
|
|
2261
|
+ Type: 2,
|
2421
|
2262
|
}
|
2422
|
|
- } else {
|
2423
|
2263
|
|
|
2264
|
+ customs = append(customs, cus)
|
2424
|
2265
|
}
|
2425
|
|
-
|
2426
|
|
- } else {
|
2427
|
|
-
|
2428
|
2266
|
}
|
2429
|
2267
|
|
2430
|
|
- } else {
|
2431
|
|
- var total float64
|
2432
|
|
- for _, item := range prescriptions {
|
2433
|
|
- if item.Type == 1 { //药品
|
2434
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
2435
|
|
- total = total + (subItem.Price * subItem.PrescribingNumber)
|
2436
|
|
- }
|
2437
|
|
- }
|
2438
|
|
- if item.Type == 2 { //项目
|
2439
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
2440
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
2441
|
|
- }
|
2442
|
|
- }
|
2443
|
|
-
|
2444
|
|
- for _, subItem := range item.HisAdditionalCharge {
|
2445
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
|
2268
|
+ for _, item := range item.HisAdditionalCharge {
|
|
2269
|
+ cus := &Custom{
|
|
2270
|
+ ItemId: item.ID,
|
|
2271
|
+ AdviceId: 0,
|
|
2272
|
+ ProjectId: 0,
|
|
2273
|
+ DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
|
2274
|
+ Cut: fmt.Sprintf("%.2f", float64(item.Count)),
|
|
2275
|
+ FeedetlSn: item.FeedetlSn,
|
|
2276
|
+ Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
|
2277
|
+ MedListCodg: item.XtHisAddtionConfig.Code,
|
|
2278
|
+ Type: 3,
|
2446
|
2279
|
}
|
2447
|
|
- }
|
2448
|
2280
|
|
2449
|
|
- allTotal := fmt.Sprintf("%.2f", total)
|
2450
|
|
- totals, _ := strconv.ParseFloat(allTotal, 64)
|
2451
|
|
- order := &models.HisOrder{
|
2452
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2453
|
|
- HisPatientId: his.ID,
|
2454
|
|
- PatientId: id,
|
2455
|
|
- SettleAccountsDate: recordDateTime,
|
2456
|
|
- Ctime: time.Now().Unix(),
|
2457
|
|
- Mtime: time.Now().Unix(),
|
2458
|
|
- Status: 1,
|
2459
|
|
- OrderStatus: 2,
|
2460
|
|
- Number: chrg_bchno,
|
2461
|
|
- MedfeeSumamt: totals,
|
2462
|
|
- PayWay: pay_way,
|
2463
|
|
- PayPrice: pay_price,
|
2464
|
|
- PayCardNo: pay_card_no,
|
2465
|
|
- DiscountPrice: discount_price,
|
2466
|
|
- PreferentialPrice: preferential_price,
|
2467
|
|
- RealityPrice: reality_price,
|
2468
|
|
- FoundPrice: found_price,
|
2469
|
|
- MedicalInsurancePrice: medical_insurance_price,
|
2470
|
|
- PrivatePrice: private_price,
|
2471
|
|
- }
|
2472
|
|
- err = service.CreateOrder(order)
|
2473
|
|
- if err != nil {
|
2474
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
|
2475
|
|
- return
|
|
2281
|
+ customs = append(customs, cus)
|
2476
|
2282
|
}
|
2477
|
2283
|
|
2478
|
|
- var customs []*Custom
|
2479
|
|
- for _, item := range prescriptions {
|
2480
|
|
-
|
2481
|
|
- if item.Type == 1 { //药品
|
2482
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
2483
|
|
- cus := &Custom{
|
2484
|
|
- AdviceId: subItem.ID,
|
2485
|
|
- ProjectId: 0,
|
2486
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
|
2487
|
|
- Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
|
2488
|
|
- FeedetlSn: subItem.FeedetlSn,
|
2489
|
|
- Price: fmt.Sprintf("%.2f", subItem.Price),
|
2490
|
|
- MedListCodg: subItem.MedListCodg,
|
2491
|
|
- Type: 1,
|
2492
|
|
- }
|
2493
|
|
- customs = append(customs, cus)
|
2494
|
|
- }
|
2495
|
|
- }
|
2496
|
|
-
|
2497
|
|
- if item.Type == 2 { //项目
|
2498
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
2499
|
|
-
|
2500
|
|
- cus := &Custom{
|
2501
|
|
- AdviceId: 0,
|
2502
|
|
- ProjectId: subItem.ID,
|
2503
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
|
2504
|
|
- Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
|
2505
|
|
- FeedetlSn: subItem.FeedetlSn,
|
2506
|
|
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
|
2507
|
|
- MedListCodg: subItem.MedListCodg,
|
2508
|
|
- Type: 2,
|
2509
|
|
- }
|
|
2284
|
+ }
|
2510
|
2285
|
|
2511
|
|
- customs = append(customs, cus)
|
2512
|
|
- }
|
2513
|
|
- }
|
|
2286
|
+ for _, item := range customs {
|
|
2287
|
+ var advice_id int64 = 0
|
|
2288
|
+ var project_id int64 = 0
|
|
2289
|
+ var item_id int64 = 0
|
2514
|
2290
|
|
2515
|
|
- for _, item := range item.HisAdditionalCharge {
|
2516
|
|
- cus := &Custom{
|
2517
|
|
- ItemId: item.ID,
|
2518
|
|
- AdviceId: 0,
|
2519
|
|
- ProjectId: 0,
|
2520
|
|
- DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
|
2521
|
|
- Cut: fmt.Sprintf("%.2f", float64(item.Count)),
|
2522
|
|
- FeedetlSn: item.FeedetlSn,
|
2523
|
|
- Price: fmt.Sprintf("%.2f", float64(item.Price)),
|
2524
|
|
- MedListCodg: item.XtHisAddtionConfig.Code,
|
2525
|
|
- Type: 3,
|
2526
|
|
- }
|
|
2291
|
+ var types int64 = 0
|
2527
|
2292
|
|
2528
|
|
- customs = append(customs, cus)
|
2529
|
|
- }
|
|
2293
|
+ if item.Type == 1 {
|
|
2294
|
+ advice_id = item.AdviceId
|
|
2295
|
+ project_id = 0
|
|
2296
|
+ item_id = 0
|
|
2297
|
+ } else if item.Type == 2 {
|
|
2298
|
+ advice_id = 0
|
|
2299
|
+ item_id = 0
|
2530
|
2300
|
|
|
2301
|
+ project_id = item.ProjectId
|
|
2302
|
+ } else if item.Type == 3 {
|
|
2303
|
+ advice_id = 0
|
|
2304
|
+ item_id = item.ItemId
|
|
2305
|
+ project_id = 0
|
2531
|
2306
|
}
|
2532
|
2307
|
|
2533
|
|
- for _, item := range customs {
|
2534
|
|
- var advice_id int64 = 0
|
2535
|
|
- var project_id int64 = 0
|
2536
|
|
- var item_id int64 = 0
|
2537
|
|
-
|
2538
|
|
- var types int64 = 0
|
2539
|
|
-
|
2540
|
|
- if item.Type == 1 {
|
2541
|
|
- advice_id = item.AdviceId
|
2542
|
|
- project_id = 0
|
2543
|
|
- item_id = 0
|
2544
|
|
- } else if item.Type == 2 {
|
2545
|
|
- advice_id = 0
|
2546
|
|
- item_id = 0
|
2547
|
|
-
|
2548
|
|
- project_id = item.ProjectId
|
2549
|
|
- } else if item.Type == 3 {
|
2550
|
|
- advice_id = 0
|
2551
|
|
- item_id = item.ItemId
|
2552
|
|
- project_id = 0
|
2553
|
|
- }
|
2554
|
|
-
|
2555
|
|
- detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
|
2556
|
|
- cut, _ := strconv.ParseFloat(item.Cut, 32)
|
2557
|
|
- pric, _ := strconv.ParseFloat(item.Price, 32)
|
2558
|
|
-
|
2559
|
|
- info := &models.HisOrderInfo{
|
2560
|
|
- OrderNumber: order.Number,
|
2561
|
|
- UploadDate: time.Now().Unix(),
|
2562
|
|
- AdviceId: advice_id,
|
2563
|
|
- DetItemFeeSumamt: detItemFeeSumamt,
|
2564
|
|
- Cnt: cut,
|
2565
|
|
- Pric: pric,
|
2566
|
|
- PatientId: id,
|
2567
|
|
- Status: 1,
|
2568
|
|
- Mtime: time.Now().Unix(),
|
2569
|
|
- Ctime: time.Now().Unix(),
|
2570
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
2571
|
|
- HisPatientId: his.ID,
|
2572
|
|
- OrderId: order.ID,
|
2573
|
|
- ProjectId: project_id,
|
2574
|
|
- Type: types,
|
2575
|
|
- ItemId: item_id,
|
2576
|
|
- }
|
2577
|
|
- service.CreateOrderInfo(info)
|
2578
|
|
- }
|
2579
|
|
- //err := service.UpDateAddtionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
2580
|
|
- err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
2581
|
|
- err = service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime)
|
2582
|
|
- err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
2583
|
|
- if err == nil {
|
2584
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2585
|
|
- "msg": "结算成功",
|
2586
|
|
- })
|
|
2308
|
+ detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
|
|
2309
|
+ cut, _ := strconv.ParseFloat(item.Cut, 32)
|
|
2310
|
+ pric, _ := strconv.ParseFloat(item.Price, 32)
|
|
2311
|
+
|
|
2312
|
+ info := &models.HisOrderInfo{
|
|
2313
|
+ OrderNumber: order.Number,
|
|
2314
|
+ UploadDate: time.Now().Unix(),
|
|
2315
|
+ AdviceId: advice_id,
|
|
2316
|
+ DetItemFeeSumamt: detItemFeeSumamt,
|
|
2317
|
+ Cnt: cut,
|
|
2318
|
+ Pric: pric,
|
|
2319
|
+ PatientId: id,
|
|
2320
|
+ Status: 1,
|
|
2321
|
+ Mtime: time.Now().Unix(),
|
|
2322
|
+ Ctime: time.Now().Unix(),
|
|
2323
|
+ UserOrgId: adminUser.CurrentOrgId,
|
|
2324
|
+ HisPatientId: his.ID,
|
|
2325
|
+ OrderId: order.ID,
|
|
2326
|
+ ProjectId: project_id,
|
|
2327
|
+ Type: types,
|
|
2328
|
+ ItemId: item_id,
|
2587
|
2329
|
}
|
|
2330
|
+ service.CreateOrderInfo(info)
|
|
2331
|
+ }
|
|
2332
|
+ err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
|
|
2333
|
+ err = service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime)
|
|
2334
|
+ err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
|
|
2335
|
+ if err == nil {
|
|
2336
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2337
|
+ "msg": "结算成功",
|
|
2338
|
+ })
|
2588
|
2339
|
}
|
2589
|
2340
|
}
|
2590
|
2341
|
|
|
@@ -2756,7 +2507,7 @@ func (this *HisApiController) GetHisDayPrescription() {
|
2756
|
2507
|
end_time := this.GetString("end_time")
|
2757
|
2508
|
endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
2758
|
2509
|
adminUserInfo := this.GetAdminUserInfo()
|
2759
|
|
- dayHisPrescription, err := service.GetMonthHisPrescription(adminUserInfo.CurrentOrgId, patient_id, startime.Unix(), endtime.Unix())
|
|
2510
|
+ dayHisPrescription, err := service.GetMonthHisPrescriptionThree(adminUserInfo.CurrentOrgId, patient_id, startime.Unix(), endtime.Unix())
|
2760
|
2511
|
if err == nil {
|
2761
|
2512
|
this.ServeSuccessJSON(map[string]interface{}{
|
2762
|
2513
|
"day_prescription": dayHisPrescription,
|
|
@@ -2781,16 +2532,21 @@ func (c *HisApiController) GetHisChargePatientList() {
|
2781
|
2532
|
adminInfo := c.GetAdminUserInfo()
|
2782
|
2533
|
tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
2783
|
2534
|
var patients []*service.Patients
|
|
2535
|
+ var patients_two []*service.Patients
|
|
2536
|
+
|
2784
|
2537
|
for _, item := range tempPatients {
|
2785
|
2538
|
//过滤掉没挂号的和没开处方的
|
2786
|
2539
|
if item.HisPatient.ID > 0 || len(item.HisPrescription) > 0 {
|
2787
|
2540
|
patients = append(patients, item)
|
2788
|
2541
|
}
|
|
2542
|
+ //过滤掉没挂号的
|
|
2543
|
+ if item.HisPatient.ID > 0 {
|
|
2544
|
+ patients_two = append(patients_two, item)
|
|
2545
|
+ }
|
2789
|
2546
|
}
|
2790
|
|
- //patients_two, _ := service.GetChargeHisPatientListTwo(adminInfo.CurrentOrgId, "", recordDateTime)
|
2791
|
2547
|
c.ServeSuccessJSON(map[string]interface{}{
|
2792
|
|
- "list": patients,
|
2793
|
|
- //"list_two": patients_two,
|
|
2548
|
+ "list": patients,
|
|
2549
|
+ "list_two": patients_two,
|
2794
|
2550
|
})
|
2795
|
2551
|
}
|
2796
|
2552
|
|
|
@@ -2838,3 +2594,60 @@ func RemoveRepeatedPatient(patient []*service.Patients) (newArr []*service.Patie
|
2838
|
2594
|
}
|
2839
|
2595
|
return
|
2840
|
2596
|
}
|
|
2597
|
+
|
|
2598
|
+func (c *HisApiController) GetHisChargePatientInfo() {
|
|
2599
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
2600
|
+ record_date := c.GetString("record_date")
|
|
2601
|
+ number := c.GetString("number")
|
|
2602
|
+
|
|
2603
|
+ start_time := c.GetString("start_time")
|
|
2604
|
+ end_time := c.GetString("end_time")
|
|
2605
|
+
|
|
2606
|
+ timeLayout := "2006-01-02"
|
|
2607
|
+ loc, _ := time.LoadLocation("Local")
|
|
2608
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
2609
|
+ if err != nil {
|
|
2610
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2611
|
+ return
|
|
2612
|
+ }
|
|
2613
|
+ recordDateTime := theTime.Unix()
|
|
2614
|
+
|
|
2615
|
+ startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
2616
|
+ if err != nil {
|
|
2617
|
+
|
|
2618
|
+ }
|
|
2619
|
+ startRecordDateTime := startTime.Unix()
|
|
2620
|
+
|
|
2621
|
+ endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
2622
|
+ if err != nil {
|
|
2623
|
+
|
|
2624
|
+ }
|
|
2625
|
+ endRecordDateTime := endTime.Unix()
|
|
2626
|
+
|
|
2627
|
+ admin := c.GetAdminUserInfo()
|
|
2628
|
+ his_patient_info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2629
|
+ xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
|
|
2630
|
+ prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2631
|
+ monthPrescriptions, _ := service.GetMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
|
2632
|
+ case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2633
|
+ patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2634
|
+ order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
|
|
2635
|
+
|
|
2636
|
+ doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
|
|
2637
|
+ //获取所有科室信息
|
|
2638
|
+ department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
|
|
2639
|
+
|
|
2640
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2641
|
+ "his_info": his_patient_info,
|
|
2642
|
+ "xt_info": xt_patient_info,
|
|
2643
|
+ "prescription": prescriptions,
|
|
2644
|
+ "case_history": case_history,
|
|
2645
|
+ "info": patientPrescriptionInfo,
|
|
2646
|
+ "month_prescriptions": monthPrescriptions,
|
|
2647
|
+ "order": order,
|
|
2648
|
+ "doctors": doctors,
|
|
2649
|
+ "department": department,
|
|
2650
|
+ })
|
|
2651
|
+ return
|
|
2652
|
+
|
|
2653
|
+}
|