|
@ -83,42 +83,48 @@ public class PrescriptionService extends BaseService {
|
|
|
"wlyy_patient p2,(" +
|
|
|
"SELECT prescription_code," +
|
|
|
"GROUP_CONCAT(health_problem_name) health_problem_name " +
|
|
|
"FROM wlyy_prescription_diagnosis GROUP BY prescription_code) d " +
|
|
|
"WHERE p1.patient=p2.CODE AND p1.CODE=d.prescription_code) p ";
|
|
|
"FROM wlyy_prescription_diagnosis ";
|
|
|
|
|
|
//疾病
|
|
|
if (StringUtils.isNotBlank(disease)) {
|
|
|
prescriptionsql = prescriptionsql + " where health_problem = '" + disease+"' ";
|
|
|
}
|
|
|
prescriptionsql = prescriptionsql + " GROUP BY prescription_code) d " +
|
|
|
"WHERE p1.patient=p2.CODE AND p1.CODE=d.prescription_code ";
|
|
|
|
|
|
// "WHERE p.patient_name NOT IN ('谭仁祝','林美美','曾丽玉','陈新梅','罗金水','陈友财') " +
|
|
|
//社区
|
|
|
if (StringUtils.isNotBlank(hospital)) {
|
|
|
prescriptionsql = prescriptionsql + " p1.hospital = '" + hospital+"' ";
|
|
|
}
|
|
|
|
|
|
//疾病
|
|
|
if (StringUtils.isNotBlank(disease)) {
|
|
|
prescriptionsql = prescriptionsql + " d.health_problem = '" + disease+"' ";
|
|
|
prescriptionsql = prescriptionsql + " and p1.hospital = '" + hospital+"' ";
|
|
|
}
|
|
|
|
|
|
|
|
|
//取药方式
|
|
|
if (StringUtils.isNotBlank(dispensarytype)) {
|
|
|
prescriptionsql = prescriptionsql + " d.dispensary_type = '" + dispensarytype+"' ";
|
|
|
prescriptionsql = prescriptionsql + " and p1.dispensary_type = '" + dispensarytype+"' ";
|
|
|
}
|
|
|
|
|
|
//状态
|
|
|
if (StringUtils.isNotBlank(status)) {
|
|
|
prescriptionsql = prescriptionsql + " p1.status = '" + status+"' ";
|
|
|
prescriptionsql = prescriptionsql + " and p1.status = '" + status+"' ";
|
|
|
}
|
|
|
|
|
|
//开始时间
|
|
|
if (StringUtils.isNotBlank(beginDate)) {
|
|
|
prescriptionsql = prescriptionsql + " p1.create_time <= '" + beginDate+"' ";
|
|
|
if (StringUtils.isNotBlank(beginDate) && !" 00:00:00".equals(beginDate)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.create_time <= '" + beginDate+"' ";
|
|
|
}
|
|
|
|
|
|
//结束时间
|
|
|
if (StringUtils.isNotBlank(endDate)) {
|
|
|
prescriptionsql = prescriptionsql + " p1.create_time >= '" + endDate+"' ";
|
|
|
if (StringUtils.isNotBlank(endDate) && !" 23:59:59".equals(endDate)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.create_time >= '" + endDate+"' ";
|
|
|
}
|
|
|
|
|
|
prescriptionsql = prescriptionsql+ "ORDER BY p.create_time DESC";
|
|
|
prescriptionsql = prescriptionsql+ ") p ORDER BY p.create_time DESC";
|
|
|
|
|
|
if(ispage){
|
|
|
if(1 == page){
|
|
|
page = page-1;
|
|
|
}
|
|
|
prescriptionsql = prescriptionsql +" limit " + page+", "+pageSize;
|
|
|
}
|
|
|
|
|
@ -126,4 +132,66 @@ public class PrescriptionService extends BaseService {
|
|
|
|
|
|
return list ;
|
|
|
}
|
|
|
|
|
|
public Long getPrescriptionListCount(String hospital, String disease, String dispensarytype, String status, String beginDate, String endDate) {
|
|
|
|
|
|
String prescriptionsql = "SELECT count(p.code) FROM (" +
|
|
|
"SELECT " +
|
|
|
"p1.CODE," +
|
|
|
"p1.patient_name," +
|
|
|
"p2.idcard," +
|
|
|
"p2.mobile," +
|
|
|
"p1.hospital_name," +
|
|
|
"p1.create_time," +
|
|
|
"p1.doctor_name," +
|
|
|
"d.health_problem_name," +
|
|
|
"CASE p1.dispensary_type " +
|
|
|
"WHEN 1 THEN '自取' " +
|
|
|
"WHEN 2 THEN '快递配送' " +
|
|
|
"WHEN 3 THEN '健管师配送' " +
|
|
|
"END pay,p1.STATUS " +
|
|
|
"FROM wlyy_prescription p1," +
|
|
|
"wlyy_patient p2,(" +
|
|
|
"SELECT prescription_code," +
|
|
|
"GROUP_CONCAT(health_problem_name) health_problem_name " +
|
|
|
"FROM wlyy_prescription_diagnosis ";
|
|
|
|
|
|
//疾病
|
|
|
if (StringUtils.isNotBlank(disease)) {
|
|
|
prescriptionsql = prescriptionsql + " where health_problem = '" + disease+"' ";
|
|
|
}
|
|
|
prescriptionsql = prescriptionsql + " GROUP BY prescription_code) d " +
|
|
|
"WHERE p1.patient=p2.CODE AND p1.CODE=d.prescription_code";
|
|
|
// "WHERE p.patient_name NOT IN ('谭仁祝','林美美','曾丽玉','陈新梅','罗金水','陈友财') " +
|
|
|
//社区
|
|
|
if (StringUtils.isNotBlank(hospital)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.hospital = '" + hospital+"' ";
|
|
|
}
|
|
|
|
|
|
//取药方式
|
|
|
if (StringUtils.isNotBlank(dispensarytype)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.dispensary_type = '" + dispensarytype+"' ";
|
|
|
}
|
|
|
|
|
|
//状态
|
|
|
if (StringUtils.isNotBlank(status)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.status = '" + status+"' ";
|
|
|
}
|
|
|
|
|
|
//开始时间
|
|
|
if (StringUtils.isNotBlank(beginDate) && !" 00:00:00".equals(beginDate)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.create_time <= '" + beginDate+"' ";
|
|
|
}
|
|
|
|
|
|
//结束时间
|
|
|
if (StringUtils.isNotBlank(endDate) && !" 23:59:59".equals(endDate)) {
|
|
|
prescriptionsql = prescriptionsql + " and p1.create_time >= '" + endDate+"' ";
|
|
|
}
|
|
|
|
|
|
prescriptionsql = prescriptionsql + ") p ";
|
|
|
|
|
|
Long total = jdbcTemplate.queryForObject(prescriptionsql, Long.class);
|
|
|
|
|
|
return total ;
|
|
|
}
|
|
|
}
|