Browse Source

Merge branch 'pt' of dd.tall.wiki:ccsens_wiki/ccsenscloud into pt

recovery
zy_Java 5 years ago
parent
commit
c619e2d6f2
  1. 8
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java
  2. 6
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java
  3. 114
      wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java
  4. 13
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java
  5. 16
      wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml

8
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java

@ -36,8 +36,6 @@ public class StatisticsVo {
@Data @Data
@ApiModel("各个结点时长") @ApiModel("各个结点时长")
public static class PointTime{ public static class PointTime{
@ApiModelProperty("节点名")
private String name;
@ApiModelProperty("节点耗时") @ApiModelProperty("节点耗时")
private Long time; private Long time;
} }
@ -47,10 +45,10 @@ public class StatisticsVo {
@ApiModel("各个结点时长集合") @ApiModel("各个结点时长集合")
public static class PointTimeList{ public static class PointTimeList{
@ApiModelProperty("当前数据") @ApiModelProperty("当前数据")
private List<PointTime> pointTimeCurrentList; private List<Long> pointTimeCurrentList;
@ApiModelProperty("医院数据") @ApiModelProperty("医院数据")
private List<PointTime> pointTimeHospital; private List<Long> pointTimeHospital;
@ApiModelProperty("国际数据") @ApiModelProperty("国际数据")
private List<PointTime> pointTimeInternation; private List<Long> pointTimeInternation;
} }
} }

6
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java

@ -11,11 +11,11 @@ public interface StatisticsDao extends FirstAidMapper {
List<StatisticsVo.PointTime> getPointTimeCurrent(@Param("id") Long id); List<Long> getPointTimeCurrent(@Param("id") Long id);
List<StatisticsVo.PointTime> getPointTimeHospital(@Param("id") Long id); List<Long> getPointTimeHospital(@Param("id") Long id);
List<StatisticsVo.PointTime> getPointTimeInternation(@Param("id") Long id); List<Long> getPointTimeInternation(@Param("id") Long id);
public List<Integer> selResult(@Param("param")StatisticsDto.UseNum param); public List<Integer> selResult(@Param("param")StatisticsDto.UseNum param);

114
wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java

@ -1,57 +1,57 @@
package com.ccsens.wisdomcar.rabbitMQ; //package com.ccsens.wisdomcar.rabbitMQ;
//
import cn.hutool.core.collection.CollectionUtil; //import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; //import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; //import com.alibaba.fastjson.JSONObject;
import com.ccsens.util.bean.message.common.OutMessage; //import com.ccsens.util.bean.message.common.OutMessage;
import com.ccsens.util.bean.message.common.OutMessageSet; //import com.ccsens.util.bean.message.common.OutMessageSet;
import com.ccsens.util.config.RabbitMQConfig; //import com.ccsens.util.config.RabbitMQConfig;
import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto; //import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
import com.ccsens.wisdomcar.service.IRecordService; //import com.ccsens.wisdomcar.service.IRecordService;
import com.ccsens.wisdomcar.service.RecordService; //import com.ccsens.wisdomcar.service.RecordService;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler; //import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener; //import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
import javax.annotation.Resource; //import javax.annotation.Resource;
import java.util.List; //import java.util.List;
import java.util.Set; //import java.util.Set;
//
@Slf4j //@Slf4j
@Component //@Component
@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR) //@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR)
public class RabbitController { //public class RabbitController {
@Resource // @Resource
private IRecordService recordService; // private IRecordService recordService;
//
private Logger logger = LoggerFactory.getLogger(RabbitController.class); // private Logger logger = LoggerFactory.getLogger(RabbitController.class);
//
@RabbitHandler // @RabbitHandler
public void process(String messageJson) { // public void process(String messageJson) {
logger.info("平车上传消息数据: {}",messageJson); // logger.info("平车上传消息数据: {}",messageJson);
OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class); // OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class);
if(ObjectUtil.isNull(outMessageSet)){ // if(ObjectUtil.isNull(outMessageSet)){
return; // return;
} // }
Set<OutMessage> messageSet = outMessageSet.getMessageSet(); // Set<OutMessage> messageSet = outMessageSet.getMessageSet();
if (CollectionUtil.isEmpty(messageSet)) { // if (CollectionUtil.isEmpty(messageSet)) {
return; // return;
} // }
messageSet.forEach(outMessage -> { // messageSet.forEach(outMessage -> {
CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class); // CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class);
if(ObjectUtil.isNull(carRecordMessageDto)){ // if(ObjectUtil.isNull(carRecordMessageDto)){
return; // return;
} // }
try { // try {
recordService.disposeMessage(carRecordMessageDto); // recordService.disposeMessage(carRecordMessageDto);
} catch (Exception e) { // } catch (Exception e) {
log.error("处理平车信息异常",e); // log.error("处理平车信息异常",e);
e.printStackTrace(); // e.printStackTrace();
} // }
}); // });
} // }
//
} //}

