|
@@ -14,78 +14,79 @@ type PharmacyController struct {
|
14
|
14
|
}
|
15
|
15
|
|
16
|
16
|
func PharmacyApiRegistRouters() {
|
17
|
|
- beego.Router("/api/pharmacy/ceshili",&PharmacyController{},"get:Tlili")
|
18
|
|
- beego.Router("/api/pharmacy/todaynumber",&PharmacyController{},"get:TodayNumber")//查询今天的待发药,已发药人数(
|
19
|
|
- beego.Router("/api/pharmacy/waitingdrug",&PharmacyController{},"get:WaitingDrug")//获取当天待发药的所有患者(
|
20
|
|
- beego.Router("/api/pharmacy/issueddrugs",&PharmacyController{},"get:IssuedDrug")//获取当天已发药的所有患者(
|
21
|
|
- beego.Router("/api/pharmacy/getpharmacycontent",&PharmacyController{},"get:GetPharmacyContent")//获取当天该患者的所有信息(
|
22
|
|
- beego.Router("/api/pharmacy/dispensingmedicine",&PharmacyController{},"get:DispensingMedicine")//患者发药按钮点击(
|
23
|
|
- beego.Router("/api/pharmacy/drugwithdrawal",&PharmacyController{},"get:DrugWithdrawal")//退药按钮点击
|
24
|
|
- beego.Router("/api/pharmacy/dispensingdetails",&PharmacyController{},"get:DispensingDetails")//获取发药明细的患者列表(
|
25
|
|
- beego.Router("/api/pharmacy/prescriptiondetails",&PharmacyController{},"get:PrescriptionDetails")//发药明细-详情(
|
26
|
|
- beego.Router("/api/pharmacy/dispensemedicine",&PharmacyController{},"get:DispenseMedicine")//获取当天已发药的药品(
|
27
|
|
- beego.Router("/api/pharmacy/waitingmedicine",&PharmacyController{},"get:WaitingMedicine")//获取当天待发药的药品(
|
28
|
|
- beego.Router("/api/pharmacy/getpatientswithdrugs",&PharmacyController{},"get:GetPatientsWithDrugs")//获取当天该药品的所有患者(
|
29
|
|
- beego.Router("/api/pharmacy/medicinedeparture",&PharmacyController{},"get:MedicineDeparture")//药品发药按钮点击(
|
30
|
|
- beego.Router("/api/pharmacy/getcurrentname",&PharmacyController{},"get:GetCurrentName")//获取当前登录账号的名字(
|
|
17
|
+ beego.Router("/api/pharmacy/ceshili", &PharmacyController{}, "get:Tlili")
|
|
18
|
+ beego.Router("/api/pharmacy/todaynumber", &PharmacyController{}, "get:TodayNumber") //查询今天的待发药,已发药人数(
|
|
19
|
+ beego.Router("/api/pharmacy/waitingdrug", &PharmacyController{}, "get:WaitingDrug") //获取当天待发药的所有患者(
|
|
20
|
+ beego.Router("/api/pharmacy/issueddrugs", &PharmacyController{}, "get:IssuedDrug") //获取当天已发药的所有患者(
|
|
21
|
+ beego.Router("/api/pharmacy/getpharmacycontent", &PharmacyController{}, "get:GetPharmacyContent") //获取当天该患者的所有信息(
|
|
22
|
+ beego.Router("/api/pharmacy/dispensingmedicine", &PharmacyController{}, "get:DispensingMedicine") //患者发药按钮点击(
|
|
23
|
+ beego.Router("/api/pharmacy/drugwithdrawal", &PharmacyController{}, "get:DrugWithdrawal") //退药按钮点击
|
|
24
|
+ beego.Router("/api/pharmacy/dispensingdetails", &PharmacyController{}, "get:DispensingDetails") //获取发药明细的患者列表(
|
|
25
|
+ beego.Router("/api/pharmacy/prescriptiondetails", &PharmacyController{}, "get:PrescriptionDetails") //发药明细-详情(
|
|
26
|
+ beego.Router("/api/pharmacy/dispensemedicine", &PharmacyController{}, "get:DispenseMedicine") //获取当天已发药的药品(
|
|
27
|
+ beego.Router("/api/pharmacy/waitingmedicine", &PharmacyController{}, "get:WaitingMedicine") //获取当天待发药的药品(
|
|
28
|
+ beego.Router("/api/pharmacy/getpatientswithdrugs", &PharmacyController{}, "get:GetPatientsWithDrugs") //获取当天该药品的所有患者(
|
|
29
|
+ beego.Router("/api/pharmacy/medicinedeparture", &PharmacyController{}, "get:MedicineDeparture") //药品发药按钮点击(
|
|
30
|
+ beego.Router("/api/pharmacy/getcurrentname", &PharmacyController{}, "get:GetCurrentName") //获取当前登录账号的名字(
|
31
|
31
|
}
|
32
|
|
-func (this *PharmacyController)Tlili(){
|
33
|
|
- times := this.GetString("time","")
|
|
32
|
+func (this *PharmacyController) Tlili() {
|
|
33
|
+ times := this.GetString("time", "")
|
34
|
34
|
timeLayout := "2006-01-02"
|
35
|
35
|
loc, _ := time.LoadLocation("Local")
|
36
|
|
- var stime,etime int64
|
37
|
|
- if times == ""{
|
38
|
|
- stime,etime = service.GetNowTime()
|
39
|
|
- }else {
|
|
36
|
+ var stime, etime int64
|
|
37
|
+ if times == "" {
|
|
38
|
+ stime, etime = service.GetNowTime()
|
|
39
|
+ } else {
|
40
|
40
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
41
|
41
|
stime = stmp.Unix()
|
42
|
42
|
etime = stime + 86399
|
43
|
43
|
}
|
44
|
|
- //orgid := this.GetAdminUserInfo().CurrentOrgId
|
45
|
|
- service.InitDrugidIsNil(9675,stime,etime)
|
|
44
|
+ orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
45
|
+ service.InitDrugidIsNil(orgid, stime, etime)
|
46
|
46
|
this.ServeSuccessJSON(map[string]interface{}{
|
47
|
47
|
"list": "err",
|
48
|
48
|
})
|
49
|
49
|
return
|
50
|
50
|
}
|
51
|
|
-func (this *PharmacyController)GetCurrentName(){
|
|
51
|
+func (this *PharmacyController) GetCurrentName() {
|
52
|
52
|
create := this.GetAdminUserInfo().AdminUser.Id
|
53
|
53
|
this.ServeSuccessJSON(map[string]interface{}{
|
54
|
54
|
"list": create,
|
55
|
55
|
})
|
56
|
56
|
return
|
57
|
57
|
}
|
|
58
|
+
|
58
|
59
|
//查询今天的待发药,已发药人数
|
59
|
|
-func (this *PharmacyController)TodayNumber(){
|
|
60
|
+func (this *PharmacyController) TodayNumber() {
|
60
|
61
|
var err error
|
61
|
62
|
defer func() {
|
62
|
|
- if err != nil{
|
63
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
63
|
+ if err != nil {
|
|
64
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
64
|
65
|
}
|
65
|
66
|
}()
|
66
|
67
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
67
|
|
- times := this.GetString("time","")
|
|
68
|
+ times := this.GetString("time", "")
|
68
|
69
|
timeLayout := "2006-01-02"
|
69
|
70
|
loc, _ := time.LoadLocation("Local")
|
70
|
|
- var stime,etime int64
|
71
|
|
- if times == ""{
|
72
|
|
- stime,etime = service.GetNowTime()
|
73
|
|
- }else {
|
|
71
|
+ var stime, etime int64
|
|
72
|
+ if times == "" {
|
|
73
|
+ stime, etime = service.GetNowTime()
|
|
74
|
+ } else {
|
74
|
75
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
75
|
76
|
stime = stmp.Unix()
|
76
|
77
|
etime = stime + 86399
|
77
|
78
|
}
|
78
|
79
|
//查询表里当天的数据
|
79
|
80
|
var wtotal int
|
80
|
|
- wtotal,err = service.GetTodayPharmacy(stime,etime,orgid,1)
|
81
|
|
- if err != nil{
|
|
81
|
+ wtotal, err = service.GetTodayPharmacy(stime, etime, orgid, 1)
|
|
82
|
+ if err != nil {
|
82
|
83
|
utils.ErrorLog(err.Error())
|
83
|
84
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
84
|
85
|
return
|
85
|
86
|
}
|
86
|
87
|
var itotal int
|
87
|
|
- itotal,err = service.GetTodayPharmacy(stime,etime,orgid,0)
|
88
|
|
- if err != nil{
|
|
88
|
+ itotal, err = service.GetTodayPharmacy(stime, etime, orgid, 0)
|
|
89
|
+ if err != nil {
|
89
|
90
|
utils.ErrorLog(err.Error())
|
90
|
91
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
91
|
92
|
return
|
|
@@ -96,30 +97,30 @@ func (this *PharmacyController)TodayNumber(){
|
96
|
97
|
})
|
97
|
98
|
return
|
98
|
99
|
}
|
99
|
|
-func (this *PharmacyController)IssuedDrug(){
|
|
100
|
+func (this *PharmacyController) IssuedDrug() {
|
100
|
101
|
var err error
|
101
|
102
|
defer func() {
|
102
|
|
- if err != nil{
|
103
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
103
|
+ if err != nil {
|
|
104
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
104
|
105
|
}
|
105
|
106
|
}()
|
106
|
|
- keyword := this.GetString("keyword","")
|
107
|
|
- times := this.GetString("time","")
|
|
107
|
+ keyword := this.GetString("keyword", "")
|
|
108
|
+ times := this.GetString("time", "")
|
108
|
109
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
109
|
110
|
timeLayout := "2006-01-02"
|
110
|
111
|
loc, _ := time.LoadLocation("Local")
|
111
|
|
- var stime,etime int64
|
112
|
|
- if times == ""{
|
113
|
|
- stime,etime = service.GetNowTime()
|
114
|
|
- }else {
|
|
112
|
+ var stime, etime int64
|
|
113
|
+ if times == "" {
|
|
114
|
+ stime, etime = service.GetNowTime()
|
|
115
|
+ } else {
|
115
|
116
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
116
|
117
|
stime = stmp.Unix()
|
117
|
118
|
etime = stime + 86399
|
118
|
119
|
}
|
119
|
120
|
//查询表里当天的数据
|
120
|
121
|
var flist []*models.TmpPatient
|
121
|
|
- flist,err = service.GetTodayDrug(stime,etime,orgid,1,keyword)
|
122
|
|
- if err != nil{
|
|
122
|
+ flist, err = service.GetTodayDrug(stime, etime, orgid, 1, keyword)
|
|
123
|
+ if err != nil {
|
123
|
124
|
utils.ErrorLog(err.Error())
|
124
|
125
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
125
|
126
|
return
|
|
@@ -129,30 +130,30 @@ func (this *PharmacyController)IssuedDrug(){
|
129
|
130
|
})
|
130
|
131
|
return
|
131
|
132
|
}
|
132
|
|
-func (this *PharmacyController)WaitingDrug(){
|
|
133
|
+func (this *PharmacyController) WaitingDrug() {
|
133
|
134
|
var err error
|
134
|
135
|
defer func() {
|
135
|
|
- if err != nil{
|
136
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
136
|
+ if err != nil {
|
|
137
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
137
|
138
|
}
|
138
|
139
|
}()
|
139
|
|
- keyword := this.GetString("keyword","")
|
140
|
|
- times := this.GetString("time","")
|
|
140
|
+ keyword := this.GetString("keyword", "")
|
|
141
|
+ times := this.GetString("time", "")
|
141
|
142
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
142
|
143
|
timeLayout := "2006-01-02"
|
143
|
144
|
loc, _ := time.LoadLocation("Local")
|
144
|
|
- var stime,etime int64
|
145
|
|
- if times == ""{
|
146
|
|
- stime,etime = service.GetNowTime()
|
147
|
|
- }else {
|
|
145
|
+ var stime, etime int64
|
|
146
|
+ if times == "" {
|
|
147
|
+ stime, etime = service.GetNowTime()
|
|
148
|
+ } else {
|
148
|
149
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
149
|
150
|
stime = stmp.Unix()
|
150
|
151
|
etime = stime + 86399
|
151
|
152
|
}
|
152
|
153
|
//查询表里当天的数据
|
153
|
154
|
var flist []*models.TmpPatient
|
154
|
|
- flist,err = service.GetTodayDrug(stime,etime,orgid,0,keyword)
|
155
|
|
- if err != nil{
|
|
155
|
+ flist, err = service.GetTodayDrug(stime, etime, orgid, 0, keyword)
|
|
156
|
+ if err != nil {
|
156
|
157
|
utils.ErrorLog(err.Error())
|
157
|
158
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
158
|
159
|
return
|
|
@@ -162,31 +163,32 @@ func (this *PharmacyController)WaitingDrug(){
|
162
|
163
|
})
|
163
|
164
|
return
|
164
|
165
|
}
|
|
166
|
+
|
165
|
167
|
//
|
166
|
|
-func (this *PharmacyController)GetPharmacyContent(){
|
|
168
|
+func (this *PharmacyController) GetPharmacyContent() {
|
167
|
169
|
var err error
|
168
|
170
|
defer func() {
|
169
|
|
- if err != nil{
|
170
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
171
|
+ if err != nil {
|
|
172
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
171
|
173
|
}
|
172
|
174
|
}()
|
173
|
|
- patient_id,_ := this.GetInt64("patient_id",0)
|
174
|
|
- is_medicine,_ := this.GetInt64("is_medicine",0)//0:待发药,1:已发药
|
175
|
|
- times := this.GetString("time","")
|
|
175
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
|
176
|
+ is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
|
|
177
|
+ times := this.GetString("time", "")
|
176
|
178
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
177
|
179
|
timeLayout := "2006-01-02"
|
178
|
180
|
loc, _ := time.LoadLocation("Local")
|
179
|
|
- var stime,etime int64
|
180
|
|
- if times == ""{
|
181
|
|
- stime,etime = service.GetNowTime()
|
182
|
|
- }else {
|
|
181
|
+ var stime, etime int64
|
|
182
|
+ if times == "" {
|
|
183
|
+ stime, etime = service.GetNowTime()
|
|
184
|
+ } else {
|
183
|
185
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
184
|
186
|
stime = stmp.Unix()
|
185
|
187
|
etime = stime + 86399
|
186
|
188
|
}
|
187
|
189
|
var list []*models.PharmacyContent
|
188
|
|
- list,err = service.GetPatientMedication(orgid,patient_id,stime,etime,is_medicine)
|
189
|
|
- if err != nil{
|
|
190
|
+ list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
|
|
191
|
+ if err != nil {
|
190
|
192
|
utils.ErrorLog(err.Error())
|
191
|
193
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
192
|
194
|
return
|
|
@@ -200,30 +202,31 @@ func (this *PharmacyController)GetPharmacyContent(){
|
200
|
202
|
return
|
201
|
203
|
|
202
|
204
|
}
|
|
205
|
+
|
203
|
206
|
//发药按钮点击
|
204
|
|
-func (this *PharmacyController)DispensingMedicine() {
|
|
207
|
+func (this *PharmacyController) DispensingMedicine() {
|
205
|
208
|
var err error
|
206
|
209
|
defer func() {
|
207
|
|
- if err != nil{
|
208
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
210
|
+ if err != nil {
|
|
211
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
209
|
212
|
}
|
210
|
213
|
}()
|
211
|
|
- patient_id,_ := this.GetInt64("patient_id",0)
|
212
|
|
- times := this.GetString("time","")
|
|
214
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
|
215
|
+ times := this.GetString("time", "")
|
213
|
216
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
214
|
217
|
creater := this.GetAdminUserInfo().AdminUser.Id
|
215
|
218
|
timeLayout := "2006-01-02"
|
216
|
219
|
loc, _ := time.LoadLocation("Local")
|
217
|
|
- var stime,etime int64
|
218
|
|
- if times == ""{
|
219
|
|
- stime,etime = service.GetNowTime()
|
220
|
|
- }else {
|
|
220
|
+ var stime, etime int64
|
|
221
|
+ if times == "" {
|
|
222
|
+ stime, etime = service.GetNowTime()
|
|
223
|
+ } else {
|
221
|
224
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
222
|
225
|
stime = stmp.Unix()
|
223
|
226
|
etime = stime + 86399
|
224
|
227
|
}
|
225
|
|
- err = service.DispensingMedicine(orgid,patient_id,stime,etime,creater)
|
226
|
|
- if err != nil{
|
|
228
|
+ err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
|
|
229
|
+ if err != nil {
|
227
|
230
|
utils.ErrorLog(err.Error())
|
228
|
231
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
229
|
232
|
return
|
|
@@ -233,30 +236,31 @@ func (this *PharmacyController)DispensingMedicine() {
|
233
|
236
|
})
|
234
|
237
|
return
|
235
|
238
|
}
|
|
239
|
+
|
236
|
240
|
//退药按钮点击
|
237
|
|
-func (this *PharmacyController)DrugWithdrawal(){
|
|
241
|
+func (this *PharmacyController) DrugWithdrawal() {
|
238
|
242
|
var err error
|
239
|
243
|
defer func() {
|
240
|
|
- if err != nil{
|
241
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
244
|
+ if err != nil {
|
|
245
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
242
|
246
|
}
|
243
|
247
|
}()
|
244
|
|
- patient_id,_ := this.GetInt64("patient_id",0)
|
245
|
|
- times := this.GetString("time","")
|
|
248
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
|
249
|
+ times := this.GetString("time", "")
|
246
|
250
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
247
|
251
|
creater := this.GetAdminUserInfo().AdminUser.Id
|
248
|
252
|
timeLayout := "2006-01-02"
|
249
|
253
|
loc, _ := time.LoadLocation("Local")
|
250
|
|
- var stime,etime int64
|
251
|
|
- if times == ""{
|
252
|
|
- stime,etime = service.GetNowTime()
|
253
|
|
- }else {
|
|
254
|
+ var stime, etime int64
|
|
255
|
+ if times == "" {
|
|
256
|
+ stime, etime = service.GetNowTime()
|
|
257
|
+ } else {
|
254
|
258
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
255
|
259
|
stime = stmp.Unix()
|
256
|
260
|
etime = stime + 86399
|
257
|
261
|
}
|
258
|
|
- err = service.DrugWithdrawal(orgid,patient_id,stime,etime,creater)
|
259
|
|
- if err != nil{
|
|
262
|
+ err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
|
|
263
|
+ if err != nil {
|
260
|
264
|
utils.ErrorLog(err.Error())
|
261
|
265
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
262
|
266
|
return
|
|
@@ -269,69 +273,70 @@ func (this *PharmacyController)DrugWithdrawal(){
|
269
|
273
|
}
|
270
|
274
|
|
271
|
275
|
//发药明细列表
|
272
|
|
-func (this *PharmacyController)DispensingDetails(){
|
|
276
|
+func (this *PharmacyController) DispensingDetails() {
|
273
|
277
|
var err error
|
274
|
278
|
defer func() {
|
275
|
|
- if err != nil{
|
276
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
279
|
+ if err != nil {
|
|
280
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
277
|
281
|
}
|
278
|
282
|
}()
|
279
|
|
- keyword := this.GetString("keyword","")//患者名称
|
280
|
|
- start_time := this.GetString("start_time","")//开始时间
|
281
|
|
- end_time := this.GetString("end_time","")//结束时间
|
282
|
|
- page, _ := this.GetInt64("page",1) //页码
|
283
|
|
- limit, _ := this.GetInt64("limit",10) //每一页查出来的条数
|
|
283
|
+ keyword := this.GetString("keyword", "") //患者名称
|
|
284
|
+ start_time := this.GetString("start_time", "") //开始时间
|
|
285
|
+ end_time := this.GetString("end_time", "") //结束时间
|
|
286
|
+ page, _ := this.GetInt64("page", 1) //页码
|
|
287
|
+ limit, _ := this.GetInt64("limit", 10) //每一页查出来的条数
|
284
|
288
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
285
|
289
|
timeLayout := "2006-01-02"
|
286
|
290
|
loc, _ := time.LoadLocation("Local")
|
287
|
|
- var stime,etime int64
|
288
|
|
- if start_time == ""{
|
|
291
|
+ var stime, etime int64
|
|
292
|
+ if start_time == "" {
|
289
|
293
|
stime = 1
|
290
|
|
- }else {
|
|
294
|
+ } else {
|
291
|
295
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
292
|
296
|
stime = stmp.Unix()
|
293
|
297
|
}
|
294
|
|
- if end_time == ""{
|
295
|
|
- _,etime = service.GetNowTime()
|
296
|
|
- }else {
|
297
|
|
- etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59",loc)
|
|
298
|
+ if end_time == "" {
|
|
299
|
+ _, etime = service.GetNowTime()
|
|
300
|
+ } else {
|
|
301
|
+ etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
298
|
302
|
etime = etmp.Unix()
|
299
|
303
|
}
|
300
|
304
|
var dislist []*models.DispensingList
|
301
|
305
|
var total int64
|
302
|
|
- dislist,total,err = service.DispensingDetailsList(stime,etime,orgid,page,limit,keyword)
|
303
|
|
- if err != nil{
|
|
306
|
+ dislist, total, err = service.DispensingDetailsList(stime, etime, orgid, page, limit, keyword)
|
|
307
|
+ if err != nil {
|
304
|
308
|
utils.ErrorLog(err.Error())
|
305
|
309
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
306
|
310
|
return
|
307
|
311
|
}
|
308
|
312
|
|
309
|
313
|
this.ServeSuccessJSON(map[string]interface{}{
|
310
|
|
- "list": dislist,
|
311
|
|
- "total":total,
|
|
314
|
+ "list": dislist,
|
|
315
|
+ "total": total,
|
312
|
316
|
})
|
313
|
317
|
return
|
314
|
318
|
}
|
|
319
|
+
|
315
|
320
|
//处方详情
|
316
|
|
-func (this *PharmacyController)PrescriptionDetails(){
|
|
321
|
+func (this *PharmacyController) PrescriptionDetails() {
|
317
|
322
|
var err error
|
318
|
323
|
defer func() {
|
319
|
|
- if err != nil{
|
320
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
324
|
+ if err != nil {
|
|
325
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
321
|
326
|
}
|
322
|
327
|
}()
|
323
|
328
|
//患者姓名
|
324
|
|
- patient_id,_ := this.GetInt64("patient_id",0)
|
|
329
|
+ patient_id, _ := this.GetInt64("patient_id", 0)
|
325
|
330
|
//发药时间
|
326
|
|
- record_date,_ := this.GetInt64("record_date",0)
|
|
331
|
+ record_date, _ := this.GetInt64("record_date", 0)
|
327
|
332
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
328
|
|
- if record_date == 0 || patient_id == 0{
|
|
333
|
+ if record_date == 0 || patient_id == 0 {
|
329
|
334
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
|
330
|
335
|
return
|
331
|
336
|
}
|
332
|
337
|
var list []*models.PrescripDetails
|
333
|
|
- list,err = service.PrescriptionDetails(patient_id,record_date,orgid)
|
334
|
|
- if err != nil{
|
|
338
|
+ list, err = service.PrescriptionDetails(patient_id, record_date, orgid)
|
|
339
|
+ if err != nil {
|
335
|
340
|
utils.ErrorLog(err.Error())
|
336
|
341
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
337
|
342
|
return
|
|
@@ -343,30 +348,30 @@ func (this *PharmacyController)PrescriptionDetails(){
|
343
|
348
|
}
|
344
|
349
|
|
345
|
350
|
//已发药品的信息
|
346
|
|
-func (this *PharmacyController)DispenseMedicine(){
|
|
351
|
+func (this *PharmacyController) DispenseMedicine() {
|
347
|
352
|
var err error
|
348
|
353
|
defer func() {
|
349
|
|
- if err != nil{
|
350
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
354
|
+ if err != nil {
|
|
355
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
351
|
356
|
}
|
352
|
357
|
}()
|
353
|
|
- keyword := this.GetString("keyword","")
|
354
|
|
- times := this.GetString("time","")
|
|
358
|
+ keyword := this.GetString("keyword", "")
|
|
359
|
+ times := this.GetString("time", "")
|
355
|
360
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
356
|
361
|
timeLayout := "2006-01-02"
|
357
|
362
|
loc, _ := time.LoadLocation("Local")
|
358
|
|
- var stime,etime int64
|
359
|
|
- if times == ""{
|
360
|
|
- stime,etime = service.GetNowTime()
|
361
|
|
- }else {
|
|
363
|
+ var stime, etime int64
|
|
364
|
+ if times == "" {
|
|
365
|
+ stime, etime = service.GetNowTime()
|
|
366
|
+ } else {
|
362
|
367
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
363
|
368
|
stime = stmp.Unix()
|
364
|
369
|
etime = stime + 86399
|
365
|
370
|
}
|
366
|
371
|
//查询表里当天的数据
|
367
|
372
|
var flist []*models.ListOfDrugs
|
368
|
|
- flist,err = service.GetTodayMedicine(stime,etime,orgid,1,keyword)
|
369
|
|
- if err != nil{
|
|
373
|
+ flist, err = service.GetTodayMedicine(stime, etime, orgid, 1, keyword)
|
|
374
|
+ if err != nil {
|
370
|
375
|
utils.ErrorLog(err.Error())
|
371
|
376
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
372
|
377
|
return
|
|
@@ -376,31 +381,32 @@ func (this *PharmacyController)DispenseMedicine(){
|
376
|
381
|
})
|
377
|
382
|
return
|
378
|
383
|
}
|
|
384
|
+
|
379
|
385
|
//待发药的药品信息
|
380
|
|
-func (this *PharmacyController)WaitingMedicine(){
|
|
386
|
+func (this *PharmacyController) WaitingMedicine() {
|
381
|
387
|
var err error
|
382
|
388
|
defer func() {
|
383
|
|
- if err != nil{
|
384
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
389
|
+ if err != nil {
|
|
390
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
385
|
391
|
}
|
386
|
392
|
}()
|
387
|
|
- keyword := this.GetString("keyword","")
|
388
|
|
- times := this.GetString("time","")
|
|
393
|
+ keyword := this.GetString("keyword", "")
|
|
394
|
+ times := this.GetString("time", "")
|
389
|
395
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
390
|
396
|
timeLayout := "2006-01-02"
|
391
|
397
|
loc, _ := time.LoadLocation("Local")
|
392
|
|
- var stime,etime int64
|
393
|
|
- if times == ""{
|
394
|
|
- stime,etime = service.GetNowTime()
|
395
|
|
- }else {
|
|
398
|
+ var stime, etime int64
|
|
399
|
+ if times == "" {
|
|
400
|
+ stime, etime = service.GetNowTime()
|
|
401
|
+ } else {
|
396
|
402
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
397
|
403
|
stime = stmp.Unix()
|
398
|
404
|
etime = stime + 86399
|
399
|
405
|
}
|
400
|
406
|
//查询表里当天的数据
|
401
|
407
|
var flist []*models.ListOfDrugs
|
402
|
|
- flist,err = service.GetTodayMedicine(stime,etime,orgid,0,keyword)
|
403
|
|
- if err != nil{
|
|
408
|
+ flist, err = service.GetTodayMedicine(stime, etime, orgid, 0, keyword)
|
|
409
|
+ if err != nil {
|
404
|
410
|
utils.ErrorLog(err.Error())
|
405
|
411
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
406
|
412
|
return
|
|
@@ -412,30 +418,30 @@ func (this *PharmacyController)WaitingMedicine(){
|
412
|
418
|
}
|
413
|
419
|
|
414
|
420
|
//获取药品的所有患者信息
|
415
|
|
-func (this *PharmacyController)GetPatientsWithDrugs(){
|
|
421
|
+func (this *PharmacyController) GetPatientsWithDrugs() {
|
416
|
422
|
var err error
|
417
|
423
|
defer func() {
|
418
|
|
- if err != nil{
|
419
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
424
|
+ if err != nil {
|
|
425
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
420
|
426
|
}
|
421
|
427
|
}()
|
422
|
|
- drug_id,_ := this.GetInt64("drug_id",0)
|
423
|
|
- is_medicine,_ := this.GetInt64("is_medicine",0)//0:待发药,1:已发药
|
424
|
|
- times := this.GetString("time","")
|
|
428
|
+ drug_id, _ := this.GetInt64("drug_id", 0)
|
|
429
|
+ is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
|
|
430
|
+ times := this.GetString("time", "")
|
425
|
431
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
426
|
432
|
timeLayout := "2006-01-02"
|
427
|
433
|
loc, _ := time.LoadLocation("Local")
|
428
|
|
- var stime,etime int64
|
429
|
|
- if times == ""{
|
430
|
|
- stime,etime = service.GetNowTime()
|
431
|
|
- }else {
|
|
434
|
+ var stime, etime int64
|
|
435
|
+ if times == "" {
|
|
436
|
+ stime, etime = service.GetNowTime()
|
|
437
|
+ } else {
|
432
|
438
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
|
433
|
439
|
stime = stmp.Unix()
|
434
|
440
|
etime = stime + 86399
|
435
|
441
|
}
|
436
|
442
|
var list []*models.PatientInformation
|
437
|
|
- list,err = service.FindMedicationList(orgid,drug_id,stime,etime,is_medicine)
|
438
|
|
- if err != nil{
|
|
443
|
+ list, err = service.FindMedicationList(orgid, drug_id, stime, etime, is_medicine)
|
|
444
|
+ if err != nil {
|
439
|
445
|
utils.ErrorLog(err.Error())
|
440
|
446
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
441
|
447
|
return
|
|
@@ -445,25 +451,24 @@ func (this *PharmacyController)GetPatientsWithDrugs(){
|
445
|
451
|
})
|
446
|
452
|
return
|
447
|
453
|
}
|
|
454
|
+
|
448
|
455
|
//药品管理发药按钮点击
|
449
|
|
-func (this *PharmacyController)MedicineDeparture(){
|
|
456
|
+func (this *PharmacyController) MedicineDeparture() {
|
450
|
457
|
var err error
|
451
|
458
|
defer func() {
|
452
|
|
- if err != nil{
|
453
|
|
- service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId,this.Ctx.Input,err)
|
|
459
|
+ if err != nil {
|
|
460
|
+ service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
|
454
|
461
|
}
|
455
|
462
|
}()
|
456
|
|
- creater,_ := this.GetInt64("creater",0)//领药人
|
457
|
|
- ids := this.GetString("ids","")//发药的数据
|
|
463
|
+ creater, _ := this.GetInt64("creater", 0) //领药人
|
|
464
|
+ ids := this.GetString("ids", "") //发药的数据
|
458
|
465
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
459
|
|
- orgid = 9675
|
460
|
|
- creater = 809
|
461
|
|
- if ids == ""{
|
|
466
|
+ if ids == "" {
|
462
|
467
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
|
463
|
468
|
return
|
464
|
469
|
}
|
465
|
|
- err = service.MedicineDeparture(ids,creater,orgid)
|
466
|
|
- if err != nil{
|
|
470
|
+ err = service.MedicineDeparture(ids, creater, orgid)
|
|
471
|
+ if err != nil {
|
467
|
472
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
468
|
473
|
return
|
469
|
474
|
}
|