LAPTOP-KB9HII50\70708 vor 11 Monaten
Ursprung
Commit
1eab31ab21

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/wlyy/wlyyhttp/WlyyHttpService.java

@ -101,6 +101,7 @@ public class WlyyHttpService {
                return null;
            }
        }catch (Exception e){
            e.printStackTrace();
            logger.error("sendWlyyMes error:"+e.toString());
        }
        return null;
@ -212,6 +213,7 @@ public class WlyyHttpService {
                return null;
            }
        }catch (Exception e){
            e.printStackTrace();
            logger.error("sendWlyyMes error:"+e.toString());
        }
        return null;

+ 56 - 0
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -5682,6 +5682,62 @@ public class StatisticsEsService {
        }
    }
    /**
     * 医生圈app-文章统计头部
     *
     * @param flag      0自定义 1本月2近半年3本年
     * @param startDate 开始时间
     * @param endDate   结束时间
     * @param area      区域编码 如 level2 area传市编码
     * @param level     2 市  3区  4医院 5、科室 6医生
     * @return
     * @throws Exception
     */
    public JSONObject getArticleTotalApp(Integer flag, String startDate, String endDate, String area, int level,String slaveKey1) throws Exception {
        //发布量
        SaveModel saveModel = null;
        //收藏量
        SaveModel saveModel3 = null;
        //点赞量
        SaveModel saveModel2 = null;
        //评论量
        SaveModel saveModel1 = null;
        //浏览量
        SaveModel saveModel6 = null;
        if (flag == 1) {
            startDate = DateUtil.getFirstMonthDay() + " 00:00:00";
            endDate = DateUtil.getLastMonthDay() + " 23:59:59";
        } else if (flag == 2) {
            startDate = DateUtil.getMonthDate(new Date(), -6) + " 00:00:00";
            endDate = DateUtil.getStringDateShort() + " 23:59:59";
        } else if (flag == 3) {
            startDate = DateUtil.getCurrentYearStartTime() + " 00:00:00";
            endDate = DateUtil.getCurrentYearEndTime() + " 23:59:59";
        }
        JSONObject object = new JSONObject();
        //发布量统计
        saveModel = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "75", SaveModel.timeLevel_ZL,slaveKey1);
        Integer publishTotal = saveModel != null ? saveModel.getResult1().intValue() : 0;
        object.put("publishTotal", publishTotal);//发布量
        //收藏量统计
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, "76", SaveModel.timeLevel_ZL, slaveKey1, "3");
        Integer collectTotal = saveModel3 != null ? saveModel3.getResult1().intValue() : 0;
        object.put("collectTotal", collectTotal);//收藏量
        //点赞量统计
        saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, "76", SaveModel.timeLevel_ZL, slaveKey1, "2");
        Integer goodTotal = saveModel2 != null ? saveModel2.getResult1().intValue() : 0;
        object.put("goodTotal", goodTotal);//点赞量
        //评论量统计
        saveModel1 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, "76", SaveModel.timeLevel_ZL, slaveKey1, "1");
        Integer commentTotal = saveModel1 != null ? saveModel1.getResult1().intValue() : 0;
        object.put("commentTotal", commentTotal);//评论量
        //浏览量统计
        saveModel6 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "77", SaveModel.timeLevel_ZL,slaveKey1);
        Integer browseTotal = saveModel6 != null ? saveModel6.getResult1().intValue() : 0;
        object.put("browseTotal", browseTotal);//浏览量
        return object;
    }
    /**
     * 医生圈-文章统计头部

+ 4 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -47,6 +47,7 @@ import com.yihu.jw.im.dao.ConsultTeamLogDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImageCompress;
import com.yihu.jw.knowledge.dao.BaseSystemDialogSettingDao;
import com.yihu.jw.label.WlyyPatientLabelDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rehabilitation.ServiceItemPlanDao;
@ -169,7 +170,8 @@ public class ImService {
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private WlyyPatientLabelDao patientLabelDao;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
@ -4928,6 +4930,7 @@ public class ImService {
                map.put("patientAge", age);
                map.put("patientSex", sex);
            }
            map.put("labelList", patientLabelDao.findByPatient(map.get("id").toString(),doctor,"4"));
        }
        return list;
    }

+ 23 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -1026,6 +1026,29 @@ class EsStatisticsEndpoint extends EnvelopRestEndpoint {
        return success(result);
    }
    @GetMapping(value = "getArticleTotalApp")
    @ApiOperation(value = " app文章头部统计")
    public ObjEnvelop getArticleTotalApp(
            @ApiParam(name = "startDate", value = "开始时间", required = false)
            @RequestParam(value = "startDate", required = false) String startDate,
            @ApiParam(name = "endDate", value = "结束时间", required = false)
            @RequestParam(value = "endDate", required = false) String endDate,
            @ApiParam(name = "area", value = "区域编码 如 level2 area传市编码", required = true)
            @RequestParam(value = "area", required = true) String area,
            @ApiParam(name = "level", value = "2 市  3区  4医院 5、科室 6医生", required = true)
            @RequestParam(value = "level", required = true) int level,
            @ApiParam(name = "flag", value = "0自定义 1本月2近半年3本年", required = true)
            @RequestParam(value = "flag", required = true) Integer flag,
            @ApiParam(name = "slaveKey1", value = "slaveKey1", required = true)
            @RequestParam(value = "slaveKey1", required = false) String slaveKey1) {
        JSONObject result = new JSONObject();
        try {
            result = statisticsEsService.getArticleTotalApp(flag, startDate, endDate, area, level,slaveKey1);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return success(result);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Statistics.articleTotal)
    @ApiOperation(value = " 文章头部统计")

+ 39 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/StatisticsController.java

@ -32,6 +32,45 @@ public class StatisticsController extends EnvelopRestEndpoint {
    @Autowired
    private ExportUtl exportUtl;
    @GetMapping(value = "uploadAnalysis")
    @ApiOperation(value = "设备上传次数趋势")
    public ObjEnvelop uploadAnalysis(@RequestParam(required = false) String startDate,
                                     @RequestParam(required = false) String endDate) {
        try {
            JSONObject json = statisticsService.uploadAnalysis(startDate,endDate);
            return ObjEnvelop.getSuccess("查询成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "bindAnalysis")
    @ApiOperation(value = "绑定次数占比")
    public ObjEnvelop bindAnalysis(@RequestParam(required = false) String startDate,
                                     @RequestParam(required = false) String endDate) {
        try {
            JSONObject json = statisticsService.bindAnalysis(startDate,endDate);
            return ObjEnvelop.getSuccess("查询成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "deviceAnalysisTop")
    @ApiOperation(value = "设备分析头部统计")
    public ObjEnvelop deviceAnalysisTop(@RequestParam(required = false) String startDate,
                                     @RequestParam(required = false) String endDate) {
        try {
            JSONObject json = statisticsService.deviceAnalysisTop(startDate,endDate);
            return ObjEnvelop.getSuccess("查询成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    /**
     * 智能设备分析
     * strJson={"startDate":"2024-01-01","endDate":"2024-05-27","area":"350200","level":2}

+ 137 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/common/service/StatisticsService.java

@ -18,6 +18,143 @@ public class StatisticsService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 设备上传次数趋势
     */
    public JSONObject uploadAnalysis(String startDate,String endDate) throws Exception{
        JSONObject json = new JSONObject();
        String useSql = "SELECT COUNT(if(type=1,1,null)) xtBindNum,COUNT(if(type=2,1,null)) xyBindNum,DATE_FORMAT(czrq,'%Y-%m-%d') date" +
                " from wlyy_patient_health_index where del=1 ";
        if(StringUtils.isNotBlank(startDate)){
            useSql += " and czrq>='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            useSql += " and czrq<='"+endDate+" 23:59:59' ";
        }
        useSql += " GROUP BY date ORDER BY date ";
        List<Map<String,Object>> useList = jdbcTemplate.queryForList(useSql);
        json.put("useList",useList);
        return  json;
    }
    /**
     * 绑定次数占比
     */
    public JSONObject bindAnalysis(String startDate,String endDate) throws Exception{
        JSONObject json = new JSONObject();
        String sql = "SELECT COUNT(if(category_code=1,1,null)) xtBindNum,COUNT(if(category_code=2,1,null)) xyBindNum" +
                " from wlyy_patient_device where 1=1 ";
        if(StringUtils.isNotBlank(startDate)){
            sql += " and czrq>='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            sql += " and czrq<='"+endDate+" 23:59:59' ";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = list.get(0);
        int xtBindNum = Integer.parseInt(map.get("xtBindNum")+"");
        int xyBindNum = Integer.parseInt(map.get("xyBindNum")+"");
        int total = xtBindNum + xyBindNum;
        json.put("xtBindNum",xtBindNum);//血糖绑定次数
        json.put("xyBindNum",xyBindNum);//血压绑定次数
        json.put("total",total);//总绑定次数
        json.put("xtRate",getRange(xtBindNum,total));//血糖占比
        json.put("xyRate",getRange(xyBindNum,total));//血压占比
        return json;
    }
    /**
     * 设备分析头部统计
     * 1、【设备总数】:展示添加时间为查询时间内的设备总数;
     * 2、【血压计数量】:展示添加时间为查询时间内的设备总数;
     * 3、【血糖仪数量】:展示添加时间为查询时间内的设备总数;
     * 4、【投放科室】:展示添加时间为查询时间内的设备分配给科室的科室数量,需去重;
     * 5、【使用科室】:展示查询时间内有数据上传的科室的数量,需要去重;
     * 6、【绑定次数】:展示查询时间内,所有设备被绑定的次数;
     * 7、【上传次数】:展示查询时间段内所有设备的上传次数,
     * 8、【血糖仪上传】:展示查询时间段内所有血糖仪设备的数据上传次数;
     * 9、【血压计上传】:展示查询时间段内所有血压计设备的数据上传次数;
     */
    public JSONObject deviceAnalysisTop(String startDate,String endDate) throws Exception{
        JSONObject json = new JSONObject();
        String filterDevice = "";
        String filterUpload = "";
        String filterDept = "";
        String filterDeptUse = "";
        if(StringUtils.isNotBlank(startDate)){
            filterDevice += " and d.apply_date>='"+startDate+"' ";
            filterDept += " and apply_date>='"+startDate+"' ";
            filterDeptUse += " and d.apply_date>='"+startDate+"' and i.czrq>='"+startDate+"' ";
            filterUpload += " and czrq>='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            filterDevice += " and d.apply_date<='"+endDate+" 23:59:59' ";
            filterDept += " and apply_date<='"+endDate+" 23:59:59' ";
            filterDeptUse += " and d.apply_date<='"+endDate+" 23:59:59' and i.czrq<='"+endDate+" 23:59:59' ";
            filterUpload += " and czrq<='"+endDate+" 23:59:59' ";
        }
        //智能设备总数
        int devcieTotal = 0;
        int devcieXt = 0;//血糖仪数
        int devcieXy = 0;//血压计数
        String deviceSql = "SELECT dm.category_code type,COUNT(d.id) num FROM " +
                "wlyy_devices d INNER JOIN dm_device dm ON d.category_code = dm.id " +
                "where 1=1  " + filterDevice +
                "GROUP BY dm.category_code";
        List<Map<String,Object>> deviceList = jdbcTemplate.queryForList(deviceSql);
        for (Map<String,Object> map:deviceList){
            String type = map.get("type")+"";
            if("1".equals(type)){
                devcieXt = Integer.parseInt(map.get("num")+"");
            }
            if("2".equals(type)){
                devcieXy = Integer.parseInt(map.get("num")+"");
            }
        }
        devcieTotal = devcieXt+devcieXy;
        json.put("devcieTotal",devcieTotal);
        json.put("devcieXt",devcieXt);
        json.put("devcieXy",devcieXy);
        //设备上传次数
        int uploadTotal = 0;
        int uploadXt = 0;//
        int uploadXy = 0;//
        String uploadSql = "select type,count(id) num from wlyy_patient_health_index where 1=1 "+filterUpload+" group by type";
        List<Map<String,Object>> uploadList = jdbcTemplate.queryForList(uploadSql);
        for (Map<String,Object> map:uploadList){
            String type = map.get("type")+"";
            if("1".equals(type)){
                uploadXt = Integer.parseInt(map.get("num")+"");
            }
            if("2".equals(type)){
                uploadXy = Integer.parseInt(map.get("num")+"");
            }
        }
        uploadTotal = uploadXt+uploadXy;
        json.put("uploadTotal",uploadTotal);
        json.put("uploadXt",uploadXt);
        json.put("uploadXy",uploadXy);
        //投放科室数量
        String deptSql = "select count(DISTINCT dept) from wlyy_devices where dept is not null "+filterDept;
        String deptUseSql = "SELECT count(DISTINCT d.dept) from wlyy_devices d,wlyy_patient_health_index i " +
                "WHERE d.dept is not null and d.device_code=i.device_sn and i.del=1 "+filterDeptUse;
        int deptTotal = jdbcTemplate.queryForObject(deptSql,Integer.class);
        int deptUse = jdbcTemplate.queryForObject(deptUseSql,Integer.class);
        if(deptUse>deptTotal){
            deptUse = deptTotal;
        }
        //绑定次数
        String bindSql = "SELECT COUNT(*) num from wlyy_patient_device " +
                " where 1=1 "+filterUpload;
        int bindNum = jdbcTemplate.queryForObject(bindSql,Integer.class);
        json.put("deptTotal",deptTotal);
        json.put("deptUse",deptUse);
        json.put("bindNum",bindNum);//绑定次数
        return json;
    }
    /**
     * 智能设备分析