13
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java

@ -59,19 +59,18 @@ public class StatisticsService implements IStatisticsService{
@Override @Override
public StatisticsVo.PointTimeList getPointTime(StatisticsDto.Hospital param) { public StatisticsVo.PointTimeList getPointTime(StatisticsDto.Hospital param) {
List<StatisticsVo.PointTime> pointTimeCurrent1 = new ArrayList<>(); List<Long> pointTimeCurrent1 = new ArrayList<>();
//当前数据 //当前数据
List<StatisticsVo.PointTime> pointTimeCurrent = statisticsDao.getPointTimeCurrent(param.getId()); List<Long> pointTimeCurrent = statisticsDao.getPointTimeCurrent(param.getId());
for (int i = 0; i <7; i++) { for (int i = 0; i <pointTimeCurrent.size() ; i++) {
if (i<6){ if (i<6){
pointTimeCurrent.get(i).setTime(pointTimeCurrent.get(i+1).getTime()/1000-pointTimeCurrent.get(i).getTime()/1000); pointTimeCurrent1.add(pointTimeCurrent.get(i+1)-pointTimeCurrent.get(i));
} }
} }
//医院数据 //医院数据
List<StatisticsVo.PointTime> pointTimeHospital = statisticsDao.getPointTimeHospital(param.getId()); List<Long> pointTimeHospital = statisticsDao.getPointTimeHospital(param.getId());
//国际数据 //国际数据
List<StatisticsVo.PointTime> pointTimeInternation = statisticsDao.getPointTimeInternation(param.getId()); List<Long> pointTimeInternation = statisticsDao.getPointTimeInternation(param.getId());
StatisticsVo.PointTimeList pointTimeList = new StatisticsVo.PointTimeList(); StatisticsVo.PointTimeList pointTimeList = new StatisticsVo.PointTimeList();
pointTimeList.setPointTimeCurrentList(pointTimeCurrent1); pointTimeList.setPointTimeCurrentList(pointTimeCurrent1);

16
wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml

@ -34,30 +34,28 @@ FROM
<select id="getPointTimeCurrent" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime"> <select id="getPointTimeCurrent" parameterType="java.util.Map" resultType="Long">
select tfar.begin_time, tfar.type as name select tfar.begin_time as time
from 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 where tfar.rec_status=0 and t.id = tfar.first_aid_id
</select> </select>
<select id="getPointTimeHospital" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime"> <select id="getPointTimeHospital" parameterType="java.util.Map" resultType="Long">
select select
ts.`name`,
MIN(tfas.duration)/1000 as time MIN(tfas.duration)/1000 as time
from from
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id 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; GROUP BY tfas.step_id;
</select> </select>
<select id="getPointTimeInternation" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime"> <select id="getPointTimeInternation" parameterType="java.util.Map" resultType="Long">
select select
ts.`name`,
MIN(tfas.duration)/1000 as time MIN(tfas.duration)/1000 as time
from from
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id 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; GROUP BY tfas.step_id;
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save