zdm 6 éve
szülő
commit
81f0e1ed7f

+ 2 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -381,12 +381,12 @@ public class SpecialistController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.specialist.searchPatientInSpecialist)
    @ApiOperation(value = "搜索注册居民")
    public MixEnvelop searchPatientInSpecialist(
            @ApiParam(name = "doctorCode", value = "医生code",required = true) @RequestParam(required = true)String doctorCode,
//            @ApiParam(name = "doctorCode", value = "医生code",required = true) @RequestParam(required = true)String doctorCode,
            @ApiParam(name = "keywords", value = "居民姓名,手机号,身份证") @RequestParam(required = false)String keywords,
            @ApiParam(name = "page", value = "第几页,1开始",defaultValue = "1") @RequestParam(required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页大小",defaultValue = "5") @RequestParam(required = true,defaultValue = "5")Integer pageSize){
        try {
            return specialistService.searchPatientInSpecialist(doctorCode,keywords,page,pageSize);
            return specialistService.searchPatientInSpecialistNew(keywords,page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 49 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -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);
    }
}