浏览代码

新增所有团队查询,按团队查询签约患者

liubing 3 年之前
父节点
当前提交
e8074d1e9b

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/visit/BaseVisitDao.java

@ -13,9 +13,9 @@ import java.util.List;
 */
 */
public interface BaseVisitDao  extends PagingAndSortingRepository<BaseVisitDO, String>, JpaSpecificationExecutor<BaseVisitDO> {
public interface BaseVisitDao  extends PagingAndSortingRepository<BaseVisitDO, String>, JpaSpecificationExecutor<BaseVisitDO> {
    @Query("select a from BaseVisitDO a where a.doctor = ?1 and a.visitPlanDate between ?2 and ?3 ")
    @Query("select a from BaseVisitDO a where a.doctor = ?1 and a.visitPlanDate between ?2 and ?3 order by a.visitPlanDate desc")
    List<BaseVisitDO> findByDoctor(String doctor, Date begin, Date end) throws Exception;
    List<BaseVisitDO> findByDoctor(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from BaseVisitDO a where a.visitPlanDate between ?1 and ?2 ")
    @Query("select a from BaseVisitDO a where a.visitPlanDate between ?1 and ?2 order by a.visitPlanDate desc ")
    List<BaseVisitDO> findByDoctor2(Date begin, Date end) throws Exception;
    List<BaseVisitDO> findByDoctor2(Date begin, Date end) throws Exception;
}
}

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

@ -645,4 +645,26 @@ public class SignEndpoint extends EnvelopRestEndpoint {
            return failedListEnvelopException2(e);
            return failedListEnvelopException2(e);
        }
        }
    }
    }
    /**
     * 按团队查找签约居民
     */
    @GetMapping(value = "findSignPatientByTeamCode")
    @ApiOperation(value = "按团队查找签约居民")
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode (
            @ApiParam(name = "teamCode", value = "团队code", required = false)
            @RequestParam(value = "teamCode",required = false) String teamCode,
            @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{
            return servicePackageService.findSignPatientByTeamCode(teamCode, name, page, size);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
}
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/team/TeamEndpoint.java

@ -216,4 +216,15 @@ public class TeamEndpoint extends EnvelopRestEndpoint {
            return failedListEnvelopException2(e);
            return failedListEnvelopException2(e);
        }
        }
    }
    }
    @RequestMapping(value = "/AllTeams", method = RequestMethod.GET)
    @ApiOperation(value = "查询机构下所有的团队(不翻译名称)")
    public ListEnvelop getAllTeams(){
        try{
            List<BaseTeamDO> teams =  teamService.findAllTeams();
            return ListEnvelop.getSuccess("查询成功",teams);
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
}
}

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

@ -6,6 +6,7 @@ import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.dao.sign.*;
import com.yihu.jw.care.dao.sign.*;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -81,6 +82,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    private WlyyPatientLabelDao patientLabelDao;
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    @Autowired
    private DictService dictService;
    private DictService dictService;
    @Autowired
    private DeviceService deviceService;
    public void addPatientSignList(){
    public void addPatientSignList(){
@ -794,4 +797,53 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;
    }
    }
    /**
     * 按团队和标签查找签约居民
     * @param teamCode
     * @return
     */
    public PageEnvelop<List<Map<String,Object>>> findSignPatientByTeamCode(String teamCode, String name,int page, int size){
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
        String paitentFilter = "";
        if(listtmp.size()>0){
            String jkzlPatients = String.valueOf(listtmp.get(0).get("orgCodes"));
            jkzlPatients = jkzlPatients.replaceAll(",","','");
            paitentFilter = " and p.id not in ('"+jkzlPatients+"') ";
        }
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex,p.pad_imei padImei " ;
        sql +=",(select COUNT(*) from wlyy_patient_device a where a.`user` = p.id and a.del=0) deviceFlag ";
        String countSql = "SELECT count(DISTINCT p.id) ";
        String filters ="";
        filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_patient p,wlyy_patient_label l " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and sr.patient = p.id and p.id = l.patient and l.label_type = 1 " ;
        if (StringUtils.isNotBlank(teamCode)){
            filters+= " and r.team_code =  '"+teamCode+"' ";
        }
        if(org.apache.commons.lang.StringUtils.isNotBlank(name)){
            filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
        }
        filters += paitentFilter;
        String orderBy = " ORDER BY sr.create_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map : list){
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
            //签约医生标识
            List<Map<String,Object>> doctorList = getServerDoctorAll(map.get("id").toString(),"0","1");
            List<Map<String,Object>> helperList = 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+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
}
}

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/team/BaseTeamService.java

@ -219,4 +219,18 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        List<BaseTeamDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseTeamDO.class));
        List<BaseTeamDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseTeamDO.class));
        return list;
        return list;
    }
    }
    public List<BaseTeamDO> findAllTeams(){
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        List<Map<String, Object>> listTmp = jdbcTemplate.queryForList(sqltmp);
        String filter = "";
        if (listTmp.size() > 0) {
            String orgCodes = String.valueOf(listTmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",", "','");
            filter = " and t.org_code not in ('" + orgCodes + "') ";
        }
        String sql = " SELECT t.* FROM base_team t WHERE t.del = '1' "+filter;
        List<BaseTeamDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseTeamDO.class));
        return list;
    }
}
}

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/visit/BaseVisitService.java

@ -67,6 +67,7 @@ public class BaseVisitService {
            for (Map<String, Object> map : temp.values()) {
            for (Map<String, Object> map : temp.values()) {
                re.add(map);
                re.add(map);
            }
            }
            re.sort(Comparator.comparing(obj -> ((Map<String,Object>) obj).get("date").toString()).reversed());
        }
        }
        return re;
        return re;