|
@ -85,6 +85,14 @@ public class LabelService {
|
|
sign.setSignSource(json.getString("sign_source"));
|
|
sign.setSignSource(json.getString("sign_source"));
|
|
sign.setDiseaseCondition(json.getString("disease_condition"));
|
|
sign.setDiseaseCondition(json.getString("disease_condition"));
|
|
sign.setAdminTeamId(json.getString("admin_team_id"));
|
|
sign.setAdminTeamId(json.getString("admin_team_id"));
|
|
|
|
BasePatientDO patientDO = patientDao.findByIdcard(sign.getIdcard());
|
|
|
|
if(patientDO!=null){
|
|
|
|
if(sign.getPatient()==null){
|
|
|
|
sign.setPatient(patientDO.getId());
|
|
|
|
}
|
|
|
|
patientDO.setDiseaseCondition(Integer.parseInt(sign.getDiseaseCondition()));
|
|
|
|
patientDao.save(patientDO);
|
|
|
|
}
|
|
jsonArray.remove(i);
|
|
jsonArray.remove(i);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@ -108,13 +116,13 @@ public class LabelService {
|
|
*/
|
|
*/
|
|
public PageEnvelop signPage(Integer page,Integer size,String name,String idcard,String address,String hospitalName,String doctorName
|
|
public PageEnvelop signPage(Integer page,Integer size,String name,String idcard,String address,String hospitalName,String doctorName
|
|
,String health,String disease,String zbType,String zdyGroup,String diseaseCondition){
|
|
,String health,String disease,String zbType,String zdyGroup,String diseaseCondition){
|
|
String sql = "select distinct a.*,GROUP_CONCAT(if(l.label_type='1',l.label_name,null)) health " +
|
|
|
|
",GROUP_CONCAT(if(l.label_type='2',l.label_name,null)) disease " +
|
|
|
|
",GROUP_CONCAT(if(l.label_type='3',l.label_name,null)) zhType " +
|
|
|
|
",GROUP_CONCAT(if(l.label_type='4',l.label_name,null)) zdyGroup,d1.dict_value signSourceName,d2.dict_value statusName ";
|
|
|
|
|
|
String sql = "select distinct a.*,d1.dict_value signSourceName,d2.dict_value statusName ";
|
|
String countSql = "select count(distinct a.id)";
|
|
String countSql = "select count(distinct a.id)";
|
|
String filter = " from wlyy_sign a inner join base_patient p on a.patient=p.id " +
|
|
|
|
" left join wlyy_patient_label l on l.patient = p.id "+
|
|
|
|
|
|
String filter = " from wlyy_sign a left join base_patient p on a.patient=p.id " +
|
|
|
|
" left join wlyy_patient_label l1 on l1.patient = p.id and l1.label_type='1' "+
|
|
|
|
" left join wlyy_patient_label l2 on l2.patient = p.id and l2.label_type='2' "+
|
|
|
|
" left join wlyy_patient_label l3 on l3.patient = p.id and l3.label_type='3' "+
|
|
|
|
" left join wlyy_patient_label l4 on l4.patient = p.id and l4.label_type='4' "+
|
|
" left join wlyy_hospital_sys_dict d1 on d1.dict_name='ijk_sign_source' and d1.dict_code = a.sign_source "+
|
|
" left join wlyy_hospital_sys_dict d1 on d1.dict_name='ijk_sign_source' and d1.dict_code = a.sign_source "+
|
|
" left join wlyy_hospital_sys_dict d2 on d2.dict_name='ijk_sign_status' and d2.dict_code = a.status " +
|
|
" left join wlyy_hospital_sys_dict d2 on d2.dict_name='ijk_sign_status' and d2.dict_code = a.status " +
|
|
" where a.is_ncd=1 ";
|
|
" where a.is_ncd=1 ";
|
|
@ -135,22 +143,42 @@ public class LabelService {
|
|
filter += " and a.doctor_name like '%"+doctorName+"%' ";
|
|
filter += " and a.doctor_name like '%"+doctorName+"%' ";
|
|
}
|
|
}
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
if(StringUtils.isNotBlank(diseaseCondition)){
|
|
filter += " and a.diseaseCondition = '"+diseaseCondition+"' ";
|
|
|
|
|
|
filter += " and a.disease_condition = '"+diseaseCondition+"' ";
|
|
}
|
|
}
|
|
//1健康情况 2疾病类型 3专病类型 4自定义标签
|
|
//1健康情况 2疾病类型 3专病类型 4自定义标签
|
|
if(StringUtils.isNotBlank(health)){
|
|
if(StringUtils.isNotBlank(health)){
|
|
filter += " and l.label_type='1' and l.label_name = '"+health+"' ";
|
|
|
|
|
|
filter += " and (l1.label_name = '"+health+"' or a.health_ijk like '%"+health+"%' )";
|
|
}
|
|
}
|
|
if(StringUtils.isNotBlank(disease)){
|
|
if(StringUtils.isNotBlank(disease)){
|
|
filter += " and l.label_type='2' and l.label_name = '"+disease+"' ";
|
|
|
|
|
|
filter += " and (l2.label_name = '"+disease+"' or a.disease_ijk like '%"+disease+"%' )";
|
|
}
|
|
}
|
|
if(StringUtils.isNotBlank(zbType)){
|
|
if(StringUtils.isNotBlank(zbType)){
|
|
filter += " and l.label_type='3' and l.label_name = '"+zbType+"' ";
|
|
|
|
|
|
filter += " and l3.label_name = '"+zbType+"' ";
|
|
}
|
|
}
|
|
if(StringUtils.isNotBlank(zdyGroup)){
|
|
if(StringUtils.isNotBlank(zdyGroup)){
|
|
filter += " and l.label_type='4' and l.label_name = '"+zdyGroup+"' ";
|
|
|
|
|
|
filter += " and l4.label_name = '"+zdyGroup+"' ";
|
|
}
|
|
}
|
|
|
|
String labelSql = "SELECT IFNULL(GROUP_CONCAT(if(label_type='1',label_name,NULL)),'') health " +
|
|
|
|
",IFNULL(GROUP_CONCAT(if(label_type='2',label_name,NULL)),'') disease " +
|
|
|
|
",IFNULL(GROUP_CONCAT(if(label_type='3',label_name,NULL)),'') zbType " +
|
|
|
|
",IFNULL(GROUP_CONCAT(if(label_type='4',label_name,NULL)),'') zdyGroup " +
|
|
|
|
" from wlyy_patient_label WHERE patient = ? ";
|
|
List<WlyySign> list = jdbcTemplate.query(sql+filter+" GROUP BY a.id "+orderBy,new BeanPropertyRowMapper<>(WlyySign.class));
|
|
List<WlyySign> list = jdbcTemplate.query(sql+filter+" GROUP BY a.id "+orderBy,new BeanPropertyRowMapper<>(WlyySign.class));
|
|
|
|
for (WlyySign sign:list){
|
|
|
|
if(sign.getPatient()==null){
|
|
|
|
List<Map<String,Object>> labelList = jdbcTemplate.queryForList(labelSql,new Object[]{sign.getPatient()});
|
|
|
|
if(labelList.size()>0){
|
|
|
|
Map<String,Object> label = labelList.get(0);
|
|
|
|
sign.setHealth(label.get("health")+"");
|
|
|
|
sign.setDisease(label.get("disease")+"");
|
|
|
|
sign.setZbType(label.get("zbType")+"");
|
|
|
|
sign.setZdyGroup(label.get("zdyGroup")+"");
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
sign.setHealth(sign.getHealthIjk());
|
|
|
|
sign.setDisease(sign.getDiseaseIjk());
|
|
|
|
}
|
|
|
|
}
|
|
long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
|
|
}
|
|
}
|