|
@@ -367,7 +367,7 @@ func GetAllPatientStockList(drug_name string, drug_spec string, startime int64,
|
367
|
367
|
if orgid > 0 {
|
368
|
368
|
db = db.Where("x.user_org_id = ?", orgid)
|
369
|
369
|
}
|
370
|
|
- err = db.Group("x.patient_id,x.drug_name,x.drug_spec").Select("t.drug_name,t.drug_spec,x.patient_id,x.store_number,sum(x.store_number) as total,s.name,s.dialysis_no,x.min_unit").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_self_medical as t on t.id = x.medic_id").Where("s.name like ? or s.dialysis_no like ?", likeKey, likeKey).Scan(&stocks).Error
|
|
370
|
+ err = db.Group("x.patient_id,x.drug_name,x.drug_spec").Select("t.drug_name,t.drug_spec,x.patient_id,x.store_number,sum(x.store_number) as total,s.name,s.dialysis_no,x.min_unit,x.drug_name_id").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_self_medical as t on t.id = x.medic_id").Where("s.name like ? or s.dialysis_no like ?", likeKey, likeKey).Scan(&stocks).Error
|
371
|
371
|
return stocks, err
|
372
|
372
|
}
|
373
|
373
|
|
|
@@ -393,7 +393,7 @@ func GetAllPatientOutStockList(drug_name string, drug_spec string, startime int6
|
393
|
393
|
if orgid > 0 {
|
394
|
394
|
db = db.Where("x.user_org_id = ?", orgid)
|
395
|
395
|
}
|
396
|
|
- err = db.Group("x.patient_id,x.drug_name,x.drug_spec").Select("x.drug_name,x.drug_spec,x.patient_id,x.stock_out_number,sum(x.outstore_number) as count").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.name like ? or s.dialysis_no like ?", likeKey, likeKey).Scan(&outStock).Error
|
|
396
|
+ err = db.Group("x.patient_id,x.drug_name,x.drug_spec").Select("x.drug_name,x.drug_spec,x.patient_id,x.stock_out_number,sum(x.outstore_number) as count,s.name,s.dialysis_no,x.drug_name_id").Joins("left join xt_patients as s on s.id = x.patient_id").Where("s.name like ? or s.dialysis_no like ?", likeKey, likeKey).Scan(&outStock).Error
|
397
|
397
|
return outStock, err
|
398
|
398
|
}
|
399
|
399
|
|