|
@ -284,22 +284,22 @@ public class RehabilitationInfoService {
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
filterSql += " and b.idcard like '%" + idcard + "%' ";
|
|
|
}
|
|
|
String sql = "SELECT\n" +
|
|
|
" a.idcard,a.id 'patientId',a.`name` 'patientName',a.sex,NULL age,a.address \n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_rehabilitation_patient_info a\n" +
|
|
|
" INNER JOIN base_patient b ON a.patient = b.id \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" + filterSql +
|
|
|
" AND (a.type = 2 OR ISNULL( a.type )) \n" +
|
|
|
" AND a.sign_status='0'\n" +
|
|
|
" AND a.`status` = '6'\n" +
|
|
|
" AND a.patient NOT IN (\n" +
|
|
|
" SELECT i.id \n" +
|
|
|
" FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p ON p.id = i.patient \n" +
|
|
|
" WHERE 1=1 AND i.create_user = '" + doctorCode + "' AND i.STATUS != 0 \n" +
|
|
|
" GROUP BY i.patient\n" +
|
|
|
" ) \n" +
|
|
|
String sql = "SELECT " +
|
|
|
" a.idcard,a.id 'patientId',a.`name` 'patientName',a.sex,NULL age,a.address " +
|
|
|
"FROM " +
|
|
|
" wlyy_rehabilitation_patient_info a " +
|
|
|
" INNER JOIN base_patient b ON a.patient = b.id " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " + filterSql +
|
|
|
" AND (a.type = 2 OR ISNULL( a.type )) " +
|
|
|
" AND a.sign_status='0' " +
|
|
|
" AND a.`status` = '6' " +
|
|
|
" AND a.patient NOT IN ( " +
|
|
|
" SELECT i.id " +
|
|
|
" FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p ON p.id = i.patient " +
|
|
|
" WHERE 1=1 AND i.create_user = '" + doctorCode + "' AND i.STATUS != 0 " +
|
|
|
" GROUP BY i.patient " +
|
|
|
" ) " +
|
|
|
"ORDER BY a.create_time DESC ";
|
|
|
|
|
|
String pageSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
@ -326,34 +326,34 @@ public class RehabilitationInfoService {
|
|
|
*/
|
|
|
public JSONObject noDownCount(String doctorCode, JSONObject object) {
|
|
|
//未下转所有
|
|
|
String notTurnedDownCountSql = "select count(*) \n" +
|
|
|
"from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient \n" +
|
|
|
" where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.patient NOT IN ( \n" +
|
|
|
" SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p \n" +
|
|
|
String notTurnedDownCountSql = "select count(*) " +
|
|
|
"from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient " +
|
|
|
" where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.patient NOT IN ( " +
|
|
|
" SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p " +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient ) ";
|
|
|
|
|
|
//未家签
|
|
|
String notSignedAtHomeSql = "SELECT count(*) FROM (\n" +
|
|
|
"select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address \n" +
|
|
|
" from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient\n" +
|
|
|
" where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='0' \n" +
|
|
|
" AND d.patient NOT IN ( \n" +
|
|
|
" SELECT i.patient FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p ON p.id = i.patient \n" +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 \n" +
|
|
|
" GROUP BY i.patient \n" +
|
|
|
" )GROUP BY d.patient \n" +
|
|
|
String notSignedAtHomeSql = "SELECT count(*) FROM ( " +
|
|
|
"select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address " +
|
|
|
" from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient " +
|
|
|
" where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='0' " +
|
|
|
" AND d.patient NOT IN ( " +
|
|
|
" SELECT i.patient FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p ON p.id = i.patient " +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 " +
|
|
|
" GROUP BY i.patient " +
|
|
|
" )GROUP BY d.patient " +
|
|
|
")aa";
|
|
|
|
|
|
String notSignedAtHome1Sql = "SELECT count(*) FROM (\n" +
|
|
|
" select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address\n" +
|
|
|
" from wlyy_rehabilitation_patient_info d \n" +
|
|
|
" INNER JOIN base_patient p ON p.id= d.patient \n" +
|
|
|
" where d.create_user = '" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='1'\n" +
|
|
|
" AND d.patient NOT IN ( \n" +
|
|
|
" SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p \n" +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient \n" +
|
|
|
" )\n" +
|
|
|
" GROUP BY d.patient\n" +
|
|
|
String notSignedAtHome1Sql = "SELECT count(*) FROM ( " +
|
|
|
" select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address " +
|
|
|
" from wlyy_rehabilitation_patient_info d " +
|
|
|
" INNER JOIN base_patient p ON p.id= d.patient " +
|
|
|
" where d.create_user = '" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='1' " +
|
|
|
" AND d.patient NOT IN ( " +
|
|
|
" SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p " +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient " +
|
|
|
" ) " +
|
|
|
" GROUP BY d.patient " +
|
|
|
")aa";
|
|
|
|
|
|
Integer allCount = jdbcTemplate.queryForObject(notTurnedDownCountSql, Integer.class);
|
|
@ -375,21 +375,21 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
// String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus," +
|
|
|
// "f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode " +
|
|
|
// " from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f\n" +
|
|
|
// "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN \n" +
|
|
|
// "( SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p WHERE i.create_user = '" + doctorCode + "' \n" +
|
|
|
// " from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f " +
|
|
|
// "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN " +
|
|
|
// "( SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p WHERE i.create_user = '" + doctorCode + "' " +
|
|
|
// "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC ";
|
|
|
|
|
|
String sql = "SELECT \n" +
|
|
|
" p.idcard,p.id patient,p.`name` 'patientName',p.sex,NULL age,p.address,\n" +
|
|
|
" d.`dept`,d.`dept_name`\n" +
|
|
|
" FROM wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient \n" +
|
|
|
" WHERE 1=1 \n" + filterSql +
|
|
|
" AND ( ISNULL(d.type) or d.type=2) AND d.sign_status='1' \n" +
|
|
|
" AND d.patient NOT IN (\n" +
|
|
|
" SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p \n" +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient\n" +
|
|
|
")\n" +
|
|
|
String sql = "SELECT " +
|
|
|
" p.idcard,p.id patient,p.`name` 'patientName',p.sex,NULL age,p.address, " +
|
|
|
" d.`dept`,d.`dept_name` " +
|
|
|
" FROM wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient " +
|
|
|
" WHERE 1=1 " + filterSql +
|
|
|
" AND ( ISNULL(d.type) or d.type=2) AND d.sign_status='1' " +
|
|
|
" AND d.patient NOT IN ( " +
|
|
|
" SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p " +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient " +
|
|
|
") " +
|
|
|
"GROUP BY d.patient ORDER BY d.create_time DESC ";
|
|
|
|
|
|
sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
@ -421,17 +421,17 @@ public class RehabilitationInfoService {
|
|
|
// " if(f.id is null,-2,-1) as isTurnDown " +
|
|
|
// " from wlyy_patient p,wlyy_patient_discharge d " +
|
|
|
// " left JOIN wlyy_sign_family f on d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "'" +
|
|
|
// "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient NOT IN \n" +
|
|
|
// "( SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p WHERE i.create_user = '" + doctorCode + "' \n" +
|
|
|
// "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient NOT IN " +
|
|
|
// "( SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,wlyy_patient p WHERE i.create_user = '" + doctorCode + "' " +
|
|
|
// "AND i. STATUS != 0 AND p. CODE = i.patient )GROUP BY d.patient ORDER BY d.create_time DESC ";
|
|
|
|
|
|
String sql = "SELECT '' id, p.idcard,p.id 'patient',p.`name` patientName,p.sex,d.age,p.address,\n" +
|
|
|
" if(p.sign_status=0,-2,-1) as isTurnDown \n" +
|
|
|
" FROM base_patient p \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient \n" +
|
|
|
String sql = "SELECT '' id, p.idcard,p.id 'patient',p.`name` patientName,p.sex,d.age,p.address, " +
|
|
|
" if(p.sign_status=0,-2,-1) as isTurnDown " +
|
|
|
" FROM base_patient p " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
|
|
|
" WHERE 1=1 " + filterSql +
|
|
|
" AND d.create_user ='" + doctorCode + "' AND ( ISNULL(d.type) or d.type=2) \n" +
|
|
|
" AND d.`status`='0'\n" +
|
|
|
" AND d.create_user ='" + doctorCode + "' AND ( ISNULL(d.type) or d.type=2) " +
|
|
|
" AND d.`status`='0' " +
|
|
|
"GROUP BY d.patient ORDER BY d.create_time DESC ";
|
|
|
sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
@ -449,28 +449,28 @@ public class RehabilitationInfoService {
|
|
|
*/
|
|
|
public JSONObject downAndNoSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
|
|
|
// String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
|
|
|
// " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
|
|
|
// "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
|
|
|
// "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
// "wlyy_specialist_patient_relation pr \n" +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
// " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, " +
|
|
|
// "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, " +
|
|
|
// "s.admin_team_code teamCode ,pr.is_manage isManage " +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
// "wlyy_specialist_patient_relation pr " +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
// "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 " +
|
|
|
// " and (pr.is_manage != 1 OR isnull(pr.is_manage)) ";
|
|
|
|
|
|
|
|
|
String sql2 = "SELECT \n" +
|
|
|
" i.disease_name diseaseName,i.create_user,p.idcard,p.sex,p.id 'patient',\n" +
|
|
|
" i.`status`, p.`name` 'patientName', p.address, \n" +
|
|
|
" CAST(IFNULL(p.birthday,'') AS char ) birthday,\n" +
|
|
|
" pr.is_manage isManage \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i \n" +
|
|
|
"INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` \n" +
|
|
|
"INNER JOIN base_patient p ON p.id = i.patient\n" +
|
|
|
"INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id\n" +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 \n" +
|
|
|
" and pr.`status`>=0 and pr.sign_status=1 \n" +
|
|
|
" AND (pr.is_manage != 1 OR isnull(pr.is_manage)) \n";
|
|
|
String sql2 = "SELECT " +
|
|
|
" i.disease_name diseaseName,i.create_user,p.idcard,p.sex,p.id 'patient', " +
|
|
|
" i.`status`, p.`name` 'patientName', p.address, " +
|
|
|
" CAST(IFNULL(p.birthday,'') AS char ) birthday, " +
|
|
|
" pr.is_manage isManage " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i " +
|
|
|
"INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` " +
|
|
|
"INNER JOIN base_patient p ON p.id = i.patient " +
|
|
|
"INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 " +
|
|
|
" and pr.`status`>=0 and pr.sign_status=1 " +
|
|
|
" AND (pr.is_manage != 1 OR isnull(pr.is_manage)) ";
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
@ -504,38 +504,38 @@ public class RehabilitationInfoService {
|
|
|
* 已经下转统计
|
|
|
*/
|
|
|
public JSONObject downCount(String doctorCode, JSONObject object) {
|
|
|
// String sql1 = "SELECT COUNT(distinct i.patient) \n" +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
// "wlyy_specialist_patient_relation pr \n" +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
// String sql1 = "SELECT COUNT(distinct i.patient) " +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
// "wlyy_specialist_patient_relation pr " +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
// "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
|
|
|
String sql1 = "SELECT \n" +
|
|
|
" COUNT(distinct i.patient) \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i \n" +
|
|
|
"INNER JOIN base_patient p ON p.id = i.patient \n" +
|
|
|
"INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND i.patient_info_code=q.`code` AND q.sign_status='1'\n" +
|
|
|
"INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id\n" +
|
|
|
String sql1 = "SELECT " +
|
|
|
" COUNT(distinct i.patient) " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i " +
|
|
|
"INNER JOIN base_patient p ON p.id = i.patient " +
|
|
|
"INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND i.patient_info_code=q.`code` AND q.sign_status='1' " +
|
|
|
"INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 and pr.`status`>=0 and pr.sign_status=1 ";
|
|
|
Integer list1 = jdbcTemplate.queryForObject(sql1, Integer.class);
|
|
|
|
|
|
//康复计划数量
|
|
|
// String sql2 = "SELECT COUNT(distinct i.id) \n" +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p\n" +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient \n" +
|
|
|
// String sql2 = "SELECT COUNT(distinct i.id) " +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p " +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient " +
|
|
|
// "AND s.status = 1 AND s.expenses_status = 1 ";
|
|
|
String sql2 = "SELECT COUNT(distinct i.id) \n" +
|
|
|
String sql2 = "SELECT COUNT(distinct i.id) " +
|
|
|
" FROM wlyy_patient_rehabilitation_plan i " +
|
|
|
" inner join base_patient p on p.id = i.patient \n" +
|
|
|
" inner join wlyy_rehabilitation_patient_info q on q.patient = i.patient AND i.patient_info_code=q.`code` AND q.sign_status='1' \n" +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 \n";
|
|
|
" inner join base_patient p on p.id = i.patient " +
|
|
|
" inner join wlyy_rehabilitation_patient_info q on q.patient = i.patient AND i.patient_info_code=q.`code` AND q.sign_status='1' " +
|
|
|
" WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 ";
|
|
|
Integer list2 = jdbcTemplate.queryForObject(sql2, Integer.class);
|
|
|
|
|
|
|
|
|
//家医接收
|
|
|
// String sql3 = "SELECT COUNT(distinct i.patient) " +
|
|
|
// " FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
// " wlyy_specialist_patient_relation pr \n" +
|
|
|
// " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
// " FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
// " wlyy_specialist_patient_relation pr " +
|
|
|
// " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
// " AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
|
|
|
// Integer list3 = jdbcTemplate.queryForObject(sql3, Integer.class);
|
|
|
|
|
@ -551,22 +551,22 @@ public class RehabilitationInfoService {
|
|
|
*/
|
|
|
public JSONObject downAndSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
|
|
|
// String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
|
|
|
// " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
|
|
|
// "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
|
|
|
// "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
// "wlyy_specialist_patient_relation pr \n" +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
// " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, " +
|
|
|
// "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, " +
|
|
|
// "s.admin_team_code teamCode ,pr.is_manage isManage " +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
// "wlyy_specialist_patient_relation pr " +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
// "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
|
|
|
|
|
|
String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient',\n" +
|
|
|
" CAST(IFNULL(p.birthday,'') AS char ) birthday, \n" +
|
|
|
" i.`status`, p.`name` patientName, p.address,pr.is_manage isManage \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` \n" +
|
|
|
" INNER JOIN base_patient p ON p.id = i.patient \n" +
|
|
|
" INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id \n" +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1 \n";
|
|
|
String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient', " +
|
|
|
" CAST(IFNULL(p.birthday,'') AS char ) birthday, " +
|
|
|
" i.`status`, p.`name` patientName, p.address,pr.is_manage isManage " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` " +
|
|
|
" INNER JOIN base_patient p ON p.id = i.patient " +
|
|
|
" INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1 ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
sql2 += " and p.idcard like '%" + idcard + "%' ";
|
|
@ -599,22 +599,22 @@ public class RehabilitationInfoService {
|
|
|
*/
|
|
|
public JSONObject down(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
|
|
|
// String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
|
|
|
// " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
|
|
|
// "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
|
|
|
// "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
// "wlyy_specialist_patient_relation pr \n" +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
// " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, " +
|
|
|
// "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, " +
|
|
|
// "s.admin_team_code teamCode ,pr.is_manage isManage " +
|
|
|
// "FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
// "wlyy_specialist_patient_relation pr " +
|
|
|
// "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
// "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
|
|
|
|
|
|
String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient',\n" +
|
|
|
" CAST(IFNULL(p.birthday,'') AS char ) birthday, i.`status`, p.`name` patientName, p.address, \n" +
|
|
|
" pr.is_manage isManage \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i \n" +
|
|
|
" INNER JOIN base_patient p ON p.id = i.patient\n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code`\n" +
|
|
|
" INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id\n" +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 \n" +
|
|
|
String sql2 = "SELECT i.disease_name diseaseName,p.idcard,p.sex, p.id 'patient', " +
|
|
|
" CAST(IFNULL(p.birthday,'') AS char ) birthday, i.`status`, p.`name` patientName, p.address, " +
|
|
|
" pr.is_manage isManage " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i " +
|
|
|
" INNER JOIN base_patient p ON p.id = i.patient " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` " +
|
|
|
" INNER JOIN wlyy_specialist_patient_relation pr ON pr.patient=p.id " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 " +
|
|
|
" and pr.`status`>=0 and pr.sign_status=1 ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
@ -735,32 +735,32 @@ public class RehabilitationInfoService {
|
|
|
public JSONObject getDeorsumvergenceCount(String doctorCode) {
|
|
|
JSONObject object = new JSONObject();
|
|
|
//已下转
|
|
|
String sql1 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
|
|
|
"IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
|
|
|
"s.admin_team_code teamCode ,pr.is_manage isManage \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
"wlyy_specialist_patient_relation pr \n" +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
String sql1 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, " +
|
|
|
"IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, " +
|
|
|
"s.admin_team_code teamCode ,pr.is_manage isManage " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
"wlyy_specialist_patient_relation pr " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
"AND s.expenses_status = 1 AND pr.patient=p.code GROUP BY i.patient ORDER BY i.create_time DESC ";
|
|
|
List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1);
|
|
|
//康复计划数量
|
|
|
String sql2 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
|
|
|
"IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, s.admin_team_code teamCode \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p\n" +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient \n" +
|
|
|
String sql2 = "SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, " +
|
|
|
"IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, s.admin_team_code teamCode " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient " +
|
|
|
"AND s.status = 1 AND s.expenses_status = 1 GROUP BY i.id";
|
|
|
List<Map<String, Object>> list2 = jdbcTemplate.queryForList(sql2);
|
|
|
//家医接收
|
|
|
String sql3 = "SELECT * \n" +
|
|
|
"FROM (\n" +
|
|
|
"SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
|
|
|
"IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
|
|
|
"s.admin_team_code teamCode ,pr.is_manage isManage \n" +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
|
|
|
"wlyy_specialist_patient_relation pr \n" +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
|
|
|
"AND s.expenses_status = 1 AND pr.patient=p.code GROUP BY i.patient ORDER BY i.create_time DESC\n" +
|
|
|
") aa\n" +
|
|
|
String sql3 = "SELECT * " +
|
|
|
"FROM ( " +
|
|
|
"SELECT s.idcard, s.patient, i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, " +
|
|
|
"IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, " +
|
|
|
"s.admin_team_code teamCode ,pr.is_manage isManage " +
|
|
|
"FROM wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p , " +
|
|
|
"wlyy_specialist_patient_relation pr " +
|
|
|
"WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 " +
|
|
|
"AND s.expenses_status = 1 AND pr.patient=p.code GROUP BY i.patient ORDER BY i.create_time DESC " +
|
|
|
") aa " +
|
|
|
"WHERE aa.isManage = 1 ";
|
|
|
List<Map<String, Object>> list3 = jdbcTemplate.queryForList(sql3);
|
|
|
object.put("deorsumvergenceCount", list1.size());//下转人数
|
|
@ -856,23 +856,23 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getUnm(String doctor, String patient) {
|
|
|
String sqlMe = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d \n" +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
|
|
|
"LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id \n" +
|
|
|
"where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') \n" +
|
|
|
String sqlMe = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d " +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id " +
|
|
|
"LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id " +
|
|
|
"where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') " +
|
|
|
"AND d.doctor = '" + doctor + "' ";//我的任务
|
|
|
List<Map<String, Object>> listMe = jdbcTemplate.queryForList(sqlMe);
|
|
|
String sqlAll = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d \n" +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
|
|
|
"LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id \n" +
|
|
|
String sqlAll = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d " +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id " +
|
|
|
"LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id " +
|
|
|
"where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') ";//全部任务
|
|
|
List<Map<String, Object>> listAll = jdbcTemplate.queryForList(sqlAll);
|
|
|
String newDetailSql = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code,r.complete_time createTime, r.doctor_name doctorName \n" +
|
|
|
"from wlyy_rehabilitation_plan_detail d \n" +
|
|
|
"INNER JOIN wlyy_rehabilitation_operate_records r ON d.id = r.rehabilitation_detail_id\n" +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
|
|
|
"LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id \n" +
|
|
|
"where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "')\n" +
|
|
|
String newDetailSql = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code,r.complete_time createTime, r.doctor_name doctorName " +
|
|
|
"from wlyy_rehabilitation_plan_detail d " +
|
|
|
"INNER JOIN wlyy_rehabilitation_operate_records r ON d.id = r.rehabilitation_detail_id " +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id " +
|
|
|
"LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id " +
|
|
|
"where d.plan_id IN (SELECT id FROM wlyy_patient_rehabilitation_plan WHERE patient ='" + patient + "') " +
|
|
|
" and r.`status`=1 GROUP BY r.complete_time DESC LIMIT 0,1 ";
|
|
|
newDetailSql = TransforSqlUtl.wlyy_rehabilitation_operate_recordsDoctorName(newDetailSql);
|
|
|
List<Map<String, Object>> newDetail = jdbcTemplate.queryForList(newDetailSql);
|
|
@ -933,30 +933,30 @@ public class RehabilitationInfoService {
|
|
|
public JSONObject getRehabilitationPatientListNew(String downPatientId, String idcard, String doctorId, String status, Integer page, Integer pagesize) {
|
|
|
JSONObject object = new JSONObject();
|
|
|
List<Map<String, Object>> list = null;
|
|
|
String detailSql = "SELECT \n" +
|
|
|
" p.idcard, q.id 'planId', p.id 'patientId', p.phone, p.`name` 'patientName', p.sex, p.address, \n" +
|
|
|
" d.code 'patientInfoCode', d.ssc , d.mobile, d.age, d.diagnosis_name 'diagnosisName', d.sign_status, d.dept 'deptCode', \n" +
|
|
|
" d.dept_name 'deptName', d.create_user 'createUserId', \n" +
|
|
|
" d.create_user_name 'createUserName',DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') 'createTime',\n" +
|
|
|
" q.`status` 'planStaus',q.plan_doctor 'planDoctor', q.plan_doctor_name 'planDoctorName' , q.advice_content 'adviceContent', \n" +
|
|
|
String detailSql = "SELECT " +
|
|
|
" p.idcard, q.id 'planId', p.id 'patientId', p.phone, p.`name` 'patientName', p.sex, p.address, " +
|
|
|
" d.code 'patientInfoCode', d.ssc , d.mobile, d.age, d.diagnosis_name 'diagnosisName', d.sign_status, d.dept 'deptCode', " +
|
|
|
" d.dept_name 'deptName', d.create_user 'createUserId', " +
|
|
|
" d.create_user_name 'createUserName',DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') 'createTime', " +
|
|
|
" q.`status` 'planStaus',q.plan_doctor 'planDoctor', q.plan_doctor_name 'planDoctorName' , q.advice_content 'adviceContent', " +
|
|
|
" DATE_FORMAT(q.create_time, '%Y-%m-%d %H:%i:%s') 'planCreateTime'," +
|
|
|
" d.from_source," +
|
|
|
" CASE \n" +
|
|
|
" WHEN d.from_source='1' THEN '手动添加'\n" +
|
|
|
" WHEN d.from_source='2' THEN '自动下转'\n" +
|
|
|
" WHEN d.from_source='3' THEN '扫码添加'\n" +
|
|
|
" END 'fromSourceName',\n" +
|
|
|
" d.ijk_id, d.status 'patientStatus', \n" +
|
|
|
" CASE " +
|
|
|
" WHEN d.from_source='1' THEN '手动添加' " +
|
|
|
" WHEN d.from_source='2' THEN '自动下转' " +
|
|
|
" WHEN d.from_source='3' THEN '扫码添加' " +
|
|
|
" END 'fromSourceName', " +
|
|
|
" d.ijk_id, d.status 'patientStatus', " +
|
|
|
" d.problem_code," +
|
|
|
" q.disease 'diseaseId',q.disease_name 'diseaseName' \n" +
|
|
|
" FROM base_patient p \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient \n" +
|
|
|
" q.disease 'diseaseId',q.disease_name 'diseaseName' " +
|
|
|
" FROM base_patient p " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
|
|
|
" LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code " +
|
|
|
" WHERE 1 = 1 ";
|
|
|
String countSql = " select count(1) from base_patient p " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
|
|
|
" LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code" +
|
|
|
" WHERE 1 = 1 \n";
|
|
|
" WHERE 1 = 1 ";
|
|
|
String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
String filterSql = "";
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
@ -968,7 +968,7 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
if (StringUtils.isBlank(status)) {
|
|
|
//看全部数据
|
|
|
filterSql += " AND (d.create_user = '" + doctorId + "' OR ISNULL( d.create_user ) )\n" +
|
|
|
filterSql += " AND (d.create_user = '" + doctorId + "' OR ISNULL( d.create_user ) ) " +
|
|
|
" AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
|
|
|
detailSql += filterSql + limitSql;
|
|
|
countSql += filterSql;
|
|
@ -1002,7 +1002,7 @@ public class RehabilitationInfoService {
|
|
|
|
|
|
if ("7".equals(status)) {
|
|
|
//已经分配医生
|
|
|
filterSql += " AND ( d.create_user = '" + doctorId + "' OR ISNULL( d.create_user ) ) \n" +
|
|
|
filterSql += " AND ( d.create_user = '" + doctorId + "' OR ISNULL( d.create_user ) ) " +
|
|
|
" AND ( ISNULL( d.type ) OR d.type = 2 ) and d.status='7' ";
|
|
|
filterSql += " ORDER BY d.create_time DESC ";
|
|
|
detailSql += filterSql + limitSql;
|
|
@ -1023,11 +1023,11 @@ public class RehabilitationInfoService {
|
|
|
public List<Map<String, Object>> getDetpAndDoctor(String doctorName, String deptCode, String deptName, String type, String disease) {
|
|
|
List<Map<String, Object>> list = null;
|
|
|
if ("1".equals(type)) {
|
|
|
String sql = "SELECT DISTINCT b.id 'diseaseId' ,b.`name` 'diseaseName',a.* \n" +
|
|
|
"FROM\n" +
|
|
|
" dict_hospital_dept a \n" +
|
|
|
" INNER JOIN base_disease_hospital b ON FIND_IN_SET(a.`code`, b.dept) > 0 \n" +
|
|
|
"WHERE 1 =1\n";
|
|
|
String sql = "SELECT DISTINCT b.id 'diseaseId' ,b.`name` 'diseaseName',a.* " +
|
|
|
"FROM " +
|
|
|
" dict_hospital_dept a " +
|
|
|
" INNER JOIN base_disease_hospital b ON FIND_IN_SET(a.`code`, b.dept) > 0 " +
|
|
|
"WHERE 1 =1 ";
|
|
|
if (StringUtils.isNotBlank(deptName)) {
|
|
|
sql += " and `name` LIKE '%" + deptName + "%'";
|
|
|
}
|
|
@ -1037,8 +1037,8 @@ public class RehabilitationInfoService {
|
|
|
list = jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
if ("2".equals(type)) {
|
|
|
String sql = "SELECT b.id 'doctorId',b.`name` 'doctorName' FROM base_doctor_hospital a \n" +
|
|
|
"INNER JOIN base_doctor b ON a.doctor_code=b.id \n" +
|
|
|
String sql = "SELECT b.id 'doctorId',b.`name` 'doctorName' FROM base_doctor_hospital a " +
|
|
|
"INNER JOIN base_doctor b ON a.doctor_code=b.id " +
|
|
|
"WHERE 1=1 ";
|
|
|
if (StringUtils.isNotBlank(deptCode)) {
|
|
|
sql += " and a.dept_code = '" + deptCode + "' ";
|
|
@ -1052,24 +1052,24 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getPatientInfo(String patientId, String idcard) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" b.sign_status 'signStatus',\n" +
|
|
|
" CASE \n" +
|
|
|
" WHEN b.sign_status='1' THEN '已家签'\n" +
|
|
|
" WHEN b.sign_status='0' THEN '未家签'\n" +
|
|
|
" END 'signStatusName',\n" +
|
|
|
" a.* \n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient a\n" +
|
|
|
" LEFT JOIN wlyy_rehabilitation_patient_info b ON a.id = b.patient \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND a.del = 1\n";
|
|
|
String sql = "SELECT " +
|
|
|
" b.sign_status 'signStatus', " +
|
|
|
" CASE " +
|
|
|
" WHEN b.sign_status='1' THEN '已家签' " +
|
|
|
" WHEN b.sign_status='0' THEN '未家签' " +
|
|
|
" END 'signStatusName', " +
|
|
|
" a.* " +
|
|
|
"FROM " +
|
|
|
" base_patient a " +
|
|
|
" LEFT JOIN wlyy_rehabilitation_patient_info b ON a.id = b.patient " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.del = 1 ";
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
sql += " AND a.id='" + patientId + "'\n";
|
|
|
sql += " AND a.id='" + patientId + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
sql += " AND a.idcard='" + idcard + "'\n";
|
|
|
sql += " AND a.idcard='" + idcard + "' ";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
@ -1087,48 +1087,60 @@ 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,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 "+sqlTem+" GROUP BY w.patient\n" +
|
|
|
" ) 'diseaseListName',\n" +
|
|
|
" (\n" +
|
|
|
" SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient \n" +sqlTem+
|
|
|
" ) '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" +sqlTem+
|
|
|
" )'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" +
|
|
|
" 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" +sqlTem+
|
|
|
" )'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`='1' AND w.patient = a.id \n" +sqlTem+
|
|
|
" )'finishCount',\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" +sqlTem+
|
|
|
" )'totayTask'\n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient a\n" +
|
|
|
" left JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
|
|
|
"SELECT DISTINCT " +
|
|
|
" a.idcard,a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age', " +
|
|
|
" ( " +
|
|
|
" 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 " +
|
|
|
" ) 'diseaseListName', " +
|
|
|
" ( " +
|
|
|
" 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', " +
|
|
|
" if(tu.num2 is null,0,tu.num2) 'finishCount', " +
|
|
|
" if(tt.num is null,0,tt.num) 'totayTask' " +
|
|
|
"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 "+
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = a.id \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND a.del = '1'\n";
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = a.id " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT " +
|
|
|
" w.patient,count(if(e.`status` = '0',1,null)) num1,count(if(e.`status` = '1',1,null)) num2 " +
|
|
|
" FROM " +
|
|
|
" 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+
|
|
|
" GROUP BY w.patient " +
|
|
|
") tu on tu.patient=a.id " +
|
|
|
"LEFT JOIN ( " +
|
|
|
" SELECT " +
|
|
|
" w.patient,count(1) num " +
|
|
|
" FROM " +
|
|
|
" 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+
|
|
|
" AND e.plan_time = DATE_FORMAT(NOW(), '%Y-%m-%d') " +
|
|
|
" AND e.`status` = '0' " +
|
|
|
" GROUP BY w.patient " +
|
|
|
") tt on tt.patient=a.id " +
|
|
|
"LEFT JOIN ( " +
|
|
|
" SELECT " +
|
|
|
" w.patient,count(1) num " +
|
|
|
" FROM " +
|
|
|
" 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+
|
|
|
" GROUP BY w.patient " +
|
|
|
") ti on ti.patient=a.id "+
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.del = '1' ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(doctorId) && StringUtils.isBlank(patientId)) {
|
|
|
//计划负责人或者任务执行人-执行人不为空
|
|
@ -1171,26 +1183,28 @@ 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,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" +
|
|
|
" 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" +
|
|
|
"SELECT DISTINCT " +
|
|
|
" a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age', " +
|
|
|
" ( " +
|
|
|
" 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 GROUP BY w.patient " +
|
|
|
" ) 'diseaseListName', " +
|
|
|
" if(t1.num is null,0,t1.num) 'unFinishCount' " +
|
|
|
"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 "+
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = b.patient \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND a.del = '1'\n";
|
|
|
" 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 " +
|
|
|
" 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 AND e.`status`='0' " +
|
|
|
" GROUP BY w.patient " +
|
|
|
" ) t1 on t1.patient=a.id "+
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.del = '1' ";
|
|
|
|
|
|
if (StringUtils.isNotBlank(doctorId)) {
|
|
|
//计划负责人或者任务执行人-执行人不为空
|
|
@ -1221,30 +1235,30 @@ public class RehabilitationInfoService {
|
|
|
* todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId, String planId,String diseaseId) {
|
|
|
String sql = "SELECT DISTINCT \n" +
|
|
|
" a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,TIMESTAMPDIFF(YEAR,a.birthday,NOW()) 'age',a.idcard,\n" +
|
|
|
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'" +
|
|
|
",d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
|
|
|
",d. `name` 'diseaseName',c.dept_name 'deptName', " +
|
|
|
" b.`status` 'planStatus', c.hospital_name 'hospitalName',b.medical_records_code medicalRecordsCode," +
|
|
|
" c.from_source, " +
|
|
|
" CASE \n" +
|
|
|
" WHEN c.from_source='1' THEN '手动添加'\n" +
|
|
|
" WHEN c.from_source='2' THEN '自动下转'\n" +
|
|
|
" WHEN c.from_source='3' THEN '扫码添加'\n" +
|
|
|
" END 'fromSourceName',\n" +
|
|
|
" CASE " +
|
|
|
" WHEN c.from_source='1' THEN '手动添加' " +
|
|
|
" WHEN c.from_source='2' THEN '自动下转' " +
|
|
|
" WHEN c.from_source='3' THEN '扫码添加' " +
|
|
|
" END 'fromSourceName', " +
|
|
|
" c.ijk_id, c.status,'patientStatus'," +
|
|
|
" b.advice_content 'adviceContent',\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" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.code = b.patient_info_code \n" +
|
|
|
" LEFT JOIN base_disease_hospital d ON d.id=b.disease\n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" b.advice_content 'adviceContent', " +
|
|
|
" (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', " +
|
|
|
" (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', " +
|
|
|
" (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', " +
|
|
|
" (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' " +
|
|
|
"FROM " +
|
|
|
" base_patient a " +
|
|
|
" LEFT JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info c ON c.code = b.patient_info_code " +
|
|
|
" LEFT JOIN base_disease_hospital d ON d.id=b.disease " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.del = '1' ";
|
|
|
if (StringUtils.isNotBlank(patientId)) {
|
|
|
sql += " AND a.id='" + patientId + "' ";
|
|
@ -1260,25 +1274,25 @@ public class RehabilitationInfoService {
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getRehabilitationPatientCountNew(String doctorId) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" CASE \n" +
|
|
|
" WHEN d.`status`='0' THEN '未下转'\n" +
|
|
|
" WHEN d.`status`='1' THEN '待分配'\n" +
|
|
|
// " WHEN d.`status`='2' THEN '创建计划过程失败'\n" +
|
|
|
// " WHEN d.`status`='3' THEN '患者无住院病历信息'\n" +
|
|
|
// " WHEN d.`status`='5' THEN '同步居民失败'\n" +
|
|
|
" WHEN d.`status`='7' THEN '已管理'\n" +
|
|
|
" END 'statusName',\n" +
|
|
|
" d.`status`,count(DISTINCT p.id) 'count' \n" +
|
|
|
"FROM\n" +
|
|
|
" base_patient p\n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient\n" +
|
|
|
" LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code` = q.patient_info_code \n" +
|
|
|
String sql = "SELECT " +
|
|
|
" CASE " +
|
|
|
" WHEN d.`status`='0' THEN '未下转' " +
|
|
|
" WHEN d.`status`='1' THEN '待分配' " +
|
|
|
// " WHEN d.`status`='2' THEN '创建计划过程失败' " +
|
|
|
// " WHEN d.`status`='3' THEN '患者无住院病历信息' " +
|
|
|
// " WHEN d.`status`='5' THEN '同步居民失败' " +
|
|
|
" WHEN d.`status`='7' THEN '已管理' " +
|
|
|
" END 'statusName', " +
|
|
|
" d.`status`,count(DISTINCT p.id) 'count' " +
|
|
|
"FROM " +
|
|
|
" base_patient p " +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient " +
|
|
|
" LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code` = q.patient_info_code " +
|
|
|
" LEFT JOIN wlyy_rehabilitation_plan_detail pd ON pd.plan_id = q.id " +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND ( d.create_user = '" + doctorId + "' OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) or pd.doctor='"+doctorId+"' ) \n" +
|
|
|
" AND ( ISNULL( d.type ) OR d.type = 2 )\n" +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" 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);
|
|
|
return list;
|
|
@ -1289,14 +1303,14 @@ public class RehabilitationInfoService {
|
|
|
* 查询病例信息
|
|
|
*/
|
|
|
public List<PatientMedicalRecordsDO> getPatientMedicalRecordsByPlanId(String planId) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" a.* \n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_patient_medical_records_rehabilitation a\n" +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan b ON a.`CODE` = b.medical_records_code \n" +
|
|
|
"WHERE\n" +
|
|
|
" b.id = '" + planId + "' \n" +
|
|
|
"ORDER BY\n" +
|
|
|
String sql = "SELECT " +
|
|
|
" a.* " +
|
|
|
"FROM " +
|
|
|
" wlyy_patient_medical_records_rehabilitation a " +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan b ON a.`CODE` = b.medical_records_code " +
|
|
|
"WHERE " +
|
|
|
" b.id = '" + planId + "' " +
|
|
|
"ORDER BY " +
|
|
|
" create_time DESC ";
|
|
|
List<PatientMedicalRecordsDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(PatientMedicalRecordsDO.class));
|
|
|
return list;
|
|
@ -1307,15 +1321,15 @@ public class RehabilitationInfoService {
|
|
|
* 查询康复计划服务项
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId, String itemId, String status) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" b.`name`,\n" +
|
|
|
String sql = "SELECT " +
|
|
|
" b.`name`, " +
|
|
|
" a.plan_id," +
|
|
|
" a.id, a.doctor,a.doctor_name,a.dept,a.dept_name \n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_rehabilitation_plan_detail a\n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_service_item b ON a.hospital_service_item_id = b.id \n" +
|
|
|
"WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" a.id, a.doctor,a.doctor_name,a.dept,a.dept_name " +
|
|
|
"FROM " +
|
|
|
" wlyy_rehabilitation_plan_detail a " +
|
|
|
" INNER JOIN wlyy_rehabilitation_service_item b ON a.hospital_service_item_id = b.id " +
|
|
|
"WHERE " +
|
|
|
" 1 = 1 " +
|
|
|
" AND a.plan_id = '" + planId + "'";
|
|
|
if (StringUtils.isNotBlank(itemId)) {
|
|
|
sql += " and b.id= '" + itemId + "'";
|
|
@ -1337,20 +1351,20 @@ 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" +
|
|
|
String sql = "SELECT DISTINCT q.* FROM ( " +
|
|
|
" SELECT " +
|
|
|
" a.id,a.`name`,a.mobile,a.photo,a.sex " +
|
|
|
" FROM " +
|
|
|
" base_doctor a " +
|
|
|
" INNER JOIN wlyy_rehabilitation_plan_detail b ON a.id = b.doctor " +
|
|
|
" WHERE 1=1 AND b.plan_id='" + planId + "' " +
|
|
|
" UNION ALL " +
|
|
|
" SELECT " +
|
|
|
" a.id,a.`name`,a.mobile,a.photo,a.sex " +
|
|
|
" FROM " +
|
|
|
" base_doctor a " +
|
|
|
" INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.plan_doctor " +
|
|
|
" WHERE 1=1 AND b.id='" + planId + "' " +
|
|
|
")q";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|