diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/api/StatisticsController.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/api/StatisticsController.java index 2a200399..30a6d4da 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/api/StatisticsController.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/api/StatisticsController.java @@ -29,14 +29,15 @@ public class StatisticsController { @Resource private IStatisticsService statisticsService; - @ApiOperation(value = "查看测评结果", notes = "") - @RequestMapping(value = "/get/result", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse getResult(@ApiParam @Validated @RequestBody QueryDto params) { - log.info("查看测评结果:{}",params); - StatisticsVo.FastEdResult fastEdResult = statisticsService.getResult(params.getParam()); - log.info("查看测评结果"); - return JsonResponse.newInstance().ok(fastEdResult); - } +// @ApiOperation(value = "查看测评结果", notes = "") +// @RequestMapping(value = "/get/result", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) +// public JsonResponse getResult(@ApiParam @Validated @RequestBody QueryDto params) { +// log.info("查看测评结果:{}",params); +// StatisticsVo.FastEdResult fastEdResult = statisticsService.getResult(params.getParam()); +// log.info("查看测评结果"); +// return JsonResponse.newInstance().ok(fastEdResult); +// } + @ApiOperation(value = "统计医院中小车得使用情况", notes = "") @RequestMapping(value = "/get/selResult", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse selResult(@ApiParam @Validated @RequestBody QueryDto params) { @@ -50,7 +51,7 @@ public class StatisticsController { @ApiOperation(value = "急救各个节点时间统计", notes = "") @RequestMapping(value = "/getPointTime", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse getPointTime(@ApiParam @Validated @RequestBody QueryDto params) { + public JsonResponse getPointTime(@ApiParam @Validated @RequestBody QueryDto params) { log.info("急救各个节点时间统计:{}",params); StatisticsVo.PointTimeList pointTime = statisticsService.getPointTime(params.getParam()); log.info("急救各个节点时间统计"); diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/StatisticsDto.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/StatisticsDto.java index 89a91716..333b589f 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/StatisticsDto.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/dto/StatisticsDto.java @@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull; @Data public class StatisticsDto { @Data - @ApiModel("查询小车本年和往年使用次数") + @ApiModel("医院id和年份") public static class UseNum{ @NotBlank @ApiModelProperty("year,比如直接传入 2020 即可") diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java index c3421426..5755ceed 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java @@ -36,8 +36,6 @@ public class StatisticsVo { @Data @ApiModel("各个结点时长") public static class PointTime{ - @ApiModelProperty("节点名") - private String name; @ApiModelProperty("节点耗时") private Long time; } @@ -47,10 +45,10 @@ public class StatisticsVo { @ApiModel("各个结点时长集合") public static class PointTimeList{ @ApiModelProperty("当前数据") - private List pointTimeCurrentList; + private List pointTimeCurrentList; @ApiModelProperty("医院数据") - private List pointTimeHospital; + private List pointTimeHospital; @ApiModelProperty("国际数据") - private List pointTimeInternation; + private List pointTimeInternation; } } diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java index db790d82..b4e92cd1 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java @@ -11,11 +11,11 @@ public interface StatisticsDao extends FirstAidMapper { - List getPointTimeCurrent(@Param("id") Long id); + List getPointTimeCurrent(@Param("id") Long id); - List getPointTimeHospital(@Param("id") Long id); + List getPointTimeHospital(@Param("id") Long id); - List getPointTimeInternation(@Param("id") Long id); + List getPointTimeInternation(@Param("id") Long id); public List selResult(@Param("param")StatisticsDto.UseNum param); diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java index bbccaf20..89d029af 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java @@ -1,57 +1,57 @@ -package com.ccsens.wisdomcar.rabbitMQ; - -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.ObjectUtil; -import com.alibaba.fastjson.JSONObject; -import com.ccsens.util.bean.message.common.OutMessage; -import com.ccsens.util.bean.message.common.OutMessageSet; -import com.ccsens.util.config.RabbitMQConfig; -import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto; -import com.ccsens.wisdomcar.service.IRecordService; -import com.ccsens.wisdomcar.service.RecordService; -import lombok.extern.slf4j.Slf4j; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.amqp.rabbit.annotation.RabbitHandler; -import org.springframework.amqp.rabbit.annotation.RabbitListener; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Set; - -@Slf4j -@Component -@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR) -public class RabbitController { - @Resource - private IRecordService recordService; - - private Logger logger = LoggerFactory.getLogger(RabbitController.class); - - @RabbitHandler - public void process(String messageJson) { - logger.info("平车上传消息数据: {}",messageJson); - OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class); - if(ObjectUtil.isNull(outMessageSet)){ - return; - } - Set messageSet = outMessageSet.getMessageSet(); - if (CollectionUtil.isEmpty(messageSet)) { - return; - } - messageSet.forEach(outMessage -> { - CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class); - if(ObjectUtil.isNull(carRecordMessageDto)){ - return; - } - try { - recordService.disposeMessage(carRecordMessageDto); - } catch (Exception e) { - log.error("处理平车信息异常",e); - e.printStackTrace(); - } - }); - } - -} +//package com.ccsens.wisdomcar.rabbitMQ; +// +//import cn.hutool.core.collection.CollectionUtil; +//import cn.hutool.core.util.ObjectUtil; +//import com.alibaba.fastjson.JSONObject; +//import com.ccsens.util.bean.message.common.OutMessage; +//import com.ccsens.util.bean.message.common.OutMessageSet; +//import com.ccsens.util.config.RabbitMQConfig; +//import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto; +//import com.ccsens.wisdomcar.service.IRecordService; +//import com.ccsens.wisdomcar.service.RecordService; +//import lombok.extern.slf4j.Slf4j; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.amqp.rabbit.annotation.RabbitHandler; +//import org.springframework.amqp.rabbit.annotation.RabbitListener; +//import org.springframework.stereotype.Component; +// +//import javax.annotation.Resource; +//import java.util.List; +//import java.util.Set; +// +//@Slf4j +//@Component +//@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR) +//public class RabbitController { +// @Resource +// private IRecordService recordService; +// +// private Logger logger = LoggerFactory.getLogger(RabbitController.class); +// +// @RabbitHandler +// public void process(String messageJson) { +// logger.info("平车上传消息数据: {}",messageJson); +// OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class); +// if(ObjectUtil.isNull(outMessageSet)){ +// return; +// } +// Set messageSet = outMessageSet.getMessageSet(); +// if (CollectionUtil.isEmpty(messageSet)) { +// return; +// } +// messageSet.forEach(outMessage -> { +// CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class); +// if(ObjectUtil.isNull(carRecordMessageDto)){ +// return; +// } +// try { +// recordService.disposeMessage(carRecordMessageDto); +// } catch (Exception e) { +// log.error("处理平车信息异常",e); +// e.printStackTrace(); +// } +// }); +// } +// +//} diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java index 9d75d3cd..29ee248b 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java @@ -129,28 +129,28 @@ public class RecordService implements IRecordService{ //第一个传感器 CarRecordMessageDto sensorMessage1 = new CarRecordMessageDto(); - BeanUtil.copyProperties(carRecordMessageDto,sensor1); + BeanUtil.copyProperties(carRecordMessageDto,sensorMessage1); sensorMessage1.setType(Constant.WEIGHT_SENSOR_1); sensorMessage1.setValue(sensor1 + ""); //发送消息 sendRecordMessage(sensorMessage1,userIdSet); //第二个传感器 CarRecordMessageDto sensorMessage2 = new CarRecordMessageDto(); - BeanUtil.copyProperties(carRecordMessageDto,sensor1); + BeanUtil.copyProperties(carRecordMessageDto,sensorMessage2); sensorMessage2.setType(Constant.WEIGHT_SENSOR_2); sensorMessage2.setValue(sensor2 + ""); //发送消息 sendRecordMessage(sensorMessage2,userIdSet); //第三个传感器 CarRecordMessageDto sensorMessage3 = new CarRecordMessageDto(); - BeanUtil.copyProperties(carRecordMessageDto,sensor1); + BeanUtil.copyProperties(carRecordMessageDto,sensorMessage3); sensorMessage3.setType(Constant.WEIGHT_SENSOR_3); sensorMessage3.setValue(sensor3 + ""); //发送消息 sendRecordMessage(sensorMessage3,userIdSet); //第四个传感器 CarRecordMessageDto sensorMessage4 = new CarRecordMessageDto(); - BeanUtil.copyProperties(carRecordMessageDto,sensor1); + BeanUtil.copyProperties(carRecordMessageDto,sensorMessage4); sensorMessage4.setType(Constant.WEIGHT_SENSOR_4); sensorMessage4.setValue(sensor4 + ""); //发送消息 @@ -161,9 +161,9 @@ public class RecordService implements IRecordService{ int shakeX = random.nextInt(65535); int shakeY = random.nextInt(65535); int shakeZ = random.nextInt(65535); - //第四个传感器 + //震动传感器 CarRecordMessageDto shakeMessage = new CarRecordMessageDto(); - BeanUtil.copyProperties(carRecordMessageDto,sensor1); + BeanUtil.copyProperties(carRecordMessageDto,shakeMessage); shakeMessage.setType(Constant.WEIGHT_SENSOR_4); shakeMessage.setValue(shakeX + "," + shakeY + "," + shakeZ); //发送消息 diff --git a/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java b/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java index f34d3892..0d3f2eef 100644 --- a/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java +++ b/wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java @@ -59,19 +59,18 @@ public class StatisticsService implements IStatisticsService{ @Override public StatisticsVo.PointTimeList getPointTime(StatisticsDto.Hospital param) { - List pointTimeCurrent1 = new ArrayList<>(); + List pointTimeCurrent1 = new ArrayList<>(); //当前数据 - List pointTimeCurrent = statisticsDao.getPointTimeCurrent(param.getId()); - for (int i = 0; i <7; i++) { + List pointTimeCurrent = statisticsDao.getPointTimeCurrent(param.getId()); + for (int i = 0; i pointTimeHospital = statisticsDao.getPointTimeHospital(param.getId()); + List pointTimeHospital = statisticsDao.getPointTimeHospital(param.getId()); //国际数据 - List pointTimeInternation = statisticsDao.getPointTimeInternation(param.getId()); + List pointTimeInternation = statisticsDao.getPointTimeInternation(param.getId()); StatisticsVo.PointTimeList pointTimeList = new StatisticsVo.PointTimeList(); pointTimeList.setPointTimeCurrentList(pointTimeCurrent1); diff --git a/wisdomcar/src/main/resources/application.yml b/wisdomcar/src/main/resources/application.yml index a47f2a7b..ac92adb9 100644 --- a/wisdomcar/src/main/resources/application.yml +++ b/wisdomcar/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev - include: common, util-dev + active: test + include: common, util-test diff --git a/wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml b/wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml index 33075334..66094caa 100644 --- a/wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml +++ b/wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml @@ -34,30 +34,29 @@ FROM - + select tfar.begin_time/1000 as time from - t_first_aid_record tfar ,(select id from t_first_aid tfa where tfa.hospital_id=0 and tfa.rec_status=0 ORDER BY tfa.begin_time) t + t_first_aid_record tfar ,(select id from t_first_aid tfa where tfa.hospital_id=#{id} and tfa.rec_status=0 ORDER BY tfa.begin_time) t where tfar.rec_status=0 and t.id = tfar.first_aid_id - select - ts.`name`, MIN(tfas.duration)/1000 as time from t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id - where tfas.hospital_id=0 and tfas.type=1 and tfas.rec_status = 0 and ts.rec_status=0 + where tfas.hospital_id=#{id} and tfas.type=1 and tfas.rec_status = 0 and ts.rec_status=0 GROUP BY tfas.step_id; - select - ts.`name`, MIN(tfas.duration)/1000 as time from t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id - where tfas.hospital_id=0 and tfas.type=0 and tfas.rec_status = 0 and ts.rec_status=0 + where tfas.hospital_id=#{id} and tfas.type=0 and tfas.rec_status = 0 and ts.rec_status=0 GROUP BY tfas.step_id; \ No newline at end of file