|
@ -3586,6 +3586,89 @@ public class FamilyContractService extends BaseService {
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getServerPatientListNum(Long teamCode,String level, String oldDoctorCode){
|
|
|
String serverSql="SELECT " +
|
|
|
" d.`code` As labelCode, " +
|
|
|
" d.`name` AS label " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_dict d " +
|
|
|
" WHERE " +
|
|
|
" d.type IN ('1', '2') " +
|
|
|
" AND d. YEAR = '"+DateUtil.getSignYear()+"' " +
|
|
|
" AND d.`code` NOT IN ( " +
|
|
|
" SELECT " +
|
|
|
" LEFT ( " +
|
|
|
" d. CODE, " +
|
|
|
" (INSTR(d. CODE, '-') - 1) " +
|
|
|
" ) AS CODE " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_dict d " +
|
|
|
" WHERE " +
|
|
|
" d. CODE LIKE '%-%' " +
|
|
|
" GROUP BY " +
|
|
|
" CODE " +
|
|
|
")";
|
|
|
String patientSql =" SELECT " +
|
|
|
" s.patient, " +
|
|
|
" s.server_type AS serverType, " +
|
|
|
" s.special_population AS specialPopulation, " +
|
|
|
" s.sign_year " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family s " +
|
|
|
" WHERE " +
|
|
|
" s.`status` >= 0 " +
|
|
|
" AND s.server_type IS NOT NULL AND s.server_type <>'3' "+
|
|
|
" AND s.admin_team_code =" +teamCode;
|
|
|
//1查询全科,其他查询健管师
|
|
|
if("2".equals(level)){
|
|
|
patientSql = patientSql+" AND s.doctor ='"+oldDoctorCode+"'";
|
|
|
}else{
|
|
|
patientSql = patientSql+" AND s.doctor_health ='"+oldDoctorCode+"'";
|
|
|
}
|
|
|
List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("count",(patientList!=null&&patientList.size()>0)?patientList.size():0);
|
|
|
|
|
|
List<Map<String,Object>> serlist = jdbcTemplate.queryForList(serverSql);
|
|
|
if(serlist!=null&&serlist.size()>0){
|
|
|
if(patientList!=null){
|
|
|
for(Map<String,Object> map :serlist){
|
|
|
String labelCode = (String)map.get("labelCode");
|
|
|
List<Map<String,String>> codes = new ArrayList<>();
|
|
|
Iterator iterator = patientList.iterator();
|
|
|
while(iterator.hasNext()){
|
|
|
Map<String,Object> p = ( Map<String,Object>)iterator.next();
|
|
|
String serverType = ((String)p.get("serverType"))==null?"":((String)p.get("serverType"));
|
|
|
if(labelCode.indexOf("-")==-1){
|
|
|
if(labelCode.equals(serverType)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}else{
|
|
|
String[] key = labelCode.split("-");
|
|
|
if(key[0].equals(serverType)){
|
|
|
Map<String,String> code = new HashMap<>();
|
|
|
code.put("code",(String)p.get("patient"));
|
|
|
codes.add(code);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
map.put("codes",codes);
|
|
|
map.put("number",(codes!=null&&codes.size()>0)?codes.size():0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
rs.put("patients",serlist);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> patientGroupByServerType(String doctor) {
|
|
|
|
|
|
// 先根据server_type分组查找wlyy_sign_family表中该医生的签约的患者,然后wlyy_sign_dict left join 得到全部的类型
|