|
@ -526,15 +526,13 @@ public class RehabilitationInfoService {
|
|
|
// "( SELECT DISTINCT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p WHERE i.create_user = '" + doctorCode + "' \n" +
|
|
|
// "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,NULL age,p.address,\n" +
|
|
|
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 and d.sign_status='1' \n" +
|
|
|
" INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient \n" +
|
|
|
" WHERE 1=1 " + filterSql +
|
|
|
" and d.create_user ='" + doctorCode + "' AND ( ISNULL(d.type) or d.type=2) 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" +
|
|
|
" AND d.create_user ='" + doctorCode + "' AND ( ISNULL(d.type) or d.type=2) \n" +
|
|
|
" AND d.`status`='0'\n" +
|
|
|
"GROUP BY d.patient ORDER BY d.create_time DESC ";
|
|
|
sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
@ -710,7 +708,7 @@ public class RehabilitationInfoService {
|
|
|
// "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 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" +
|
|
|
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" +
|
|
@ -760,6 +758,11 @@ public class RehabilitationInfoService {
|
|
|
JSONObject object = new JSONObject();
|
|
|
List<Map<String, Object>> res = new ArrayList<>();
|
|
|
|
|
|
if ("0".equals(isTurnDown)) {
|
|
|
//未下转居民
|
|
|
return noDown(idcard, doctorCode, page, pagesize, object);
|
|
|
}
|
|
|
|
|
|
if ("-2".equals(isTurnDown)) {
|
|
|
//未下转未加签
|
|
|
return noDownAndNoSign(idcard, doctorCode, page, pagesize, object);
|
|
@ -770,10 +773,6 @@ public class RehabilitationInfoService {
|
|
|
return noDownAndSign(idcard, doctorCode, page, pagesize, object);
|
|
|
}
|
|
|
|
|
|
if ("0".equals(isTurnDown)) {
|
|
|
//未下转居民
|
|
|
return noDown(idcard, doctorCode, page, pagesize, object);
|
|
|
}
|
|
|
//用户同时被接收未接收,先取最近时间的,在查询
|
|
|
if ("1".equals(isTurnDown)) {
|
|
|
//未接收 1 已下转
|
|
@ -1058,4 +1057,103 @@ public class RehabilitationInfoService {
|
|
|
List<RehabilitationAdviceDO> list = adviceDao.findByDoctor(doctorCode);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public JSONObject getRehabilitationPatientListNew(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, p.id 'patientId', p.phone, p.`name` 'patientName', p.sex, p.address, \n" +
|
|
|
" 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' ,\n" +
|
|
|
" DATE_FORMAT(q.create_time, '%Y-%m-%d %H:%i:%s') 'planCreateTime',d.ijk_id , " +
|
|
|
" d.problem_code,q.disease,q.disease_name \n" +
|
|
|
" FROM 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 " +
|
|
|
" 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";
|
|
|
String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
|
|
|
String filterSql = "";
|
|
|
if (StringUtils.isNotBlank(idcard)) {
|
|
|
filterSql += " and d.idcard='" + idcard + "'";
|
|
|
}
|
|
|
if (StringUtils.isBlank(status)) {
|
|
|
//看全部数据
|
|
|
filterSql += " (AND d.create_user = '" + doctorId + "' OR ISNULL( d.create_user ) )\n" +
|
|
|
" AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
|
|
|
detailSql += filterSql + limitSql;
|
|
|
countSql += filterSql;
|
|
|
list = jdbcTemplate.queryForList(detailSql);
|
|
|
Integer allCount = jdbcTemplate.queryForObject(countSql, Integer.class);
|
|
|
object.put("allCount", allCount);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(status)) {
|
|
|
if ("0".equals(status)) {
|
|
|
//未下转的人
|
|
|
filterSql += " AND (d.create_user = '" + doctorId + "' OR ISNULL(d.create_user)) AND ( ISNULL( d.type ) OR d.type = 2 ) " +
|
|
|
" and d.status='0' ";
|
|
|
filterSql += " ORDER BY d.create_time DESC ";
|
|
|
detailSql += filterSql + limitSql;
|
|
|
countSql += filterSql;
|
|
|
list = jdbcTemplate.queryForList(detailSql);
|
|
|
Integer unDownCount = jdbcTemplate.queryForObject(countSql, Integer.class);
|
|
|
object.put("unDownCount", unDownCount);//未下转的人
|
|
|
}
|
|
|
if ("1".equals(status)) {
|
|
|
//待分配的人
|
|
|
filterSql += " AND (d.create_user = '" + doctorId + "' OR ISNULL( d.create_user) )AND ( ISNULL( d.type ) OR d.type = 2 ) " +
|
|
|
" and d.status='1' ";
|
|
|
filterSql += " ORDER BY d.create_time DESC ";
|
|
|
detailSql += filterSql + limitSql;
|
|
|
countSql += filterSql;
|
|
|
list = jdbcTemplate.queryForList(detailSql);
|
|
|
Integer unAllocationCount = jdbcTemplate.queryForObject(countSql, Integer.class);
|
|
|
object.put("unAllocationCount", unAllocationCount);//待分配的人
|
|
|
}
|
|
|
|
|
|
if ("7".equals(status)) {
|
|
|
//已经分配医生
|
|
|
filterSql += " AND d.create_user = '" + doctorId + "' OR ISNULL( d.create_user )\n" +
|
|
|
" AND ( ISNULL( d.type ) OR d.type = 2 ) and d.status='7' ";
|
|
|
filterSql += " ORDER BY d.create_time DESC ";
|
|
|
detailSql += filterSql + limitSql;
|
|
|
countSql += filterSql;
|
|
|
list = jdbcTemplate.queryForList(detailSql);
|
|
|
Integer allocation = jdbcTemplate.queryForObject(countSql, Integer.class);
|
|
|
object.put("allocation", allocation);//已经分配
|
|
|
}
|
|
|
}
|
|
|
object.put("data", list);
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
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 * FROM dict_hospital_dept WHERE 1=1";
|
|
|
if (StringUtils.isNotBlank(deptName)) {
|
|
|
sql += " and `name` LIKE '%" + deptName + "%'";
|
|
|
}
|
|
|
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" +
|
|
|
"WHERE 1=1 ";
|
|
|
if (StringUtils.isNotBlank(deptCode)) {
|
|
|
sql += " and dept_code = '" + deptCode + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(doctorName)) {
|
|
|
sql += " and b.`name` LIKE '%" + deptName + "%'";
|
|
|
}
|
|
|
list = jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
}
|