Forráskód Böngészése

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 7 éve
szülő
commit
2ac0ee3c61

+ 1 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -27,7 +27,7 @@ import java.util.*;
 */
@Service
public class JobService {
    private Long sleepTime = 5000L;
    private Long sleepTime = 60000L;
    @Autowired
    private QuartzHelper quartzHelper;

+ 5 - 2
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/RenewSignDataFilter.java

@ -321,8 +321,11 @@ public class RenewSignDataFilter {
        //得到患者年龄
        StringBuffer returnLevel2KeyBuffer = new StringBuffer("0");
        //原来是身份证解析年龄,现在根据患者分组
        String group = cachePool.getPatientGroup(signFamily.getPatient());
        if ("3".equals(group)) {
        int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
        if (0 == age) {
            errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_idcard_error_age));
        }
        if (age >= 65) {
            returnLevel2KeyBuffer.append(",3");
        }
        //疾病标签

+ 5 - 2
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -377,8 +377,11 @@ public class SignDataFilter {
        //得到患者年龄
        StringBuffer returnLevel2KeyBuffer = new StringBuffer("0");
        //原来是身份证解析年龄,现在根据患者分组
        String group = cachePool.getPatientGroup(signFamily.getPatient());
        if ("3".equals(group)) {
        int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
        if (0 == age) {
            errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_idcard_error_age));
        }
        if (age >= 65) {
            returnLevel2KeyBuffer.append(",3");
        }
        //疾病标签

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -90,6 +90,9 @@ public interface DoctorAdminTeamDao extends
    @Query("from AdminTeam t WHERE t.available = true  AND t.orgCode = ?1 ")
    List<AdminTeam> findByOrgCode(String orgCode);
    @Query("from AdminTeam t WHERE t.available = true  AND t.townCode = ?1 ")
    List<AdminTeam> findByTownCode(String townCode);
    //  查询当前医生是否为团队长
    @Query("SELECT t.id from AdminTeam t WHERE t.available = true  AND t.leaderCode = ?1 ")
    Integer findLeader(String leaderCode);

+ 144 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2738,9 +2738,152 @@ public class StatisticsESService {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
        Integer interval = Integer.parseInt(type)+2;
        //签入统计
        List<SaveModel> inData = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.parseInt(SaveModel.teamLevel),"34","2",interval+"");
        Map<String, Object> map = null;
        List<Map<String, Object>> inList = new ArrayList<>();
        for(SaveModel one:inData){
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo",dateFormat.format(one.getQuotaDate()));
            }else{
                map.put("weekOfMonth",DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            }
            map.put("inCount",one.getResult2().longValue());
            inList.add(map);
        }
        //签出统计
        List<SaveModel> outData = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.parseInt(SaveModel.teamLevel),"35","2",interval+"");
        return null;
        List<Map<String, Object>> outList = new ArrayList<>();
        for(SaveModel one:outData){
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo",dateFormat.format(one.getQuotaDate()));
            }else{
                map.put("weekOfMonth",DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            }
            map.put("outCount",one.getResult2().longValue());
            outList.add(map);
        }
        JSONObject rs = new JSONObject();
        rs.put("inLine", inList);
        rs.put("outLine", outList);
        return rs;
    }
    public List<Map<String,Object>> getPrescriptionAgeLowLevel(String level,String lowlevel,String area,String disease) throws Exception{
        String quotaDate = elasticsearchUtil.getQuotaTime();
        List<SaveModel> list = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,Integer.parseInt(level),"58","2",lowlevel,disease);
        Map<String, Object> map = null;
        List<Map<String, Object>> rs = new ArrayList<>();
        if(list.size()>0){
            for(SaveModel one:list){
                map = new HashMap<>();
                if(Integer.parseInt(lowlevel)>=Integer.parseInt(level)){
                    lowlevel = String.valueOf(Integer.parseInt(level)+1);
                }
                if(SaveModel.townLevel.equals(lowlevel)){
                    map.put("code",one.getTown());
                    map.put("name",one.getTownName());
                }else if(SaveModel.OrgLevel.equals(lowlevel)){
                    map.put("code",one.getHospital());
                    map.put("name",one.getHospitalName());
                }else if(SaveModel.teamLevel.equals(lowlevel)){
                    map.put("code",one.getTeam());
                    map.put("name",one.getTeamName());
                }
                map.put("val",one.getResult2().longValue());
            }
        }else{
            //统计数据为空时,自建结果集
            List<Town> townList = null;
            List<Hospital> hospitalList = null;
            List<AdminTeam> adminTeams = null;
            if(SaveModel.cityLevel.equals(level)){
                townList = townDao.findByCityCode(area);
                hospitalList = hospitalDao.findByCity(area);
                adminTeams = findAllTeam();
            }else if(SaveModel.townLevel.equals(level)){
                hospitalList = hospitalDao.findByTownCode(area);
                adminTeams = adminTeamDao.findByTownCode(area);
            }else if(SaveModel.OrgLevel.equals(level)){
                adminTeams = adminTeamDao.findByOrgCode(area);
            }
            if(SaveModel.townLevel.equals(lowlevel)){
                for(Town one : townList){
                    map.put("code",one.getCode());
                    map.put("name",one.getName());
                    map.put("val",0);
                }
            }else if(SaveModel.OrgLevel.equals(lowlevel)){
                for(Hospital one : hospitalList){
                    map.put("code",one.getCode());
                    map.put("name",one.getName());
                    map.put("val",0);
                }
            }else if(SaveModel.teamLevel.equals(lowlevel)){
                for(AdminTeam one : adminTeams){
                    map.put("code",one.getLeaderCode());
                    map.put("name",one.getName());
                    map.put("val",0);
                }
            }
        }
        rs.add(map);
        return rs;
    }
    /**
     * 得到全部团队
     *
     * @return
     */
    private List<AdminTeam> findAllTeam() {
        String sql = "SELECT " +
                "  wat.id id, " +
                "  wat.name name, " +
                "  h.`code` org_code, " +
                "  h.`name` org_name, " +
                "  h.town   town_code, " +
                "  h.town_name  town_name " +
                "FROM " +
                "  dm_hospital h, " +
                "  wlyy_admin_team wat " +
                "WHERE " +
                "  h.`code` = wat.org_code " +
                "AND wat.available = 1";
        List<AdminTeam> adminTeams = jdbcTemplate.query(sql, new BeanPropertyRowMapper(AdminTeam.class));
        return adminTeams;
    }
    public Map<String,Object> getPrescriptionAgeHistogram(String level,String area,String disease) throws Exception{
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //统计年龄分布
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate,area,Integer.parseInt(level),"60","2",disease);
        //获取总人数
        String sql = " SELECT COUNT(1) AS num FROM ( SELECT DISTINCT p.patient FROM wlyy_prescription p ) a ";
        Map<String, Object> count = jdbcTemplate.queryForMap(sql);
        Long num = (Long)count.get("num");
        Map<String,Object> map = new HashMap<>();
        DecimalFormat decimalFormat=new DecimalFormat("0.00");//构造方法的字符格式这里如果小数不足2位,会以0补足.
        Double ageRate = list.get(0).getResult2()/num;
        map.put("0ageRate",decimalFormat.format(ageRate));
        ageRate = list.get(1).getResult2()/num;
        map.put("7ageRate",decimalFormat.format(ageRate));
        ageRate = list.get(2).getResult2()/num;
        map.put("19ageRate",decimalFormat.format(ageRate));
        ageRate = list.get(3).getResult2()/num;
        map.put("31ageRate",decimalFormat.format(ageRate));
        ageRate = list.get(4).getResult2()/num;
        map.put("51ageRate",decimalFormat.format(ageRate));
        ageRate = list.get(5).getResult2()/num;
        map.put("65ageRate",decimalFormat.format(ageRate));
        return map;
    }
    /**

+ 9 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -30,6 +30,8 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
@ -50,6 +52,7 @@ import org.springframework.web.multipart.MultipartRequest;
@Api(description = "文件上传")
public class FileUploadController extends BaseController {
    private Logger logger= LoggerFactory.getLogger(FileUploadController.class);
    @ApiParam
    FastDFSUtil fastDFSUtil;
    @Autowired
@ -93,7 +96,7 @@ public class FileUploadController extends BaseController {
                json.put("msg", "上传成功");
                // 图片标识对象的HTTP链接
                json.put("urls", String.join(",", firstPhoto));
                System.out.println("图片上传:" + json.toString());
                logger.info("图片上传:" + json.toString());
                return json.toString();
            } catch (Exception e) {
                error(e);
@ -161,7 +164,7 @@ public class FileUploadController extends BaseController {
                json.put("msg", "上传成功");
                // 图片标识对象的HTTP链接
                json.put("urls", urls);
                System.out.println("图片上传:" + json.toString());
               logger.info("图片上传:" + json.toString());
                return json.toString();
            } catch (Exception e) {
                error(e);
@ -273,7 +276,7 @@ public class FileUploadController extends BaseController {
                json.put("msg", "上传成功");
                // 图片标识对象的HTTP链接
                json.put("urls", urls);
                System.out.println("附件上传:" + json.toString());
               logger.info("附件上传:" + json.toString());
                return json.toString();
            } catch (Exception e) {
                error(e);
@ -339,7 +342,7 @@ public class FileUploadController extends BaseController {
                json.put("msg", "上传成功");
                // 图片标识对象的HTTP链接
                json.put("urls", urls);
                System.out.println("语音上传:" + json.toString());
               logger.info("语音上传:" + json.toString());
                return json.toString();
            } catch (Exception e) {
                error(e);
@ -468,7 +471,7 @@ public class FileUploadController extends BaseController {
                    json.put("msg", "上传成功");
                    // 图片标识对象的HTTP链接
                    json.put("urls", urls);
                    System.out.println("图片上传:" + json.toString());
                   logger.info("图片上传:" + json.toString());
                    return json.toString();
                } catch (Exception e) {
                    error(e);
@ -515,7 +518,7 @@ public class FileUploadController extends BaseController {
    private String request(String remote_url, MultipartFile file) {
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        System.out.println(file.getOriginalFilename());
       logger.info(file.getOriginalFilename());
        String result = "";
        try {
            String fileName = file.getOriginalFilename();

+ 57 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -1615,6 +1615,61 @@ public class EsStatisticsController extends BaseController {
        }
    }
    /**
     *年龄统计-下部列表(疾病维度)
     * @param level
     * @param lowlevel
     * @param area
     * @param disease
     * @return
     */
    @RequestMapping("/getPrescriptionAgeLowLevel")
    @ResponseBody
    @ApiOperation("年龄统计-下部列表")
    public String getPrescriptionAgeLowLevel(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                             @ApiParam(name="lowlevel", value="第二级别") @RequestParam(required = true)String lowlevel,
                                             @ApiParam(name="area", value="级别编码") @RequestParam(required = true)String area,
                                             @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease){
        try{
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            lowlevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowlevel))+"";
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionAgeLowLevel(level,lowlevel,area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionAgeHistogram")
    @ResponseBody
    @ApiOperation("年龄统计-中部部条形图")
    public String getPrescriptionAgeHistogram(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                              @ApiParam(name="area", value="级别编码") @RequestParam(required = true)String area,
                                              @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease){
        try{
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionAgeHistogram(level,area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionAgeTotal")
    @ResponseBody
    @ApiOperation("年龄统计-上部总数图")
    public String  getPrescriptionAgeTotal(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                           @ApiParam(name="area", value="级别编码") @RequestParam(required = true)String area,
                                           @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease){
        try{
            return write(200, "查询成功", "data", statisticsService.getPrescriptionAgeTotal(level,area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionTotalHistogram")
    @ResponseBody
    @ApiOperation("订单统计-中部树状图获取")
@ -1645,4 +1700,6 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /*=================================长处方分析end===============================================*/
}