Browse Source

代码修改

suqinyi 10 months ago
parent
commit
adffbad19c

+ 33 - 2
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/LabelController.java

@ -61,10 +61,41 @@ public class LabelController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findLabelPatientGroupCount")
    @ApiOperation(value = "查询居民标签分组数量")
    public ListEnvelop findLabelPatientGroupCount(
            @ApiParam(name = "name", value = "姓名") @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "labelType", value = "1健康情况 2疾病类型 3专病类型 4自定义标签") @RequestParam(value = "labelType", required = false) String labelType
    ) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findLabelPatientGroupCount(name,labelType));
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findLabelPatientList")
    @ApiOperation(value = "查询居民标签分组数据")
    public ListEnvelop findLabelPatientList(
            @ApiParam(name = "name", value = "姓名") @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "labelType", value = "1健康情况 2疾病类型 3专病类型 4自定义标签") @RequestParam(value = "labelType", required = false) String labelType,
            @ApiParam(name = "labelCode", value = "类型") @RequestParam(value = "labelCode", required = false) String labelCode
    ) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findLabelPatientList(name,labelType,labelCode));
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findPatientLabel")
    @ApiOperation(value = "查询居民标签列表")
    public ListEnvelop findPatientLabel(@ApiParam(name = "patient", value = "居民id")
                                        @RequestParam(value = "patient", required = true) String patient) {
    public ListEnvelop findPatientLabel(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            return ListEnvelop.getSuccess("查询成功", labelService.findByPatient(patient));
        } catch (Exception e) {

+ 74 - 31
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/LabelService.java

@ -36,21 +36,21 @@ public class LabelService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public List<WlyyPatientLabelDO> findByPatient(String patient){
    public List<WlyyPatientLabelDO> findByPatient(String patient) {
        return patientLabelDao.findByPatient(patient);
    }
    //查询专病的康复管理未执行完成数量
    public int existDisease(String patient,String disease){
    public int existDisease(String patient, String disease) {
        String sql = "SELECT COUNT(id) from wlyy_patient_rehabilitation_plan " +
                " WHERE patient='"+patient+"' and disease ='"+disease+"' and `status` in (1,3)";
        return jdbcTemplate.queryForObject(sql,Integer.class);
                " WHERE patient='" + patient + "' and disease ='" + disease + "' and `status` in (1,3)";
        return jdbcTemplate.queryForObject(sql, Integer.class);
    }
    //添加专病标签
    public void addDiseaseLable(String patient,String disease,String diseaseName){
    public void addDiseaseLable(String patient, String disease, String diseaseName) {
        try {
            if(patientLabelDao.findByPatient(patient,disease,"3").size()==0){
            if (patientLabelDao.findByPatient(patient, disease, "3").size() == 0) {
                WlyyPatientLabelDO label = new WlyyPatientLabelDO();
                label.setCzrq(new Date());
                label.setIsSystem(0);
@ -60,52 +60,52 @@ public class LabelService {
                label.setLabelType("3");
                patientLabelDao.save(label);
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //查询标签新增日志
    public PageEnvelop patientLabelLogPage(String patient, String doctor, String labelType, int page, int size){
    public PageEnvelop patientLabelLogPage(String patient, String doctor, String labelType, int page, int size) {
        String sql = "select * ";
        String countSql = "select count(*) ";
        String filter = " from wlyy_patient_label_log where 1=1 ";
        String orderBy = " order by create_time desc limit "+(page-1)*size+","+size;
        if(StringUtils.isNotBlank(patient)){
            filter += " and patient = '"+patient+"' ";
        String orderBy = " order by create_time desc limit " + (page - 1) * size + "," + size;
        if (StringUtils.isNotBlank(patient)) {
            filter += " and patient = '" + patient + "' ";
        }
        if(StringUtils.isNotBlank(doctor)){
            filter += " and doctor = '"+doctor+"' ";
        if (StringUtils.isNotBlank(doctor)) {
            filter += " and doctor = '" + doctor + "' ";
        }
        if(StringUtils.isNotBlank(labelType)){
            filter += " and label_type = '"+labelType+"' ";
        if (StringUtils.isNotBlank(labelType)) {
            filter += " and label_type = '" + labelType + "' ";
        }
        List<WlyyPatientLabelLogDO> logDOS = jdbcTemplate.query(sql+filter+orderBy,new BeanPropertyRowMapper<>(WlyyPatientLabelLogDO.class));
        Long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",logDOS,page,size,count);
        List<WlyyPatientLabelLogDO> logDOS = jdbcTemplate.query(sql + filter + orderBy, new BeanPropertyRowMapper<>(WlyyPatientLabelLogDO.class));
        Long count = jdbcTemplate.queryForObject(countSql + filter, Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功", logDOS, page, size, count);
    }
    //保存居民标签
    @Transactional
    public void savePatientLabel(List<WlyyPatientLabelDO> labelDOS, String patient,String doctor) throws Exception{
    public void savePatientLabel(List<WlyyPatientLabelDO> labelDOS, String patient, String doctor) throws Exception {
        List<WlyyPatientLabelDO> patientLabelDOS = patientLabelDao.findByPatient(patient);
        Map<String,String> map = new HashMap<>();
        for (WlyyPatientLabelDO label:patientLabelDOS){
        Map<String, String> map = new HashMap<>();
        for (WlyyPatientLabelDO label : patientLabelDOS) {
            String labelCode = label.getLabelCode();
            String labelType = label.getLabelType();
            map.put(labelType+"_"+labelCode,label.getLabelName());
            map.put(labelType + "_" + labelCode, label.getLabelName());
        }
        patientLabelDao.deleteByPatient(patient);
        List<WlyyPatientLabelLogDO> labelLogDOS = new ArrayList<>();
        Date now = new Date();
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
        if(labelDOS!=null&&labelDOS.size()>0){
            for (WlyyPatientLabelDO label:labelDOS){
        if (labelDOS != null && labelDOS.size() > 0) {
            for (WlyyPatientLabelDO label : labelDOS) {
                label.setPatient(patient);
                label.setCzrq(new Date());
                label.setIsSystem(0);
                String key = label.getLabelType()+"_"+label.getLabelCode();
                if(!map.containsKey(key)){
                String key = label.getLabelType() + "_" + label.getLabelCode();
                if (!map.containsKey(key)) {
                    WlyyPatientLabelLogDO logDO = new WlyyPatientLabelLogDO();
                    logDO.setCreateTime(now);
                    logDO.setPatient(patient);
@ -119,20 +119,20 @@ public class LabelService {
                }
            }
            patientLabelDao.saveAll(labelDOS);
            if(labelLogDOS.size()>0){
            if (labelLogDOS.size() > 0) {
                logDao.saveAll(labelLogDOS);
            }
        }
    }
    //添加自定义标签字典
    public WlyyHospitalSysDictDO addLabelDict(String labelName) throws Exception{
        if(StringUtils.isBlank(labelName)){
    public WlyyHospitalSysDictDO addLabelDict(String labelName) throws Exception {
        if (StringUtils.isBlank(labelName)) {
            throw new ServiceException("请填写分组名称");
        }
        labelName = labelName.trim();
        List<WlyyHospitalSysDictDO> dictDOList = wlyyHospitalSysDictDao.findByDictNameAndDictCode("patient_lable_custom",labelName);
        if(dictDOList.size()>0){
        List<WlyyHospitalSysDictDO> dictDOList = wlyyHospitalSysDictDao.findByDictNameAndDictCode("patient_lable_custom", labelName);
        if (dictDOList.size() > 0) {
            throw new ServiceException("该分组已存在");
        }
        WlyyHospitalSysDictDO dictDO = new WlyyHospitalSysDictDO();
@ -142,4 +142,47 @@ public class LabelService {
        dictDO = wlyyHospitalSysDictDao.save(dictDO);
        return dictDO;
    }
    /**
     * //三院 labelType 1健康情况 2疾病类型 3专病类型 4自定义标签
     */
    public List<Map<String, Object>> findLabelPatientGroupCount(String name, String labelType) {
        String sql = "SELECT\n" +
                "	a.label_code,a.label_name,count(1) 'labelCount'\n" +
                "FROM\n" +
                "	wlyy_patient_label a\n" +
                "	INNER JOIN base_patient b ON a.patient=b.id\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "  AND a.label_type='" + labelType + "'";
        if (StringUtils.isNotBlank(name)) {
            sql += " AND b.`name` LIKE '%" + name + "%'\n";
        }
        sql += "GROUP BY a.label_code";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List findLabelPatientList(String name, String labelType, String labelCode) {
        String sql = "SELECT\n" +
                "	 a.label_code 'labelCode',a.label_name 'labelName',b.* \n" +
                "FROM\n" +
                "	wlyy_patient_label a\n" +
                "	INNER JOIN base_patient b ON a.patient=b.id\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "  AND a.label_type='" + labelType + "'";
        if (StringUtils.isNotBlank(name)) {
            sql += " AND b.`name` LIKE '%" + name + "%'\n";
        }
        if (StringUtils.isNotBlank(labelCode)) {
            sql += "  AND a.label_code='" + labelCode + "'";
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 7 - 5
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/controller/DoctorFollowUpController.java

@ -99,16 +99,18 @@ public class DoctorFollowUpController extends BaseController {
     */
    @RequestMapping(value = "/list_by", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(value = "查询居民随访列表")
    public String getListByPatient(@RequestParam @ApiParam(value = "居民Code") String patient,
                                          @RequestParam @ApiParam(value = "第几页") int page,
                                          @RequestParam @ApiParam(value = "页大小") int pagesize,
                                          @RequestParam(value = "type",required = false) @ApiParam(value = "类型:放空为全部,1计划,2记录",defaultValue = "0") String type) {
    public String getListByPatient(
            @RequestParam @ApiParam(value = "居民Code") String patient,
            @RequestParam @ApiParam(value = "医生Code") String doctorCode,
            @RequestParam @ApiParam(value = "第几页") int page,
            @RequestParam @ApiParam(value = "页大小") int pagesize,
            @RequestParam(value = "type",required = false) @ApiParam(value = "类型:放空为全部,1计划,2记录",defaultValue = "0") String type) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "请输入需查询的居民");
            }
            page = page > 0 ? page - 1 : 0;
            JSONArray result = followUpService.getListByPatient(patient, page, pagesize,type);
            JSONArray result = followUpService.getListByPatient(patient, page, pagesize,type,doctorCode);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return errorResult(e);

+ 6 - 12
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/dao/FollowUpDao.java

@ -82,27 +82,21 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    /**
     * 查找所有的随访数据
     * @param patient
     * @param pageable
     * @return
     */
    @Query("select d.id,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus," +
            "c.id,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode " +
            "from Followup a, BaseDoctorDO d, BaseDoctorDO c " +
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1  and a.status > '0'")
    Page<Object> findByPatient(String patient, PageRequest pageable);
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and a.doctorCode=?2  and a.status > '0'")
    Page<Object> findByPatient(String patient,String doctor, PageRequest pageable);
    /**
     * 查找所有的随访计划(未开始的归类为计划)
     * @param patient
     * @param pageable
     * @return
     */
    @Query("select d.id,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus," +
            "c.id,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode " +
            "from Followup a, BaseDoctorDO d, BaseDoctorDO c " +
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and a.status = '2'")
    Page<Object> findPlanByPatient(String patient, PageRequest pageable);
            "where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1  and a.doctorCode=?2 and a.status = '2' ")
    Page<Object> findPlanByPatient(String patient,String doctor, PageRequest pageable);
    /**
     * 查找所有的随访记录(进行中的,已完整的的归类为计划)
@ -113,8 +107,8 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select d.id,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus," +
            "c.id,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode " +
            "from Followup a, BaseDoctorDO d, BaseDoctorDO c" +
            " where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatient(String patient, PageRequest pageable);
            " where a.doctorCode = d.id and a.creater = c.id and a.patientCode = ?1 and a.doctorCode=?2  and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatient(String patient, String doctor,PageRequest pageable);
    /**
     * 查找所有的随访计划(未开始的归类为计划)

+ 6 - 4
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/service/FollowUpService.java

@ -360,21 +360,23 @@ public class FollowUpService {
     * @param type     类型:0全部,1计划,2记录
     * @return
     */
    public JSONArray getListByPatient(String patient, int page, int pageSize, String type) {
    public JSONArray getListByPatient(
            String patient, int page, int pageSize, String type,String doctorCode) {
//        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        PageRequest pageRequest = PageRequest.of(page, pageSize);
        Page<Object> result = null;
        if (StringUtils.isBlank(type)) {
            result = followupDao.findByPatient(patient, pageRequest);
            result = followupDao.findByPatient(patient,doctorCode, pageRequest);
        } else if ("1".equals(type)) {
            //已经开始的就是记录
            result = followupDao.findPlanByPatient(patient, pageRequest);
            result = followupDao.findPlanByPatient(patient,doctorCode, pageRequest);
        } else if ("2".equals(type)) {
            //未开始的就是计划
            result = followupDao.findRecordByPatient(patient, pageRequest);
            result = followupDao.findRecordByPatient(patient,doctorCode, pageRequest);
        } else {
            result = followupDao.findByPatient(patient,doctorCode, pageRequest);
        }