|
@ -960,7 +960,7 @@ public class RehabilitationInfoService {
|
|
|
String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
String filterSql = "";
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
filterSql += " and (d.idcard='" + idcard + "' or d.name like '%"+idcard+"%' ) ";
|
|
|
filterSql += " and (d.idcard='" + idcard + "' or d.name like '%" + idcard + "%' ) ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(downPatientId)) {
|
|
|
//wlyy_rehabilitation_patient_info的id
|
|
@ -1081,9 +1081,9 @@ public class RehabilitationInfoService {
|
|
|
* 获取所有居民的康复计列表
|
|
|
*/
|
|
|
public List<Map<String, Object>> getRehabilitationPatientPlan(String idcard, String doctorId, String patientId,
|
|
|
String finishStatus, Integer page, Integer pagesize,String diseaseId) {
|
|
|
String finishStatus, Integer page, Integer pagesize, String diseaseId) {
|
|
|
String sqlTem = "";
|
|
|
if(StringUtils.isNotBlank(diseaseId)){
|
|
|
if (StringUtils.isNotBlank(diseaseId)) {
|
|
|
sqlTem += " and w.disease ='" + diseaseId + "' ";
|
|
|
}
|
|
|
|
|
@ -1094,10 +1094,10 @@ public class RehabilitationInfoService {
|
|
|
" ( " +
|
|
|
" SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q " +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease " +
|
|
|
" WHERE 1 = 1 AND w.patient=a.id "+sqlTem+" GROUP BY w.patient " +
|
|
|
" WHERE 1 = 1 AND w.patient=a.id " + sqlTem + " GROUP BY w.patient " +
|
|
|
" ) 'diseaseListName', " +
|
|
|
" ( " +
|
|
|
" SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient " +sqlTem+
|
|
|
" SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient " + sqlTem +
|
|
|
" ) 'planDoctorListName', " +
|
|
|
" if(ti.num is null,0,ti.num) 'itemAllCount', " +
|
|
|
" if(tu.num1 is null,0,tu.num1) 'unFinishCount', " +
|
|
@ -1106,7 +1106,7 @@ public class RehabilitationInfoService {
|
|
|
"FROM " +
|
|
|
" base_patient a " +
|
|
|
" left JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient " +
|
|
|
" LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id "+
|
|
|
" LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = a.id " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT " +
|
|
@ -1115,7 +1115,7 @@ public class RehabilitationInfoService {
|
|
|
" wlyy_patient_rehabilitation_plan w " +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id " +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id " +
|
|
|
" WHERE 1 = 1 " + sqlTem+
|
|
|
" WHERE 1 = 1 " + sqlTem +
|
|
|
" GROUP BY w.patient " +
|
|
|
") tu on tu.patient=a.id " +
|
|
|
"LEFT JOIN ( " +
|
|
@ -1125,7 +1125,7 @@ public class RehabilitationInfoService {
|
|
|
" wlyy_patient_rehabilitation_plan w " +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id " +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id " +
|
|
|
" WHERE 1 = 1 " + sqlTem+
|
|
|
" WHERE 1 = 1 " + sqlTem +
|
|
|
" AND e.plan_time = DATE_FORMAT(NOW(), '%Y-%m-%d') " +
|
|
|
" AND e.`status` = '0' " +
|
|
|
" GROUP BY w.patient " +
|
|
@ -1137,20 +1137,20 @@ public class RehabilitationInfoService {
|
|
|
" wlyy_patient_rehabilitation_plan w " +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id " +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id " +
|
|
|
" WHERE 1 = 1 " + sqlTem+
|
|
|
" WHERE 1 = 1 " + sqlTem +
|
|
|
" GROUP BY w.patient " +
|
|
|
") ti on ti.patient=a.id "+
|
|
|
") ti on ti.patient=a.id " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.del = '1' ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(doctorId) && StringUtils.isBlank(patientId)) {
|
|
|
//计划负责人或者任务执行人-执行人不为空
|
|
|
sql += " AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' or d.doctor='"+doctorId+"')";
|
|
|
sql += " AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' or d.doctor='" + doctorId + "')";
|
|
|
sql += " and c.doctor is not null ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(diseaseId)){
|
|
|
if (StringUtils.isNotBlank(diseaseId)) {
|
|
|
sql += " AND b.disease ='" + diseaseId + "' ";
|
|
|
}
|
|
|
|
|
@ -1195,7 +1195,7 @@ public class RehabilitationInfoService {
|
|
|
"FROM " +
|
|
|
" base_patient a " +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient " +
|
|
|
" LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id "+
|
|
|
" LEFT JOIN wlyy_rehabilitation_plan_detail d on b.id = d.plan_id " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = b.patient " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT w.patient,count(DISTINCT e.id) num FROM wlyy_patient_rehabilitation_plan w " +
|
|
@ -1203,14 +1203,14 @@ public class RehabilitationInfoService {
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id " +
|
|
|
" WHERE 1 = 1 AND e.`status`='0' " +
|
|
|
" GROUP BY w.patient " +
|
|
|
" ) t1 on t1.patient=a.id "+
|
|
|
" ) t1 on t1.patient=a.id " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.del = '1' ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(doctorId)) {
|
|
|
//计划负责人或者任务执行人-执行人不为空
|
|
|
sql += " AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' or d.doctor='"+doctorId+"')";
|
|
|
sql += " AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' or d.doctor='" + doctorId + "')";
|
|
|
sql += " and c.doctor is not null ";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
@ -1236,7 +1236,7 @@ public class RehabilitationInfoService {
|
|
|
/**
|
|
|
* todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId, String planId,String diseaseId) {
|
|
|
public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId, String planId, String diseaseId) {
|
|
|
String sql = "SELECT DISTINCT " +
|
|
|
" a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',a.idcard, " +
|
|
|
" b.id 'planId',b.title 'planTitle',b.plan_doctor 'planDoctor',b.plan_doctor_name 'planDoctorName'" +
|
|
@ -1268,10 +1268,12 @@ public class RehabilitationInfoService {
|
|
|
if (StringUtils.isNotBlank(planId)) {
|
|
|
sql += " AND b.id='" + planId + "' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(diseaseId)){
|
|
|
if (StringUtils.isNotBlank(diseaseId)) {
|
|
|
sql += " AND d.id='" + diseaseId + "' ";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@ -1293,7 +1295,7 @@ public class RehabilitationInfoService {
|
|
|
" LEFT JOIN wlyy_rehabilitation_plan_detail pd ON pd.plan_id = q.id " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND ( d.create_user = '" + doctorId + "' OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) or pd.doctor='"+doctorId+"' ) " +
|
|
|
" AND ( d.create_user = '" + doctorId + "' OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) or pd.doctor='" + doctorId + "' ) " +
|
|
|
" AND ( ISNULL( d.type ) OR d.type = 2 ) " +
|
|
|
" GROUP BY d.`status`";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
@ -1371,4 +1373,41 @@ public class RehabilitationInfoService {
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public HashMap<String, Object> getPatientRehabilitationDoctorByPatientId(String patientId, String planId, String diseaseId) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" DISTINCT a.plan_doctor planDoctor, a.plan_doctor_name as planDoctorName\n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_patient_rehabilitation_plan a\n" +
|
|
|
" INNER JOIN base_disease_hospital b ON a.disease = b.id \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 and a.plan_doctor is not null \n";
|
|
|
String whereSql = "";
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
whereSql += " AND a.patient = '" + patientId + "'";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(diseaseId)) {
|
|
|
whereSql += " AND a.disease = '" + diseaseId + "'";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(planId)) {
|
|
|
whereSql += " AND a.id='" + planId + "' ";
|
|
|
}
|
|
|
sql += whereSql;
|
|
|
List<Map<String, Object>> planDoctorList = jdbcTemplate.queryForList(sql);
|
|
|
String detailsql = "SELECT\n" +
|
|
|
" DISTINCT c.doctor_name,c.doctor\n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_patient_rehabilitation_plan a\n" +
|
|
|
" INNER JOIN base_disease_hospital b ON a.disease = b.id \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail c ON a.id=c.plan_id\n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 and c.doctor is not null \n";
|
|
|
detailsql+=whereSql;
|
|
|
List<Map<String, Object>> planDetailDoctorList = jdbcTemplate.queryForList(detailsql);
|
|
|
HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
resultMap.put("planDoctorList",planDoctorList);
|
|
|
resultMap.put("planDetailDoctorList",planDetailDoctorList);
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
}
|