|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.jw.hospital.module.rehabilitation.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
@ -1141,7 +1142,7 @@ public class RehabilitationInfoService {
|
|
|
" 1 = 1 \n" +
|
|
|
" AND a.del = '1'\n";
|
|
|
|
|
|
if (StringUtils.isNotBlank(doctorId)) {
|
|
|
if (StringUtils.isNotBlank(doctorId) && StringUtils.isBlank(patientId)) {
|
|
|
//计划负责人或者任务执行人-执行人不为空
|
|
|
sql += " AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' )";
|
|
|
sql += " and c.doctor is not null ";
|
|
@ -1150,11 +1151,11 @@ public class RehabilitationInfoService {
|
|
|
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
//康复计划状态 [0已中止,1进行中,2已完成]
|
|
|
sql += " AND a.patientId ='" + patientId + "' ";
|
|
|
sql += " AND a.id ='" + patientId + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
if (StringUtils.isNotBlank(idcard) && !"null".equals(idcard)) {
|
|
|
//康复计划状态 [0已中止,1进行中,2已完成]
|
|
|
sql += " AND a.idcard like'%" + idcard + "%'";
|
|
|
sql += " AND a.idcard like'%" + idcard + "%'";
|
|
|
}
|
|
|
|
|
|
sql += " )q WHERE 1=1 ";
|
|
@ -1170,6 +1171,7 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
}
|
|
|
sql += limitSql;
|
|
|
System.out.println("查询sql==>" + sql);
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
@ -1229,7 +1231,7 @@ public class RehabilitationInfoService {
|
|
|
public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId) {
|
|
|
String sql = "SELECT DISTINCT \n" +
|
|
|
" a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,a.idcard,\n" +
|
|
|
" b.plan_doctor_name 'planDoctorName',d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
|
|
|
" b.id 'planId',b.title 'planTitle',b.plan_doctor_name 'planDoctorName',d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
|
|
|
" b.`status` 'planStatus', c.hospital_name 'hospitalName'," +
|
|
|
" c.from_source, " +
|
|
|
" CASE \n" +
|
|
@ -1237,7 +1239,7 @@ public class RehabilitationInfoService {
|
|
|
" WHEN c.from_source='2' THEN '自动下转'\n" +
|
|
|
" WHEN c.from_source='3' THEN '扫码添加'\n" +
|
|
|
" END 'fromSourceName',\n" +
|
|
|
" c.ijk_id, c.status, 'patientStatus'," +
|
|
|
" 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" +
|
|
@ -1254,6 +1256,7 @@ public class RehabilitationInfoService {
|
|
|
sql += " AND a.id='" + patientId + "' ";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
System.out.println("数据:" + JSON.toJSONString(list));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@ -1295,7 +1298,7 @@ public class RehabilitationInfoService {
|
|
|
/**
|
|
|
* 查询康复计划服务项
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId) {
|
|
|
public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId, String itemId, String status) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" b.`name`,\n" +
|
|
|
" a.plan_id \n" +
|
|
@ -1305,6 +1308,12 @@ public class RehabilitationInfoService {
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND a.plan_id = '" + planId + "'";
|
|
|
if (StringUtils.isNotBlank(itemId)) {
|
|
|
sql += " and b.id= '" + itemId + "'";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(status)) {
|
|
|
sql += " a.status =" + status + "'";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
@ -1318,4 +1327,23 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> getPlanDoctorList(String planId) {
|
|
|
String sql = "SELECT DISTINCT q.* FROM (\n" +
|
|
|
" SELECT \n" +
|
|
|
" a.id,a.`name`,a.mobile,a.photo,a.sex\n" +
|
|
|
" FROM\n" +
|
|
|
" base_doctor a\n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail b ON a.id = b.doctor\n" +
|
|
|
" WHERE 1=1 AND b.plan_id='" + planId + "'\n" +
|
|
|
" UNION ALL\n" +
|
|
|
" SELECT \n" +
|
|
|
" a.id,a.`name`,a.mobile,a.photo,a.sex\n" +
|
|
|
" FROM\n" +
|
|
|
" base_doctor a\n" +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.plan_doctor\n" +
|
|
|
" WHERE 1=1 AND b.id='" + planId + "'\n" +
|
|
|
")q";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
}
|