Browse Source

打印单单位修改

mainqaq 2 years ago
parent
commit
7e3ab37fd1

+ 16 - 0
controllers/dialysis_api_controller.go View File

@@ -3312,6 +3312,18 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
3312 3312
 						childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3313 3313
 						child.SingleDose = childSingleDose
3314 3314
 					}
3315
+					if childMap["single_dose"] != nil && reflect.TypeOf(childMap["single_dose"]).String() == "float64" {
3316
+						//childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3317
+						child.SingleDose = childMap["single_dose"].(float64)
3318
+					}
3319
+					if childMap["remark"] != nil && reflect.TypeOf(childMap["remark"]).String() == "string" {
3320
+						//childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3321
+						child.Remark = childMap["remark"].(string)
3322
+					}
3323
+					if childMap["drug_id"] != nil && reflect.TypeOf(childMap["drug_id"]).String() == "float64" {
3324
+						//childSingleDose, _ := strconv.ParseFloat(childMap["single_dose"].(string), 64)
3325
+						child.DrugId = int64(childMap["drug_id"].(float64))
3326
+					}
3315 3327
 
3316 3328
 					if childMap["single_dose_unit"] != nil && reflect.TypeOf(childMap["single_dose_unit"]).String() == "string" {
3317 3329
 						childSingleDoseUnit, _ := childMap["single_dose_unit"].(string)
@@ -3322,6 +3334,10 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
3322 3334
 						childPrescribingNumber, _ := strconv.ParseFloat(childMap["prescribing_number"].(string), 64)
3323 3335
 						child.PrescribingNumber = childPrescribingNumber
3324 3336
 					}
3337
+					if childMap["prescribing_number"] != nil && reflect.TypeOf(childMap["prescribing_number"]).String() == "float64" {
3338
+						//childPrescribingNumber, _ := strconv.ParseFloat(childMap["prescribing_number"].(string), 64)
3339
+						child.PrescribingNumber = childMap["prescribing_number"].(float64)
3340
+					}
3325 3341
 
3326 3342
 					if childMap["prescribing_number_unit"] != nil && reflect.TypeOf(childMap["prescribing_number_unit"]).String() == "string" {
3327 3343
 						childPrescribingNumberUnit, _ := childMap["prescribing_number_unit"].(string)

+ 4 - 4
controllers/patient_api_controller.go View File

@@ -1935,7 +1935,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1935 1935
 						prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
1936 1936
 						fmt.Println("prescriptionConfigwodweweeeweweweweweewewewwewew", prescriptionConfig)
1937 1937
 						if prescriptionConfig.IsOpen == 1 {
1938
-							if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId,item.UserOrgId){
1938
+							if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId, item.UserOrgId) {
1939 1939
 								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1940 1940
 								//查询默认仓库
1941 1941
 								storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
@@ -1972,7 +1972,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1972 1972
 						}
1973 1973
 
1974 1974
 					} else {
1975
-						if medical.IsUse == 2 {
1975
+						if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId, item.UserOrgId) {
1976 1976
 							service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1977 1977
 							//更新字典里面的库存
1978 1978
 							var sum_count int64
@@ -2252,7 +2252,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2252 2252
 					}
2253 2253
 
2254 2254
 					if prescribing_number_total <= total {
2255
-						if medical.IsUse == 2 {
2255
+						if medical.IsUse == 2 && !service.IsPharmacyDelivery(item.DrugId, item.UserOrgId) {
2256 2256
 
2257 2257
 							if config.IsOpen != 1 {
2258 2258
 								service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
@@ -3307,7 +3307,7 @@ func adviceFormData(advice *models.DoctorAdvice, data []byte, action string) (co
3307 3307
 
3308 3308
 	if dataBody["drug_id"] != nil && reflect.TypeOf(dataBody["drug_id"]).String() == "string" {
3309 3309
 		drug_id, _ := dataBody["drug_id"].(string)
3310
-		tmpDrugId,_ := strconv.ParseInt(drug_id,10,64)
3310
+		tmpDrugId, _ := strconv.ParseInt(drug_id, 10, 64)
3311 3311
 		advice.DrugId = tmpDrugId
3312 3312
 	}
3313 3313
 	if dataBody["drug_id"] != nil && reflect.TypeOf(dataBody["drug_id"]).String() == "float64" {

+ 167 - 162
controllers/pharmacy_controller.go View File

@@ -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
 	}

+ 10 - 2
controllers/supply_order_api_contorller.go View File

@@ -123,6 +123,12 @@ func CheckParams(this *SupplyOrderApiController, m *map[string][]string) (map[st
123 123
 
124 124
 //获取供应商列表GetSupplyList
125 125
 func (this *SupplyOrderApiController) GetSupplyList() {
126
+	var err error
127
+	defer func() {
128
+		if err != nil {
129
+			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
130
+		}
131
+	}()
126 132
 	ctype, _ := this.GetInt64("ctype") //供应商类别
127 133
 	page, _ := this.GetInt64("page")   //页码
128 134
 	limit, _ := this.GetInt64("limit") //每一页查出来的条数
@@ -130,14 +136,16 @@ func (this *SupplyOrderApiController) GetSupplyList() {
130 136
 		"page":  {"must", "string", "page"},
131 137
 		"limit": {"must", "string", "limit"},
132 138
 	}
133
-	_, err := CheckParams(this, &check)
139
+	_, err = CheckParams(this, &check)
134 140
 	if err != nil {
135 141
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
136 142
 	}
137 143
 	keyword := this.GetString("keyword") //供应商编号\供应商名称\联系人名字
138 144
 	orgId := this.GetAdminUserInfo().CurrentOrgId
139 145
 	//获取分页的数据
140
-	list, total, err := service.GetSupplyList(ctype, page, limit, keyword, orgId)
146
+	var list []*models.SpSupplierName
147
+	var total int64
148
+	list, total, err = service.GetSupplyList(ctype, page, limit, keyword, orgId)
141 149
 	//获取供应商类别
142 150
 	costClassify := "供应商类别"
143 151
 	drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)

File diff suppressed because it is too large
+ 497 - 470
service/pharmacy_service.go