Browse Source

代码修改

liubing 3 years ago
parent
commit
1ba4aad2c7

+ 26 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -702,7 +702,7 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "helper/patientList")
    @GetMapping(value = "helper/patientList")
    @ApiOperation(value = "助老员获取监护居民列表")
    public PageEnvelop<List<Map<String,Object>>> helperArchiveList(
            @ApiParam(name = "doctorId", value = "医生id", required = false)
@ -725,4 +725,29 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "helper/archiveList")
    @ApiOperation(value = "助老员获取社工签约居民列表")
    public PageEnvelop<List<Map<String,Object>>> helperArchiveList (
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId",required = true) String doctorId,
            @ApiParam(name = "hospital", value = "签约机构", required = false)
            @RequestParam(value = "hospital",required = false) String hospital,
            @ApiParam(name = "signStatus", value = "签约状态", required = false)
            @RequestParam(value = "signStatus",required = false) Integer signStatus,
            @ApiParam(name = "name", value = "居民姓名", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        try{
            if (StringUtils.isBlank(doctorId)&&StringUtils.isBlank(name)){
                return PageEnvelop.getError("请求参数错误");
            }
            return archiveService.helperArchiveList(doctorId,hospital,page,size,signStatus,name);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java

@ -130,7 +130,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
                    "where  pd.user = sr.patient and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
        }
        String orderBy = " ORDER BY sr.create_time,p.id DESC " +
        String orderBy = " ORDER BY ph.create_time,p.id DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map : list){
@ -156,7 +156,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
                " from wlyy_hospital_sys_dict dict  " +
                " LEFT JOIN (SELECT DISTINCT l.id,l.label_code  " +
                " from base_patient_helper ph, base_patient p,wlyy_patient_label l  " +
                " WHERE p.id = ph.patient and ph.del=1 and p.id = l.patient and l.label_type = 1)a  " +
                " WHERE p.id = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 and p.id = l.patient and l.label_type = 1)a  " +
                "  on dict.dict_code = a.label_code  " +
                " where dict.dict_name = '"+ConstantUtil.DICT_SERVICE_TYPE+"' and dict_code<>5   " +
                " GROUP BY labelCode,labelName ";

+ 45 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java

@ -246,4 +246,49 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    public PageEnvelop<List<Map<String,Object>>> helperArchiveList(String doctorId,String hospital, int page, int size,Integer signStatus,String name){
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        if (null==doctorDO){
            return null;
        }
        if (4!=doctorDO.getLevel()){
            return null;
        }
        String countSql = " select count(distinct p.id)  ";
        String  sql = " SELECT a.create_time,p.openid,p.pad_imei padImei,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status  " ;
        String filter = "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and p.del=1 and EXISTS( " +
                    "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                    "base_service_package_item i,base_team_member m " +
                    "WHERE  sr.id = r.sign_id and sr.patient = a.patient and sr.status=1 and r.service_package_id = i.service_package_id " +
                    "and i.del = 1 and m.team_code = r.team_code " ;
        if (StringUtils.isNotBlank(hospital)){//
            filter += " and m.org_code='"+hospital+"'   ";
        }
        if(StringUtils.isNotBlank(name)){
            filter += " and p.name like '%"+name+"%'";
        }
        filter+= " and m.del = '1' and sr.`status`=1 ) ";
        sql= sql+filter+ " group by p.id   "+"LIMIT "+ (page - 1) * size + "," + size ;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map :list){
            String idcard = map.get("idcard").toString();
            String patientId = map.get("id").toString();
            String sign_status = map.get("sign_status").toString();
            map.put("createTime", map.get("create_time").toString().substring(0,19));
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            if("1".endsWith(sign_status)){
                map.put("servicePackageList",servicePackageService.getServicePackageListByPatient(patientId,null));
            }
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
            List<Map<String,Object>> doctorList = servicePackageService.getServerDoctorAll(map.get("id").toString(),"0","1");
            List<Map<String,Object>> helperList = servicePackageService.getServerDoctorAll(map.get("id").toString(),"0","2");
            map.put("helper", helperList.size()>0?1:0);
            map.put("doctor", doctorList.size()>0?1:0);
        }
        Long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
}