瀏覽代碼

历史排班

28169 2 月之前
父節點
當前提交
a127158d4d
共有 3 個文件被更改,包括 106 次插入47 次删除
  1. 2 0
      controllers/his_project_api_controller.go
  2. 1 1
      service/mobile_dialysis_service.go
  3. 103 46
      service/pharmacy_service.go

+ 2 - 0
controllers/his_project_api_controller.go 查看文件

@@ -1295,6 +1295,7 @@ func (this *HisProjectApiController) GetDoctorAdvicePrint() {
1295 1295
 
1296 1296
 	eles, _ := service.GetNewAdminUserES(adminUserInfo.CurrentOrgId)
1297 1297
 
1298
+	roles, _ := service.GetAllDoctor(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
1298 1299
 	if err != nil {
1299 1300
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1300 1301
 		return
@@ -1308,6 +1309,7 @@ func (this *HisProjectApiController) GetDoctorAdvicePrint() {
1308 1309
 		"info":              prescriptionInfo,
1309 1310
 		"eles":              eles,
1310 1311
 		"psn_info":          psn_info,
1312
+		"roles":             roles,
1311 1313
 	})
1312 1314
 }
1313 1315
 

+ 1 - 1
service/mobile_dialysis_service.go 查看文件

@@ -4021,7 +4021,7 @@ func GetPatientDialysisRecordList(patientid int64, startime int64, endtime int64
4021 4021
 		db = db.Where("x.dialysis_date <= ?", endtime)
4022 4022
 	}
4023 4023
 
4024
-	err = db.Select("x.id,x.dialysis_date,x.schedual_type,s.mode_id").Joins("left join xt_schedule as s on  x.patient_id = s.patient_id and x.dialysis_date = s.schedule_date ").Scan(&order).Error
4024
+	err = db.Select("x.id,x.dialysis_date,x.schedual_type,s.mode_id").Where("s.status=1").Joins("left join xt_schedule as s on  x.patient_id = s.patient_id and x.dialysis_date = s.schedule_date ").Group("x.id").Scan(&order).Error
4025 4025
 	return order, err
4026 4026
 }
4027 4027
 

+ 103 - 46
service/pharmacy_service.go 查看文件

