|
@ -1101,30 +1101,39 @@ public class RehabilitationInfoService {
|
|
|
String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
String sql = "SELECT * FROM ( " +
|
|
|
"SELECT DISTINCT \n" +
|
|
|
" a.idcard,a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,\n" +
|
|
|
" (\n" +
|
|
|
" SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease \n" +
|
|
|
" a.idcard,a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q \n" +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease \n" +
|
|
|
" WHERE 1 = 1 AND w.patient=a.id GROUP BY w.patient\n" +
|
|
|
" ) 'diseaseListName',\n" +
|
|
|
" ) 'diseaseListName',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient \n" +
|
|
|
" ) 'planDoctorListName',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
|
|
|
" WHERE 1 = 1 AND w.patient = a.id \n" +
|
|
|
" )'itemAllCount',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='0' AND w.patient = a.id \n" +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
|
|
|
" WHERE 1 = 1 AND e.`status`='0' AND w.patient = a.id \n" +
|
|
|
" )'unFinishCount',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='1' AND w.patient = a.id \n" +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
|
|
|
" WHERE 1 = 1 AND e.`status`='1' AND w.patient = a.id \n" +
|
|
|
" )'finishCount',\n" +
|
|
|
" 0 'totayTask'\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
|
|
|
" WHERE 1 = 1 AND e.plan_time=DATE_FORMAT(NOW(),'%Y-%m-%d') AND e.`status`='0' AND w.patient = a.id \n" +
|
|
|
" )'totayTask'\n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient a\n" +
|
|
|
" left JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
|
|
@ -1173,16 +1182,17 @@ public class RehabilitationInfoService {
|
|
|
public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
|
|
|
String sql =
|
|
|
"SELECT DISTINCT \n" +
|
|
|
" a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,\n" +
|
|
|
" a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease \n" +
|
|
|
" WHERE 1 = 1 AND w.patient=a.id GROUP BY w.patient\n" +
|
|
|
" ) 'diseaseListName',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" WHERE 1 = 1 AND q.`status`='0' AND w.patient = a.id \n" +
|
|
|
" )'unFinishCount'\n" +
|
|
|
" (\n" +
|
|
|
" SELECT count(1) FROM wlyy_patient_rehabilitation_plan w \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
|
|
|
" INNER JOIN base_service_item_plan e ON e.plan_detail_id = q.id \n" +
|
|
|
" WHERE 1 = 1 AND e.`status`='0' AND w.patient = a.id \n" +
|
|
|
" )'unFinishCount'\n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient a\n" +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
|
|
@ -1232,10 +1242,10 @@ public class RehabilitationInfoService {
|
|
|
" END 'fromSourceName',\n" +
|
|
|
" c.ijk_id, c.status,'patientStatus'," +
|
|
|
" b.advice_content 'adviceContent',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE 1 = 1 AND q.plan_id = b.id )'itemAllCount',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE 1 = 1 AND q.`status`='1' AND q.plan_id = b.id )'finishCount',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE 1 = 1 AND q.`status`='0' AND q.plan_id = b.id )'unFinishCount',\n" +
|
|
|
" 0 'todayTaskCount'\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND q.plan_id = b.id )'itemAllCount',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='1' AND q.plan_id = b.id )'finishCount',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='0' AND q.plan_id = b.id )'unFinishCount',\n" +
|
|
|
" (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q INNER JOIN base_service_item_plan w ON w.plan_detail_id = q.id WHERE 1 = 1 AND w.`status`='0' AND w.plan_time=DATE_FORMAT(NOW(),'%Y-%m-%d') AND q.plan_id = b.id )'todayTaskCount' \n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient a\n" +
|
|
|
" LEFT JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
|