|
@ -576,8 +576,8 @@ public class PrescriptionExpressageService extends BaseService {
|
|
|
PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
|
|
|
|
|
|
if(prescriptionExpressage!=null){
|
|
|
prescriptionExpressage.setHospitalDoctor(doctor);
|
|
|
prescriptionExpressage.setHospitalDoctorCode(d.getCode());
|
|
|
prescriptionExpressage.setHospitalDoctor(d.getName());
|
|
|
prescriptionExpressage.setHospitalDoctorCode(doctor);
|
|
|
prescriptionExpressage.setFetchingMedicineTime(new Date());
|
|
|
prescriptionExpressageDao.save(prescriptionExpressage);
|
|
|
}
|
|
@ -629,6 +629,7 @@ public class PrescriptionExpressageService extends BaseService {
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
|
|
|
" LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
|
|
|
" WHERE" +
|
|
|
" p.hospital = '"+d.getHospital()+"' ";
|
|
|
totalSql = setSQL( totalSql,keyWord,state,type,startDate,endDate,operator,flag);
|
|
@ -651,14 +652,15 @@ public class PrescriptionExpressageService extends BaseService {
|
|
|
" p.patient AS patientCode, " +
|
|
|
" py.charge_time AS chargeTime, " +
|
|
|
" p.dispensary_type AS dispensaryType, " +
|
|
|
" p.drug_delivery_operator_name AS operatorName," +
|
|
|
" e.hospital_doctor AS operatorName," +
|
|
|
" p.drug_delivery_flag AS drugDeliveryFlag, " +
|
|
|
" p.drug_delivery_time AS drugDeliveryTime," +
|
|
|
" e.fetching_medicine_time AS drugDeliveryTime," +
|
|
|
" p.code AS prescriptionCode," +
|
|
|
" p.`status` " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
|
|
|
" LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
|
|
|
" WHERE" +
|
|
|
" p.hospital = '"+d.getHospital()+"' ";
|
|
|
sql = setSQL( sql,keyWord,state,type,startDate,endDate,operator,flag);
|
|
@ -731,4 +733,100 @@ public class PrescriptionExpressageService extends BaseService {
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getPresEsList(String doctor,String keyWord, String state, String type, String startDate, String endDate, String operator,String flag,Integer page, Integer pageSize) {
|
|
|
|
|
|
Map<String, Object> map = new HashedMap();
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
String totalSql = "SELECT count(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
|
|
|
" LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
|
|
|
" WHERE" +
|
|
|
" p.hospital = '"+d.getHospital()+"' ";
|
|
|
totalSql = setDrugSQL( totalSql,keyWord,state,type,startDate,endDate,operator,flag);
|
|
|
totalSql += " AND p.`status`>=50 ";
|
|
|
List<Map<String, Object>> totallist = jdbcTemplate.queryForList(totalSql);
|
|
|
Long total = (Long)totallist.get(0).get("total");
|
|
|
|
|
|
if(total==0){
|
|
|
map.put("list",null);
|
|
|
map.put("page",page);
|
|
|
map.put("total",0);
|
|
|
map.put("records",0);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
int start = (page - 1) * pageSize;
|
|
|
String sql = "SELECT " +
|
|
|
" py.charge_no AS chargeNo, " +
|
|
|
" p.patient_name AS patientName, " +
|
|
|
" p.patient AS patientCode, " +
|
|
|
" py.charge_time AS chargeTime, " +
|
|
|
" p.dispensary_type AS dispensaryType, " +
|
|
|
" e.hospital_doctor AS operatorName," +
|
|
|
" p.drug_delivery_flag AS drugDeliveryFlag, " +
|
|
|
" e.fetching_medicine_time AS drugDeliveryTime," +
|
|
|
" p.code AS prescriptionCode," +
|
|
|
" p.`status` " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
|
|
|
" LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
|
|
|
" WHERE" +
|
|
|
" p.hospital = '"+d.getHospital()+"' ";
|
|
|
sql = setDrugSQL( sql,keyWord,state,type,startDate,endDate,operator,flag);
|
|
|
sql += " AND p.`status`>=50 " +
|
|
|
" ORDER BY e.fetching_medicine_time DESC " +
|
|
|
" LIMIT " + start + "," + pageSize;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
map.put("page",page);
|
|
|
map.put("records",total);
|
|
|
map.put("list",list);
|
|
|
double t = (double)total;
|
|
|
map.put("total",Math.ceil(t/pageSize));
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
public String setDrugSQL(String sql,String keyWord, String state, String type, String startDate, String endDate,String operator,String flag){
|
|
|
//关键字搜索
|
|
|
if(StringUtils.isNotBlank(keyWord)){
|
|
|
Patient p = patientDao.findByIdcard(keyWord);
|
|
|
if(p!=null){
|
|
|
sql += " AND p.patient = '"+p.getCode()+"' ";
|
|
|
}else{
|
|
|
p = patientDao.findBySsc(keyWord);
|
|
|
if(p!=null){
|
|
|
sql += " AND p.patient = '"+p.getCode()+"' ";
|
|
|
}else{
|
|
|
sql += " AND ( py.charge_no = '"+keyWord+"' OR p.patient_name ='"+keyWord+"' )";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(state)){
|
|
|
sql += " AND p.status = "+state ;
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(type)){
|
|
|
sql +=" AND p.dispensary_type =" +type;
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
startDate +=" 00:00:00";
|
|
|
sql += " AND e.fetching_medicine_time >='"+startDate+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
endDate +=" 23:59:59";
|
|
|
sql += " AND e.fetching_medicine_time <='"+endDate+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(operator)){
|
|
|
sql += " AND p.drug_delivery_operator ='"+operator+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(flag)){
|
|
|
sql += " AND p.drug_delivery_flag ="+flag+" ";
|
|
|
}
|
|
|
return sql;
|
|
|
}
|
|
|
}
|