@@ -249,63 +249,120 @@ func GetManyUsers(tmp []int64) (list []*models.TmpPatient, err error) {
249 249
 func GetPatientMedication(orgid, patient_id, stime, etime, is_medicine int64) (pp []*models.PharmacyContent, err error) {
250 250
 	InitDrugidIsNil(orgid, stime, etime)
251 251
 	var tmp []*models.HisDoctorAdviceInfoL
252
-	if is_medicine == 0 {
252
+	if orgid == 10375 {
253 253
 		err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
254
-			"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
254
+			"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and drug_id in (select id from xt_base_drug where org_id = ?)", stime, etime, orgid, patient_id, orgid).Find(&tmp).Error
255 255
 		if err != nil {
256 256
 			return pp, err
257 257
 		}
258
-	} else {
259
-		err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
260
-			"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
261
-		if err != nil {
262
-			return pp, err
258
+
259
+		for _, v := range tmp {
260
+			pp = append(pp, &models.PharmacyContent{
261
+				Name:         v.AdviceName,
262
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
263
+				Usage:        v.DeliveryWay,
264
+				Frequency:    v.ExecutionFrequency,
265
+				Days:         config.ToString(v.Day) + "天",
266
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
267
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
268
+				DataSources:  "his处方",
269
+				Remarks:      v.Remark, //备注
270
+				DrugId:       v.DrugId,
271
+			})
263 272
 		}
264
-	}
265 273
 
266
-	for _, v := range tmp {
267
-		pp = append(pp, &models.PharmacyContent{
268
-			Name:         v.AdviceName,
269
-			SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
270
-			Usage:        v.DeliveryWay,
271
-			Frequency:    v.ExecutionFrequency,
272
-			Days:         config.ToString(v.Day) + "天",
273
-			Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
274
-			Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
275
-			DataSources:  "his处方",
276
-			Remarks:      v.Remark, //备注
277
-			DrugId:       v.DrugId,
278
-		})
274
+		var tmp_advice []*models.XtDoctorAdviceL
275
+		if is_medicine == 0 {
276
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
277
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
278
+			if err != nil {
279
+				return pp, err
280
+			}
281
+		} else {
282
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
283
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
284
+			if err != nil {
285
+				return pp, err
286
+			}
287
+		}
288
+
289
+		for _, v := range tmp_advice {
290
+			pp = append(pp, &models.PharmacyContent{
291
+				Name:         v.AdviceName,
292
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
293
+				Usage:        v.DeliveryWay,
294
+				Frequency:    v.ExecutionFrequency,
295
+				Days:         "-",
296
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
297
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
298
+				DataSources:  "临时医嘱",
299
+				Remarks:      v.Remark,
300
+				DrugId:       v.DrugId,
301
+			})
302
+		}
303
+		return
279 304
 	}
280 305
 
281
-	var tmp_advice []*models.XtDoctorAdviceL
282
-	if is_medicine == 0 {
283
-		err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
284
-			"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
285
-		if err != nil {
286
-			return pp, err
306
+	if orgid != 10375 {
307
+		if is_medicine == 0 {
308
+			err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
309
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
310
+			if err != nil {
311
+				return pp, err
312
+			}
313
+		} else {
314
+			err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
315
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp).Error
316
+			if err != nil {
317
+				return pp, err
318
+			}
287 319
 		}
288
-	} else {
289
-		err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
290
-			"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
291
-		if err != nil {
292
-			return pp, err
320
+
321
+		for _, v := range tmp {
322
+			pp = append(pp, &models.PharmacyContent{
323
+				Name:         v.AdviceName,
324
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
325
+				Usage:        v.DeliveryWay,
326
+				Frequency:    v.ExecutionFrequency,
327
+				Days:         config.ToString(v.Day) + "天",
328
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
329
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
330
+				DataSources:  "his处方",
331
+				Remarks:      v.Remark, //备注
332
+				DrugId:       v.DrugId,
333
+			})
293 334
 		}
294
-	}
295 335
 
296
-	for _, v := range tmp_advice {
297
-		pp = append(pp, &models.PharmacyContent{
298
-			Name:         v.AdviceName,
299
-			SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
300
-			Usage:        v.DeliveryWay,
301
-			Frequency:    v.ExecutionFrequency,
302
-			Days:         "-",
303
-			Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
304
-			Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
305
-			DataSources:  "临时医嘱",
306
-			Remarks:      v.Remark,
307
-			DrugId:       v.DrugId,
308
-		})
336
+		var tmp_advice []*models.XtDoctorAdviceL
337
+		if is_medicine == 0 {
338
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
339
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
340
+			if err != nil {
341
+				return pp, err
342
+			}
343
+		} else {
344
+			err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
345
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and patient_id = ? and is_medicine = ? and drug_id in (select id from xt_base_drug where org_id = ? and status = 1)", stime, etime, orgid, patient_id, is_medicine, orgid).Find(&tmp_advice).Error
346
+			if err != nil {
347
+				return pp, err
348
+			}
349
+		}
350
+
351
+		for _, v := range tmp_advice {
352
+			pp = append(pp, &models.PharmacyContent{
353
+				Name:         v.AdviceName,
354
+				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
355
+				Usage:        v.DeliveryWay,
356
+				Frequency:    v.ExecutionFrequency,
357
+				Days:         "-",
358
+				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
359
+				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
360
+				DataSources:  "临时医嘱",
361
+				Remarks:      v.Remark,
362
+				DrugId:       v.DrugId,
363
+			})
364
+		}
365
+		return
309 366
 	}
310 367
 	return
311 368
 }