|
@ -952,4 +952,53 @@ public class SpecialistService{
|
|
|
List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
|
|
|
return relationDOS;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 专科-通过手机号码精确搜索注册居民
|
|
|
* @param keywords
|
|
|
*/
|
|
|
public MixEnvelop searchPatientInSpecialistNew(String keywords,Integer page,Integer pageSize) throws Exception{
|
|
|
String sql1 = " select count(1) as num ";
|
|
|
String sql2 = " select p.name as name,p.idcard,p.code,p.photo ,r.sign_status";
|
|
|
String whereSql ="";
|
|
|
if(!StringUtils.isEmpty(keywords)){
|
|
|
whereSql+=" and p.mobile ='"+keywords+"'";
|
|
|
}
|
|
|
//根据手机号码精确查找居民
|
|
|
String centerSql =" from "+basedb+".wlyy_patient p LEFT JOIN wlyy_specialist.wlyy_specialist_patient_relation r ON p.code=r.patient where p.openid IS NOT NULL "+whereSql;
|
|
|
String sqlCount=sql1+centerSql;
|
|
|
String sql=sql2+centerSql+" LIMIT "+(page-1)*pageSize+","+pageSize;
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String,Object>> countMap = jdbcTemplate.queryForList(sqlCount);
|
|
|
//根据居民查找专科签约状态
|
|
|
//已签约专科,获取签约信息
|
|
|
//未签约,获取居民信息,及专科医生信息
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
Map m = null;
|
|
|
Integer age = null;
|
|
|
String sex = null;
|
|
|
String sexName="";
|
|
|
for(Map<String,Object> one:map){
|
|
|
m = new HashMap();
|
|
|
age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
|
|
|
sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
|
|
|
m.put("name",one.get("name"));
|
|
|
m.put("age",age);
|
|
|
m.put("sex",sex);
|
|
|
m.put("sign_status", !(null != one.get("sign_status") && one.get("sign_status").toString()=="1") ? "1" : "0");
|
|
|
if("1".equals(sex)){
|
|
|
sexName="男";
|
|
|
}else if("2".equals(sex)){
|
|
|
sexName="女";
|
|
|
}else{
|
|
|
sexName="未知";
|
|
|
}
|
|
|
m.put("sexName",sexName);
|
|
|
m.put("patientCode",one.get("code"));
|
|
|
m.put("photo",one.get("photo"));
|
|
|
resultList.add(m);
|
|
|
}
|
|
|
return MixEnvelop.getSuccessListWithPage(SpecialistMapping.api_success,resultList,page,pageSize,countMap.size()>0?Long.valueOf(countMap.get(0).get("num")+""):0);
|
|
|
}
|
|
|
}
|