|
@ -834,14 +834,24 @@ public class SpecialistService{
|
|
|
public JSONObject doctorForSpecialistInfo(String doctorCode, String patientCode) throws Exception{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
//1、获取居民基础信息
|
|
|
String preSql = "SELECT p.name as name,CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE '未知' END as sex,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') as age," +
|
|
|
" p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
|
|
|
String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
|
|
|
" CASE WHEN wsf.doctor_name is null THEN '无' ELSE wsf.doctor_name END as doctorName,CASE WHEN wsf.hospital_name is NULL THEN '无' ELSE wsf.hospital_name END as hospitalName,CASE WHEN wsf.mobile is NULL THEN '无' ELSE wsf.mobile END as doctorMobole ";
|
|
|
String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
|
|
|
" ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
|
|
|
" LEFT JOIN " + basedb + ".wlyy_doctor wd ON wsf.doctor =wd.code WHERE p.code='" + patientCode + "'";
|
|
|
//一个居民 生效的家签信息只会有一条
|
|
|
Map<String, Object> map = jdbcTemplate.queryForMap(preSql + patientSql);
|
|
|
map.put("age",IdCardUtil.getAgeForIdcard(map.get("idcard")+""));
|
|
|
String sexCode=IdCardUtil.getSexForIdcard_new(map.get("idcard")+"");
|
|
|
String sexName="";
|
|
|
if("1".equals(sexCode)){
|
|
|
sexName="男";
|
|
|
}else if("2".equals(sexCode)){
|
|
|
sexName="女";
|
|
|
}else{
|
|
|
sexName="未知";
|
|
|
}
|
|
|
map.put("sex",sexName);
|
|
|
jsonObject.put("patientInfo", map);
|
|
|
|
|
|
//2、获取医生信息(所属医院、科室、姓名)
|
|
@ -863,21 +873,14 @@ public class SpecialistService{
|
|
|
String disSql = "SELECT wtdr.disease_code, wtdr.disease_name from wlyy.wlyy_team_disease_relation wtdr WHERE wtdr.team_code ='" + i + "'" +" AND wtdr.del='1'";
|
|
|
//new BeanPropertyRowMapper(
|
|
|
List<Map<String, Object>> stringList = jdbcTemplate.queryForList(disSql);
|
|
|
|
|
|
String areaSql = " SELECT wspr.diseaseCode from wlyy_specialist.wlyy_specialist_patient_relation wspr WHERE wspr.patient='" + patientCode + "'" + " AND wspr.sign_status !='-1'";
|
|
|
List<Map<String, Object>> signDiseaseList = jdbcTemplate.queryForList(areaSql);
|
|
|
Set<String> stringSet = new HashSet<>();
|
|
|
signDiseaseList.stream().forEach(item -> {
|
|
|
String dis = (String) item.get("diseaseCode");
|
|
|
if(null!=dis&&StringUtils.isNotEmpty(dis)){
|
|
|
stringSet.addAll(new HashSet<>(Arrays.asList(dis.split(","))));
|
|
|
}
|
|
|
});
|
|
|
String areaSql = "SELECT wpds.disease FROM wlyy.wlyy_patient_disease_server wpds WHERE wpds.patient='" + patientCode + "'" + " AND wpds.del='1'";
|
|
|
List<String> signDiseaseList = jdbcTemplate.queryForList(areaSql,String.class);
|
|
|
Set<String> stringSet =new HashSet<>(signDiseaseList);
|
|
|
// stringSet.addAll(new HashSet<>(signDiseaseList));
|
|
|
//已签约的疾病状态改成1
|
|
|
stringList.stream().forEach(item->{
|
|
|
item.put("status",stringSet.contains( item.get("disease_code"))?1:0) ;
|
|
|
});
|
|
|
|
|
|
objectMap.put("teamDisease", stringList);
|
|
|
mapList.add(objectMap);
|
|
|
}
|