|
@ -1722,68 +1722,81 @@ public class FamilyContractService extends BaseService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String, Object> findNoHealthSignFamilyHealth(String doctor, Integer page, Integer pagesize, String patientName, String patientAddr) {
|
|
|
Map<String, Object> returnMap = new HashMap();
|
|
|
if (pagesize == null || pagesize <= 0) {
|
|
|
pagesize = 10;
|
|
|
}
|
|
|
if (page == null || page <= 0) {
|
|
|
page = 1;
|
|
|
}
|
|
|
int start = (page - 1) * pagesize;
|
|
|
//先找出该医生下面没有健康管理师的患者 然后在去患者表找出该患者
|
|
|
StringBuffer sql = new StringBuffer("" +
|
|
|
" select p.* from wlyy_patient p where p.code in " +
|
|
|
" (select a.patient code from wlyy_sign_family a where a.type = 2 and a.status >= 1 and a.doctor_health is null and a.doctor='" + doctor + "' order by a.czrq desc ) ");
|
|
|
|
|
|
StringBuffer countSql = new StringBuffer("" +
|
|
|
" select count(*) from wlyy_patient p where p.code in " +
|
|
|
" (select a.patient code from wlyy_sign_family a where a.type = 2 and a.status >= 1 and a.doctor_health is null and a.doctor='" + doctor + "' order by a.czrq desc ) ");
|
|
|
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(patientName)) {
|
|
|
sql.append(" and name like '%" + patientName + "%'");
|
|
|
countSql.append(" and name like '%" + patientName + "%'");
|
|
|
}
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(patientAddr)) {
|
|
|
sql.append(" and address like '%" + patientAddr + "%'");
|
|
|
countSql.append(" and address like '%" + patientAddr + "%'");
|
|
|
}
|
|
|
sql.append(" limit " + start + "," + pagesize + "");
|
|
|
List<Patient> returnList = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper(Patient.class));
|
|
|
//得到疾病标签
|
|
|
StringBuffer dieaseSql = new StringBuffer("" +
|
|
|
" select p.* from wlyy_sign_patient_label_info p where p.label_type='2' and p.status=1 and p.patient in " +
|
|
|
" (select a.patient code from wlyy_sign_family a where a.type = 2 and a.status >= 1 and a.doctor_health is null and a.doctor='" + doctor + "' order by a.czrq desc ) ");
|
|
|
|
|
|
|
|
|
List<SignPatientLabelInfo> dieaseList = jdbcTemplate.query(dieaseSql.toString(), new BeanPropertyRowMapper(SignPatientLabelInfo.class));
|
|
|
Map<String, List<SignPatientLabelInfo>> diseaseMap = new HashMap<>();
|
|
|
if (dieaseList != null && dieaseList.size() > 0) {
|
|
|
for (SignPatientLabelInfo signPatientLabelInfo : dieaseList) {
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoTemp = diseaseMap.get(signPatientLabelInfo.getPatient());
|
|
|
if (signPatientLabelInfoTemp != null) {
|
|
|
signPatientLabelInfoTemp.add(signPatientLabelInfo);
|
|
|
} else {
|
|
|
signPatientLabelInfoTemp = new ArrayList<>();
|
|
|
signPatientLabelInfoTemp.add(signPatientLabelInfo);
|
|
|
}
|
|
|
diseaseMap.put(signPatientLabelInfo.getPatient(), signPatientLabelInfoTemp);
|
|
|
public JSONArray findNoHealthSignFamilyHealthByParams(String doctorCode, String patientAddr, String patientName) {
|
|
|
JSONArray returnMap = new JSONArray();
|
|
|
String sql = "select a.signcode,a.name,a.address,a.code,a.hasopenid,a.idcard from( SELECT " +
|
|
|
" sf.CODE signcode, " +
|
|
|
" p.name name, " +
|
|
|
" p.name address, " +
|
|
|
" p.code code, " +
|
|
|
" CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid, " +
|
|
|
" p.idcard idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf " +
|
|
|
" JOIN wlyy_patient p ON sf.patient = p.CODE " +
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
" and sf.doctor = ? "+
|
|
|
" AND ( sf.doctor_health is null or sf.doctor_health ='' ) ) a where 1=1" ;
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(patientAddr)){
|
|
|
sql+= " AND a.address like '%"+patientAddr+"%'";
|
|
|
}
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(patientName)){
|
|
|
sql+= " AND a.name like '%"+patientName+"%'";
|
|
|
}
|
|
|
List<Map<String, Object>> datas = jdbcTemplate.queryForList(sql, doctorCode );
|
|
|
if(datas!=null&&datas.size()>0){
|
|
|
for(Map<String, Object> map:datas){
|
|
|
returnMap.put(new JSONObject(map));
|
|
|
}
|
|
|
}
|
|
|
if (returnList != null && returnList.size() > 0) {
|
|
|
for (Patient patient : returnList) {
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoTemp = diseaseMap.get(patient.getCode());
|
|
|
patient.setLabelInfos(signPatientLabelInfoTemp);
|
|
|
return returnMap;
|
|
|
}
|
|
|
public JSONObject findNoHealthSignFamilyHealth(String doctorCode, String labelType, String patientName) {
|
|
|
JSONObject returnMap = new JSONObject();
|
|
|
//健康管理师
|
|
|
String sql = "SELECT " +
|
|
|
" sf. CODE signcode, " +
|
|
|
" p.name name, " +
|
|
|
" p.code code, " +
|
|
|
" CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid, " +
|
|
|
" sp.id labelid, " +
|
|
|
" CASE WHEN sp.label_name is null THEN '未标注' WHEN sp.label_name='' THEN '未标注' else sp.label_name END labelname, "+
|
|
|
" sp.label_type labeltype, " +
|
|
|
" p.idcard idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf " +
|
|
|
" JOIN wlyy_patient p ON sf.patient = p.CODE " +
|
|
|
" left JOIN wlyy_sign_patient_label_info sp ON sf.patient = sp.patient AND sp.label_type = ? AND sp.`status` = 1 " +
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
" and sf.doctor = ? "+
|
|
|
" AND ( sf.doctor_health is null or sf.doctor_health ='' ) " ;
|
|
|
List<Map<String, Object>> datas = null;
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql,labelType , doctorCode );
|
|
|
|
|
|
//根据类别查找标签
|
|
|
List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatus(labelType, 1);
|
|
|
if (s != null && s.size() > 0) {
|
|
|
for (SignPatientLabel one : s) {
|
|
|
returnMap.put(one.getLabelName(), new JSONArray());
|
|
|
}
|
|
|
if (datas != null && datas.size() > 0) {
|
|
|
for (Map<String, Object> map : datas) {
|
|
|
JSONObject jo = new JSONObject(map);
|
|
|
JSONArray jr = returnMap.getJSONArray(jo.get("labelname").toString());
|
|
|
//判断是否为空
|
|
|
if (jr == null) {
|
|
|
jr = new JSONArray();
|
|
|
}
|
|
|
jr.put(jo);
|
|
|
returnMap.put(jo.get("labelname").toString(), jr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Integer allCount = jdbcTemplate.queryForObject(countSql.toString(), Integer.class);
|
|
|
if (allCount % pagesize == 0) {
|
|
|
returnMap.put("count", allCount / pagesize);
|
|
|
} else {
|
|
|
returnMap.put("count", (allCount / pagesize) + 1);
|
|
|
}
|
|
|
returnMap.put("returnList", returnList);
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
@ -2038,54 +2051,48 @@ public class FamilyContractService extends BaseService {
|
|
|
List<Map<String, Object>> datas = null;
|
|
|
if (doctor.getLevel() == 3) {
|
|
|
//健康管理师
|
|
|
String sql = "SELECT sf. CODE signcode, " +
|
|
|
" p.`name` name, " +
|
|
|
" p. CODE `code`, " +
|
|
|
" case p.openid when null then 0 when \"\" then 0 else 1 end hasopenid, "+
|
|
|
" sp.id labelid, " +
|
|
|
" sp.label_name labelname, " +
|
|
|
" sp.label_type labeltype, "+
|
|
|
" p.idcard idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf, " +
|
|
|
" wlyy_patient p, " +
|
|
|
" wlyy_sign_patient_label_info sp " +
|
|
|
" WHERE" +
|
|
|
" sf.patient = p.CODE " +
|
|
|
" AND p. CODE = sp.patient " +
|
|
|
" AND sf.type = 2 " +
|
|
|
String sql = "SELECT " +
|
|
|
" sf. CODE signcode, " +
|
|
|
" p.name name, " +
|
|
|
" p.code code, " +
|
|
|
" CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid, " +
|
|
|
" sp.id labelid, " +
|
|
|
" CASE WHEN sp.label_name is null THEN '未标注' WHEN sp.label_name='' THEN '未标注' else sp.label_name END labelname, "+
|
|
|
" sp.label_type labeltype, " +
|
|
|
" p.idcard idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf " +
|
|
|
" JOIN wlyy_patient p ON sf.patient = p.CODE " +
|
|
|
" left JOIN wlyy_sign_patient_label_info sp ON sf.patient = sp.patient AND sp.label_type = ? AND sp.`status` = 1 " +
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
" and sp.`status`=1 " +
|
|
|
" and sf.doctor_health = ? " +
|
|
|
" and sp.label_type= ?";
|
|
|
" and sf.doctor_health = ? ";
|
|
|
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, labelType);
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode);
|
|
|
} else if (doctor.getLevel() == 2) {
|
|
|
//健康管理师
|
|
|
String sql = "SELECT sf. CODE signcode, " +
|
|
|
" p.`name` name, " +
|
|
|
" p. CODE `code`, " +
|
|
|
" sp.id labelid, " +
|
|
|
" sp.label_name labelname, " +
|
|
|
" case p.openid when null then 0 when \"\" then 0 else 1 end hasopenid, "+
|
|
|
" sp.label_type labeltype, "+
|
|
|
" p.idcard idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf, " +
|
|
|
" wlyy_patient p, " +
|
|
|
" wlyy_sign_patient_label_info sp " +
|
|
|
" WHERE" +
|
|
|
" sf.patient = p.CODE " +
|
|
|
" AND p. CODE = sp.patient " +
|
|
|
" AND sf.type = 2 " +
|
|
|
String sql = "SELECT " +
|
|
|
" sf. CODE signcode, " +
|
|
|
" p.name name, " +
|
|
|
" p.code code, " +
|
|
|
" CASE WHEN p.openid is null THEN '0' WHEN p.openid='' THEN '0' else 1 END hasopenid, " +
|
|
|
" sp.id labelid, " +
|
|
|
" CASE WHEN sp.label_name is null THEN '未标注' WHEN sp.label_name='' THEN '未标注' else sp.label_name END labelname, "+
|
|
|
" sp.label_type labeltype, " +
|
|
|
" p.idcard idcard " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf " +
|
|
|
" JOIN wlyy_patient p ON sf.patient = p.CODE " +
|
|
|
" left JOIN wlyy_sign_patient_label_info sp ON sf.patient = sp.patient AND sp.label_type = ? AND sp.`status` = 1 " +
|
|
|
" WHERE " +
|
|
|
" sf.type = 2 " +
|
|
|
" AND sf. STATUS >= 0 " +
|
|
|
" and sp.`status`=1 " +
|
|
|
" and ( sf.doctor = ? or sf.doctor_health = ? ) " +
|
|
|
" and sp.label_type= ?";
|
|
|
" and ( sf.doctor = ? or sf.doctor_health = ? ) ";
|
|
|
|
|
|
//查找居民
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode,doctorCode, labelType);
|
|
|
datas = jdbcTemplate.queryForList(sql, labelType, doctorCode, doctorCode);
|
|
|
|
|
|
} else {
|
|
|
throw new Exception("参数错误");
|
|
@ -2094,15 +2101,24 @@ public class FamilyContractService extends BaseService {
|
|
|
List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatus(labelType, 1);
|
|
|
if (s != null && s.size() > 0) {
|
|
|
for (SignPatientLabel one : s) {
|
|
|
returnMap.put(one.getLabelCode(), new JSONArray());
|
|
|
returnMap.put(one.getLabelName(), new JSONArray());
|
|
|
}
|
|
|
if (datas != null && datas.size() > 0) {
|
|
|
for (Map<String, Object> map : datas) {
|
|
|
JSONObject jo=new JSONObject(map);
|
|
|
returnMap.getJSONArray(jo.get("labeltype").toString()).put(jo);;
|
|
|
JSONObject jo = new JSONObject(map);
|
|
|
//判断name是否为空 为空就是未标注
|
|
|
//把患者添加到对应的组
|
|
|
JSONArray jr = returnMap.getJSONArray(jo.get("labelname").toString());
|
|
|
if (jr == null) {
|
|
|
jr = new JSONArray();
|
|
|
}
|
|
|
jr.put(jo);
|
|
|
returnMap.put(jo.get("labelname").toString(), jr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|