|
@@ -5,26 +5,64 @@ import (
|
5
|
5
|
"encoding/json"
|
6
|
6
|
"fmt"
|
7
|
7
|
"gdyb/models"
|
|
8
|
+ "github.com/jinzhu/gorm"
|
8
|
9
|
"io/ioutil"
|
9
|
10
|
"net/http"
|
|
11
|
+ "time"
|
10
|
12
|
)
|
11
|
13
|
|
12
|
|
-func SavePatientMessageInfo() (string, string) {
|
|
14
|
+func UpdateHisPatientStatusTwo(his *models.VMHisPatient) {
|
|
15
|
+ writeDb.Save(&his)
|
|
16
|
+}
|
|
17
|
+
|
|
18
|
+func GetUnSettleHisPrescriptionFiveTen(org_id int64, patient_id int64, record_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
|
|
19
|
+ err = readDb.Model(&models.HisPrescription{}).
|
|
20
|
+ Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
|
|
21
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
|
|
22
|
+ }).
|
|
23
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
24
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
|
|
25
|
+ }).
|
|
26
|
+ Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
27
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
|
|
28
|
+ }).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
|
|
29
|
+ return db.Where("status = 1 AND user_org_id = ? AND order_status <> 3 AND order_status <> 2 ", org_id)
|
|
30
|
+ }).
|
|
31
|
+ Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 and order_status <> 5 AND p_type = ?", org_id, record_date, patient_id, p_type).
|
|
32
|
+ Find(&prescription).Error
|
|
33
|
+ return
|
|
34
|
+}
|
|
35
|
+
|
|
36
|
+func GetUnSettleMonthHisPrescription(org_id int64, patient_id int64, start_date int64, end_date int64) (prescription []*models.HisPrescription, err error) {
|
|
37
|
+ err = readDb.Model(&models.HisPrescription{}).
|
|
38
|
+ Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
|
|
39
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
|
|
40
|
+ }).
|
|
41
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
42
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
|
|
43
|
+ }).
|
|
44
|
+ Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
45
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
|
|
46
|
+ }).
|
|
47
|
+ Where("user_org_id = ? AND status = 1 AND record_date >= ? AND record_date <= ? AND patient_id = ? AND order_status <> 2 AND order_status <> 5 AND p_type <> 1", org_id, start_date, end_date, patient_id).
|
|
48
|
+ Find(&prescription).Error
|
|
49
|
+ return
|
|
50
|
+}
|
|
51
|
+
|
|
52
|
+func GetHisOrderFour(patient_id string, infoSeq string, docId string) (order models.HisOrder, err error) {
|
|
53
|
+ if len(docId) > 0 {
|
|
54
|
+ err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND setl_id = ? AND status = 1", infoSeq, patient_id, docId).First(&order).Error
|
|
55
|
+ } else {
|
|
56
|
+ err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND status = 1 ", infoSeq, patient_id).First(&order).Error
|
|
57
|
+ }
|
|
58
|
+ return
|
|
59
|
+}
|
|
60
|
+
|
|
61
|
+func GetHisPatientForCoordinate(id_card_no string) (string, string) {
|
13
|
62
|
|
14
|
63
|
//input := make(map[string]interface{})
|
15
|
64
|
inputData := make(map[string]interface{})
|
16
|
|
- inputData["patType"] = "1" // 就诊凭证编号
|
17
|
|
- inputData["patIdNo"] = "441701195808152845" // 开始时间
|
18
|
|
- inputData["patName"] = "罗秀云" // 人员姓名
|
19
|
|
-
|
20
|
|
- inputData["patMobile"] = "13535547901" // 人员姓名
|
21
|
|
- inputData["patSex"] = "M" // 人员姓名
|
22
|
|
- inputData["patMarriage"] = "1" // 人员姓名
|
23
|
|
- inputData["birthday"] = "1992-10-23" // 人员姓名
|
24
|
|
- inputData["patAddress"] = "11111" // 人员姓名
|
25
|
|
- inputData["thirdPartyID"] = "16" // 人员姓名
|
26
|
|
- inputData["patAge"] = "11" // 人员姓名
|
27
|
|
- //input["req"] = inputData
|
|
65
|
+ inputData["idcard"] = id_card_no // 就诊凭证编号
|
28
|
66
|
|
29
|
67
|
var inputLog string
|
30
|
68
|
bytesData, err := json.Marshal(inputData)
|
|
@@ -36,7 +74,7 @@ func SavePatientMessageInfo() (string, string) {
|
36
|
74
|
}
|
37
|
75
|
reader := bytes.NewReader(bytesData)
|
38
|
76
|
var url string
|
39
|
|
- gdyb_url := "http://218.104.146.179:9091/esb/listener/savePatientMessageInfo"
|
|
77
|
+ gdyb_url := "http://218.104.146.179:9091/esb/listener/getPatientType"
|
40
|
78
|
url = gdyb_url
|
41
|
79
|
|
42
|
80
|
//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
@@ -65,44 +103,75 @@ func SavePatientMessageInfo() (string, string) {
|
65
|
103
|
return str, inputLog
|
66
|
104
|
|
67
|
105
|
}
|
68
|
|
-
|
69
|
|
-func SaveReg(reg models.Reg) (string, string) {
|
|
106
|
+func UploadPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
|
70
|
107
|
|
71
|
108
|
//input := make(map[string]interface{})
|
72
|
109
|
inputData := make(map[string]interface{})
|
73
|
110
|
|
74
|
|
- inputData["deptId"] = reg.DeptId // 就诊凭证编号
|
75
|
|
- inputData["clinicUnitId"] = "" // 开始时间
|
76
|
|
- inputData["healthCardNo"] = "" // 人员姓名
|
77
|
|
-
|
78
|
|
- inputData["patientId"] = reg.PatientId // 人员姓名
|
79
|
|
- inputData["patientName"] = reg.PatientName // 人员姓名
|
80
|
|
- inputData["idCardNo"] = "" // 人员姓名
|
81
|
|
- inputData["phone"] = "" // 人员姓名
|
82
|
|
- inputData["doctorId"] = reg.DoctorId // 人员姓名
|
83
|
|
- inputData["doctorLevelCode"] = "" // 人员姓名
|
84
|
|
- inputData["regDate"] = reg.RegDate // 人员姓名
|
85
|
|
-
|
86
|
|
- inputData["shiftCode"] = "" // 人员姓名
|
87
|
|
- inputData["startTime"] = "" // 人员姓名
|
88
|
|
- inputData["endTime"] = "" // 人员姓名
|
|
111
|
+ diags := make([]map[string]interface{}, 0)
|
|
112
|
+ //diags := make([]map[string]interface{}, 0)
|
89
|
113
|
|
90
|
|
- inputData["scheduleId"] = "" // 人员姓名
|
91
|
|
- inputData["periodId"] = "" // 人员姓名
|
|
114
|
+ presInfos := make([]map[string]interface{}, 0)
|
92
|
115
|
|
93
|
|
- inputData["svObjectId"] = "" // 人员姓名
|
94
|
|
- inputData["diseaseId"] = "" // 人员姓名
|
95
|
|
- inputData["regFee"] = reg.RegFee // 人员姓名
|
|
116
|
+ for _, item := range info.Diag {
|
|
117
|
+ inputDataDiag := make(map[string]interface{})
|
|
118
|
+ inputDataDiag["vao06"] = item.Vao06
|
|
119
|
+ inputDataDiag["bak02"] = item.Bak02
|
|
120
|
+ diags = append(diags, inputDataDiag)
|
|
121
|
+ }
|
96
|
122
|
|
97
|
|
- inputData["treatFee"] = reg.TreatFee // 人员姓名
|
98
|
|
- inputData["operatorId"] = reg.OperatorId // 人员姓名
|
99
|
|
- inputData["remark"] = "" // 人员姓名
|
|
123
|
+ for _, item := range info.PresInfo {
|
|
124
|
+ inputDataPresInfo := make(map[string]interface{})
|
|
125
|
+ inputDataPresInfo["cbm06"] = item.Cbm06
|
|
126
|
+ inputDataPresInfo["cbm07"] = item.Cbm06
|
|
127
|
+ inputDataPresInfo["cbmid"] = item.Cbmid
|
|
128
|
+ presDetails := make([]map[string]interface{}, 0)
|
|
129
|
+
|
|
130
|
+ for _, subItem := range item.PresDetail {
|
|
131
|
+ inputDataPresDetail := make(map[string]interface{})
|
|
132
|
+ inputDataPresDetail["vaf59"] = subItem.Vaf59
|
|
133
|
+ Items := make([]map[string]interface{}, 0)
|
|
134
|
+ for _, subSubItem := range subItem.Item {
|
|
135
|
+ inputDataItem := make(map[string]interface{})
|
|
136
|
+ inputDataItem["bbx01"] = subSubItem.Bbx01
|
|
137
|
+ inputDataItem["bda01"] = subSubItem.Bda01
|
|
138
|
+ inputDataItem["bby01"] = subSubItem.Bby01
|
|
139
|
+ inputDataItem["bck01b"] = subSubItem.Bck01b
|
|
140
|
+ inputDataItem["bck01d"] = subSubItem.Bck01d
|
|
141
|
+ inputDataItem["bdi01"] = subSubItem.Bdi01
|
|
142
|
+ inputDataItem["rownr"] = subSubItem.Rownr
|
|
143
|
+ inputDataItem["vaf11"] = subSubItem.Vaf11
|
|
144
|
+ inputDataItem["vaf14"] = subSubItem.Vaf14
|
|
145
|
+ inputDataItem["vaf15"] = subSubItem.Vaf15
|
|
146
|
+ inputDataItem["vaf17"] = subSubItem.Vaf17
|
|
147
|
+ inputDataItem["vaf18"] = subSubItem.Vaf18
|
|
148
|
+ inputDataItem["vaf19"] = subSubItem.Vaf19
|
|
149
|
+ inputDataItem["vaf20"] = subSubItem.Vaf20
|
|
150
|
+ inputDataItem["vaf21"] = subSubItem.Vaf21
|
|
151
|
+ inputDataItem["vaf22"] = subSubItem.Vaf22
|
|
152
|
+ inputDataItem["vaf32"] = subSubItem.Vaf32
|
|
153
|
+ inputDataItem["vaf35"] = subSubItem.Vaf35
|
|
154
|
+ inputDataItem["vaf36"] = subSubItem.Vaf36
|
|
155
|
+ inputDataItem["vaf58"] = subSubItem.Vaf58
|
|
156
|
+ inputDataItem["vaf61"] = subSubItem.Vaf61
|
|
157
|
+ Items = append(Items, inputDataItem)
|
|
158
|
+
|
|
159
|
+ }
|
|
160
|
+ inputDataPresDetail["item"] = Items
|
|
161
|
+ presDetails = append(presDetails, inputDataPresDetail)
|
|
162
|
+ }
|
|
163
|
+ inputDataPresInfo["presDetail"] = presDetails
|
|
164
|
+ presInfos = append(presInfos, inputDataPresInfo)
|
|
165
|
+ }
|
100
|
166
|
|
101
|
|
- inputData["orderType"] = "" // 人员姓名
|
102
|
|
- inputData["clinicCode"] = "" // 人员姓名
|
103
|
|
- inputData["infoSeq"] = "" // 人员姓名
|
|
167
|
+ inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
|
|
168
|
+ inputData["Fasong"] = info.Fasong // 就诊凭证编号
|
|
169
|
+ inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
|
|
170
|
+ inputData["bck01c"] = info.Bck01c // 就诊凭证编号
|
|
171
|
+ inputData["bce02a"] = "1001" // 就诊凭证编号
|
104
|
172
|
|
105
|
|
- //input["Request"] = inputData
|
|
173
|
+ inputData["diag"] = diags // 就诊凭证编号
|
|
174
|
+ inputData["presInfo"] = presInfos // 就诊凭证编号
|
106
|
175
|
|
107
|
176
|
var inputLog string
|
108
|
177
|
bytesData, err := json.Marshal(inputData)
|
|
@@ -114,7 +183,7 @@ func SaveReg(reg models.Reg) (string, string) {
|
114
|
183
|
}
|
115
|
184
|
reader := bytes.NewReader(bytesData)
|
116
|
185
|
var url string
|
117
|
|
- gdyb_url := "http://218.104.146.179:9091/esb/listener/saveReg"
|
|
186
|
+ gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
|
118
|
187
|
url = gdyb_url
|
119
|
188
|
|
120
|
189
|
//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
@@ -143,60 +212,76 @@ func SaveReg(reg models.Reg) (string, string) {
|
143
|
212
|
return str, inputLog
|
144
|
213
|
|
145
|
214
|
}
|
146
|
|
-func GetWaitPayDetail() (string, string) {
|
|
215
|
+
|
|
216
|
+func UploadPrescriptionForCoordinateHospital(info models.UploadInfo) (string, string) {
|
147
|
217
|
|
148
|
218
|
//input := make(map[string]interface{})
|
149
|
219
|
inputData := make(map[string]interface{})
|
150
|
220
|
|
151
|
|
- inputData["clinicSeq"] = "30445" // 就诊凭证编号
|
152
|
|
- inputData["prescriptionId"] = "" // 开始时间
|
153
|
|
- inputData["patientId"] = "701822660170096645" // 人员姓名
|
|
221
|
+ diags := make([]map[string]interface{}, 0)
|
|
222
|
+ //diags := make([]map[string]interface{}, 0)
|
154
|
223
|
|
155
|
|
- var inputLog string
|
156
|
|
- bytesData, err := json.Marshal(inputData)
|
157
|
|
- inputLog = string(bytesData)
|
158
|
|
- fmt.Println(string(bytesData))
|
159
|
|
- if err != nil {
|
160
|
|
- fmt.Println(err.Error())
|
161
|
|
- return err.Error(), ""
|
162
|
|
- }
|
163
|
|
- reader := bytes.NewReader(bytesData)
|
164
|
|
- var url string
|
165
|
|
- gdyb_url := "http://218.104.146.179:9091/esb/listener/getWaitPayDetail"
|
166
|
|
- url = gdyb_url
|
|
224
|
+ presInfos := make([]map[string]interface{}, 0)
|
167
|
225
|
|
168
|
|
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
169
|
|
- request, err := http.NewRequest("POST", url, reader)
|
170
|
|
- if err != nil {
|
171
|
|
- fmt.Println(err.Error())
|
172
|
|
- return err.Error(), ""
|
|
226
|
+ for _, item := range info.Diag {
|
|
227
|
+ inputDataDiag := make(map[string]interface{})
|
|
228
|
+ inputDataDiag["vao06"] = item.Vao06
|
|
229
|
+ inputDataDiag["bak02"] = item.Bak02
|
|
230
|
+ diags = append(diags, inputDataDiag)
|
173
|
231
|
}
|
174
|
232
|
|
175
|
|
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
176
|
|
- request.Header.Set("code", "Xmrjyy")
|
177
|
|
-
|
178
|
|
- client := http.Client{}
|
179
|
|
- resp, err := client.Do(request)
|
180
|
|
- if err != nil {
|
181
|
|
- fmt.Println(err.Error())
|
182
|
|
- return err.Error(), ""
|
|
233
|
+ for _, item := range info.PresInfo {
|
|
234
|
+ inputDataPresInfo := make(map[string]interface{})
|
|
235
|
+ inputDataPresInfo["cbm06"] = item.Cbm06
|
|
236
|
+ inputDataPresInfo["cbm07"] = item.Cbm06
|
|
237
|
+ inputDataPresInfo["cbmid"] = item.Cbmid
|
|
238
|
+ presDetails := make([]map[string]interface{}, 0)
|
|
239
|
+
|
|
240
|
+ for _, subItem := range item.PresDetail {
|
|
241
|
+ inputDataPresDetail := make(map[string]interface{})
|
|
242
|
+ inputDataPresDetail["vaf59"] = subItem.Vaf59
|
|
243
|
+ Items := make([]map[string]interface{}, 0)
|
|
244
|
+ for _, subSubItem := range subItem.Item {
|
|
245
|
+ inputDataItem := make(map[string]interface{})
|
|
246
|
+ inputDataItem["bbx01"] = subSubItem.Bbx01
|
|
247
|
+ inputDataItem["bda01"] = subSubItem.Bda01
|
|
248
|
+ inputDataItem["bby01"] = subSubItem.Bby01
|
|
249
|
+ inputDataItem["bck01b"] = subSubItem.Bck01b
|
|
250
|
+ inputDataItem["bck01d"] = subSubItem.Bck01d
|
|
251
|
+ inputDataItem["bdi01"] = subSubItem.Bdi01
|
|
252
|
+ inputDataItem["rownr"] = subSubItem.Rownr
|
|
253
|
+ inputDataItem["vaf11"] = subSubItem.Vaf11
|
|
254
|
+ inputDataItem["vaf14"] = subSubItem.Vaf14
|
|
255
|
+ inputDataItem["vaf15"] = subSubItem.Vaf15
|
|
256
|
+ inputDataItem["vaf17"] = subSubItem.Vaf17
|
|
257
|
+ inputDataItem["vaf18"] = subSubItem.Vaf18
|
|
258
|
+ inputDataItem["vaf19"] = subSubItem.Vaf19
|
|
259
|
+ inputDataItem["vaf20"] = subSubItem.Vaf20
|
|
260
|
+ inputDataItem["vaf21"] = subSubItem.Vaf21
|
|
261
|
+ inputDataItem["vaf22"] = subSubItem.Vaf22
|
|
262
|
+ inputDataItem["vaf32"] = subSubItem.Vaf32
|
|
263
|
+ inputDataItem["vaf35"] = subSubItem.Vaf35
|
|
264
|
+ inputDataItem["vaf36"] = subSubItem.Vaf36
|
|
265
|
+ inputDataItem["vaf58"] = subSubItem.Vaf58
|
|
266
|
+ inputDataItem["vaf61"] = subSubItem.Vaf61
|
|
267
|
+ Items = append(Items, inputDataItem)
|
|
268
|
+
|
|
269
|
+ }
|
|
270
|
+ inputDataPresDetail["item"] = Items
|
|
271
|
+ presDetails = append(presDetails, inputDataPresDetail)
|
|
272
|
+ }
|
|
273
|
+ inputDataPresInfo["presDetail"] = presDetails
|
|
274
|
+ presInfos = append(presInfos, inputDataPresInfo)
|
183
|
275
|
}
|
184
|
|
- respBytes, err := ioutil.ReadAll(resp.Body)
|
185
|
|
- if err != nil {
|
186
|
|
- fmt.Println(err.Error())
|
187
|
|
- return err.Error(), ""
|
188
|
|
- }
|
189
|
|
- fmt.Println(string(respBytes))
|
190
|
|
- str := string(respBytes)
|
191
|
|
- return str, inputLog
|
192
|
276
|
|
193
|
|
-}
|
194
|
|
-func OpKeepAccounts() (string, string) {
|
|
277
|
+ inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
|
|
278
|
+ inputData["Fasong"] = info.Fasong // 就诊凭证编号
|
|
279
|
+ inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
|
|
280
|
+ inputData["bck01c"] = info.Bck01c // 就诊凭证编号
|
|
281
|
+ inputData["bce02a"] = "1001" // 就诊凭证编号
|
195
|
282
|
|
196
|
|
- inputData := make(map[string]interface{})
|
197
|
|
- inputData["inNo"] = "30445" // 就诊凭证编号
|
198
|
|
- inputData["itemCode"] = "240300013-000" // 开始时间
|
199
|
|
- inputData["num"] = "1" // 人员姓名
|
|
283
|
+ inputData["diag"] = diags // 就诊凭证编号
|
|
284
|
+ inputData["presInfo"] = presInfos // 就诊凭证编号
|
200
|
285
|
|
201
|
286
|
var inputLog string
|
202
|
287
|
bytesData, err := json.Marshal(inputData)
|
|
@@ -208,7 +293,7 @@ func OpKeepAccounts() (string, string) {
|
208
|
293
|
}
|
209
|
294
|
reader := bytes.NewReader(bytesData)
|
210
|
295
|
var url string
|
211
|
|
- gdyb_url := "http://218.104.146.179:9091/esb/listener/opKeepAccounts"
|
|
296
|
+ gdyb_url := "http://218.104.146.179:9091/esb/listener/saveOrdInfoIp"
|
212
|
297
|
url = gdyb_url
|
213
|
298
|
|
214
|
299
|
//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
|
@@ -237,53 +322,58 @@ func OpKeepAccounts() (string, string) {
|
237
|
322
|
return str, inputLog
|
238
|
323
|
|
239
|
324
|
}
|
240
|
|
-func OpCancelKeepAccounts() (string, string) {
|
241
|
325
|
|
242
|
|
- input := make(map[string]interface{})
|
243
|
|
- inputData := make(map[string]interface{})
|
|
326
|
+func UpDatePrescriptionNumberForCoordinate(user_org_id int64, ids []int64, number string) (err error) {
|
|
327
|
+ err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id in (?)", user_org_id, ids).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix(), "order_status": 6}).Error
|
|
328
|
+ return
|
|
329
|
+}
|
244
|
330
|
|
245
|
|
- inputData["docId"] = "" // 就诊凭证编号
|
246
|
|
- inputData["operCode"] = "" // 开始时间
|
247
|
|
- inputData["operName"] = "" // 人员姓名
|
|
331
|
+func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
|
|
332
|
+ err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).First(&info).Error
|
|
333
|
+ return
|
248
|
334
|
|
249
|
|
- input["req"] = inputData
|
|
335
|
+}
|
250
|
336
|
|
251
|
|
- var inputLog string
|
252
|
|
- bytesData, err := json.Marshal(input)
|
253
|
|
- inputLog = string(bytesData)
|
254
|
|
- fmt.Println(string(bytesData))
|
255
|
|
- if err != nil {
|
256
|
|
- fmt.Println(err.Error())
|
257
|
|
- return err.Error(), ""
|
258
|
|
- }
|
259
|
|
- reader := bytes.NewReader(bytesData)
|
260
|
|
- var url string
|
261
|
|
- gdyb_url := "http://218.104.146.179:9091/esb/listener/opCancelKeepAccounts"
|
262
|
|
- url = gdyb_url
|
|
337
|
+func FindLastPatientPrescriptionInfoTwoTen(org_id int64, patient_id int64, record_date int64) (info models.HisPrescriptionInfo, err error) {
|
|
338
|
+ err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ?", org_id, record_date, patient_id).Order("record_date desc").First(&info).Error
|
|
339
|
+ return
|
|
340
|
+}
|
263
|
341
|
|
264
|
|
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
|
265
|
|
- request, err := http.NewRequest("POST", url, reader)
|
266
|
|
- if err != nil {
|
267
|
|
- fmt.Println(err.Error())
|
268
|
|
- return err.Error(), ""
|
269
|
|
- }
|
|
342
|
+func GetUnSettleHisPrescriptionFive(org_id int64, patient_id int64, record_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
|
|
343
|
+ err = readDb.Model(&models.HisPrescription{}).
|
|
344
|
+ Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
|
|
345
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
|
|
346
|
+ }).
|
|
347
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
348
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
|
|
349
|
+ }).
|
|
350
|
+ Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
351
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
|
|
352
|
+ }).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
|
|
353
|
+ return db.Where("status = 1 AND user_org_id = ? AND order_status <> 3 AND order_status <> 2 ", org_id)
|
|
354
|
+ }).
|
|
355
|
+ Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 and order_status <> 5 AND p_type = ?", org_id, record_date, patient_id, p_type).
|
|
356
|
+ Find(&prescription).Error
|
|
357
|
+ return
|
|
358
|
+}
|
270
|
359
|
|
271
|
|
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
272
|
|
- request.Header.Set("code", "Xmrjyy")
|
|
360
|
+func UpdataHisPateintTwoTen(his *models.VMHisPatient) {
|
|
361
|
+ writeDb.Save(&his)
|
|
362
|
+}
|
273
|
363
|
|
274
|
|
- client := http.Client{}
|
275
|
|
- resp, err := client.Do(request)
|
276
|
|
- if err != nil {
|
277
|
|
- fmt.Println(err.Error())
|
278
|
|
- return err.Error(), ""
|
279
|
|
- }
|
280
|
|
- respBytes, err := ioutil.ReadAll(resp.Body)
|
281
|
|
- if err != nil {
|
282
|
|
- fmt.Println(err.Error())
|
283
|
|
- return err.Error(), ""
|
284
|
|
- }
|
285
|
|
- fmt.Println(string(respBytes))
|
286
|
|
- str := string(respBytes)
|
287
|
|
- return str, inputLog
|
|
364
|
+func UpDateHisPrescriptionInfoNumberTen(user_org_id int64, id int64, number string, record_time int64, his_patient_id int64) (err error) {
|
|
365
|
+ err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND his_patient_id = ? AND record_date = ?", user_org_id, his_patient_id, record_time).Updates(map[string]interface{}{"batch_number": number, "prescription_status": 3, "mtime": time.Now().Unix()}).Error
|
|
366
|
+
|
|
367
|
+ return
|
|
368
|
+}
|
|
369
|
+
|
|
370
|
+func UpdataOrderStatusThreeTen(number string, user_org_id int64) (err error) {
|
|
371
|
+ err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 5, "mtime": time.Now().Unix()}).Error
|
|
372
|
+ err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 5, "mtime": time.Now().Unix()}).Error
|
|
373
|
+ return
|
|
374
|
+}
|
288
|
375
|
|
|
376
|
+func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
|
|
377
|
+ err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
|
|
378
|
+ return
|
289
|
379
|
}
|