瀏覽代碼

xielianghe

lange 5 年之前
父節點
當前提交
c75fc509df

+ 41 - 0
whepi-web/src/main/java/com/bofeng/dao/MsReportMapper.java

@@ -22,8 +22,11 @@ import java.util.Map;
 public interface MsReportMapper extends BaseMapper<MsReport> {
 
     List<MsReport> selectByReportDate(@Param("reportDate") String reportDate, @Param("userCreate") Long userCreate);
+
     List<MsReport> selectByReportDateStatus(@Param("reportDate") String reportDate, @Param("userCreate") Long userCreate);
+
     List<MsReport> selectByReportDateTest(Map<String, Object> queryParam);
+
     List<MsSuspected> selectByReportDateTestxq(Map<String, Object> queryParam);
 
     @Select("select * from ms_report where report_date<curdate()  and user_create=#{userCreate} ORDER BY report_date desc LIMIT 1")
@@ -153,6 +156,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     /**
      * 最近15天确诊,疑似,密切接触者
+     *
      * @param userId
      * @return
      */
@@ -161,6 +165,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     /**
      * 最近是否填过确诊,疑似,密切接触者
+     *
      * @param userId
      * @return
      */
@@ -169,6 +174,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     /**
      * 最近状态 0无,1确诊,2疑似,3密切接触者,4解除隔离
+     *
      * @param userId
      * @return
      */
@@ -177,6 +183,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     /**
      * 最近去工作驻地的时间
+     *
      * @param userId
      * @return
      */
@@ -186,6 +193,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     /**
      * 最近去工作驻地的时间
+     *
      * @param userId
      * @return
      */
@@ -195,6 +203,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     /**
      * 当前人员今天的地址
+     *
      * @param userId
      * @return
      */
@@ -202,5 +211,37 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
             "FROM ms_report a LEFT JOIN ms_suspected b ON a.report_id = b.report_id LEFT JOIN ms_trip c ON b.suspected_id = c.trip_id WHERE a.report_status = 1 AND a.user_create = #{userId} ORDER BY a.report_date DESC LIMIT 1")
     MsReport msAddr(@Param("userId") Long userId);
 
+    //导出Ly异常
+    @Select("select u.uptown_name,uu.unit as orgName,uh.linkman as userName,uh.phone,ur.user_id\n" +
+            "from sys_user_role ur\n" +
+            "INNER JOIN sys_uptown_home uh on uh.house_id = ur.property_id\n" +
+            "INNER JOIN sys_uptown_house uh1 on uh1.house_id = ur.property_id\n" +
+            "INNER JOIN sys_uptown_unit uu on uu.unit_id = uh1.unit_id\n" +
+            "INNER JOIN sys_uptown u on u.uptown_id = uu.uptown_id\n" +
+            "where ur.role_id = 1 and u.uptown_name = '金湖家园'\n" +
+            "GROUP BY u.uptown_name,uu.unit,uh.linkman,uh.phone,ur.user_id")
+    List<MsReport> selectByReportSuspected();
+
+    //确诊、疑似、有接触史
+    @Select("select count(*)\n" +
+            "from ms_report a \n" +
+            "INNER JOIN ms_suspected b on a.report_id=b.report_id\n" +
+            "where a.report_status=1 and a.user_create=#{userId} and  b.medical=#{medical}")
+    Integer selectNum(@Param("userId") Long userId, @Param("medical") Integer medical);
+
+    //家人是否有接触史
+    @Select("select count(*)\n" +
+            "from ms_report a \n" +
+            "INNER JOIN ms_suspected b on a.report_id=b.report_id\n" +
+            "where a.report_status=1 and a.user_create=#{userId} and  b.is_contact=1")
+    Integer selectFamilyContactNum(@Param("userId") Long userId);
 
+    //病史
+    @Select("select DATE_FORMAT(a.report_date,'%Y-%m-%d') as reportDate,b.*\n" +
+            "from ms_report a \n" +
+            "INNER JOIN ms_suspected b on a.report_id=b.report_id\n" +
+            "where a.report_status=1 and a.user_create=#{userId}\n" +
+            "and (b.temperature<35 or b.temperature>37.3 or b.cough>0 or b.muscle>0 or b.dyspnea>0 or b.fatigue>0 or b.diarrhea>0)\n" +
+            "and a.report_date>date_add(NOW(), interval -1 MONTH)")
+    List<MsSuspected> selectSymptomNum(@Param("userId") Long userId);
 }

+ 33 - 0
whepi-web/src/main/java/com/bofeng/entity/MsReport.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import org.joda.time.DateTime;
@@ -85,4 +86,36 @@ public class MsReport {
     private String workMsg;
     @TableField(exist = false)
     private String todayMsg;
+
+    //导出ly异常
+    @ApiModelProperty("部门")
+    @TableField(exist = false)
+    private String orgName;
+    @ApiModelProperty("姓名")
+    @TableField(exist = false)
+    private String userName;
+    @ApiModelProperty("电话")
+    @TableField(exist = false)
+    private String phone;
+    @ApiModelProperty("用户编号")
+    @TableField(exist = false)
+    private Long userId;
+    @ApiModelProperty("是否有过确诊:0无,1有")
+    @TableField(exist = false)
+    private Integer isSure;
+    @ApiModelProperty("是否有过疑似:0无,1有")
+    @TableField(exist = false)
+    private Integer isSuspected;
+    @ApiModelProperty("是否有过病史:病史+时间")
+    @TableField(exist = false)
+    private String isSymptom;
+    @ApiModelProperty("是否有过接触:0无,1有")
+    @TableField(exist = false)
+    private Integer isContact;
+    @ApiModelProperty("家人是否有过确诊:0无,1有")
+    @TableField(exist = false)
+    private Integer isFamliyContact;
+    @ApiModelProperty("异地返回是否超过14天:0无,1有")
+    @TableField(exist = false)
+    private Integer isWork;
 }

+ 130 - 5
whepi-web/src/main/java/com/bofeng/service/MsReportService.java

@@ -4,19 +4,21 @@ package com.bofeng.service;
 import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.*;
 import com.bofeng.entity.*;
+import com.yvan.platform.Conv;
+import io.swagger.models.auth.In;
+import javassist.expr.NewArray;
 import org.apache.commons.lang3.tuple.Triple;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.servlet.ModelAndView;
 
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @Author: xielianghe
@@ -646,7 +648,130 @@ public class MsReportService {
 
             }
         }
-
         return msReports;
     }
+
+    //统计LY异常情况
+    public List<MsReport> getByReportSuspected() throws ParseException {
+        //获取所有的ly人员
+        List<MsReport> list = msReportMapper.selectByReportSuspected();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
+        List<MsReport> listReport = new ArrayList<>();
+        if (list != null && list.size() > 0) {
+            for (MsReport msReport : list) {
+                //是否确诊
+                Integer isSure = msReportMapper.selectNum(msReport.getUserId(), 1) > 0 ? 1 : 0;
+                //是否疑似
+                Integer isSuspected = msReportMapper.selectNum(msReport.getUserId(), 2) > 0 ? 1 : 0;
+                //是否有异常症状
+                String isSymptom = "";
+                List<MsSuspected> listSuspected = msReportMapper.selectSymptomNum(msReport.getUserId());
+                if (listSuspected != null && listSuspected.size() > 0) {
+                    for (MsSuspected msSuspected : listSuspected) {
+                        isSymptom += s.format(msSuspected.getReportDate().getTime()) + ",";
+                        if (Conv.NFloat(msSuspected.getTemperature()) < Conv.NFloat(35) || Conv.NFloat(msSuspected.getTemperature()) > Conv.NFloat(37.3))
+                            isSymptom += "体温:异常,";
+                        if (msSuspected.getCough() > 0)
+                            isSymptom += "咳嗽现象:" + getCough(msSuspected.getCough()) + ",";
+                        if (msSuspected.getMuscle() > 0)
+                            isSymptom += "肌肉酸痛:" + getMuscle(msSuspected.getMuscle()) + ",";
+                        if (msSuspected.getDyspnea() > 0)
+                            isSymptom += "呼吸困难:" + getDyspnea(msSuspected.getDyspnea()) + ",";
+                        if (msSuspected.getFatigue() > 0)
+                            isSymptom += "乏力现象:" + getFatigue(msSuspected.getFatigue()) + ",";
+                        if (msSuspected.getDiarrhea() > 0)
+                            isSymptom += "腹泻现象:" + getDiarrhea(msSuspected.getDiarrhea()) + ",";
+                    }
+                }
+                //是否有接触史
+                Integer isContact = msReportMapper.selectNum(msReport.getUserId(), 3) > 0 ? 1 : 0;
+                //家人是否有接触史
+                Integer isFamliyContact = msReportMapper.selectFamilyContactNum(msReport.getUserId()) > 0 ? 1 : 0;
+                //异地返工
+                Integer isWork = 0;
+                String returnWork = msReportMapper.returnWork(msReport.getUserId());
+                if (returnWork != null) {
+                    if (sdf.parse(returnWork + " 00:00:00").getTime() + 1000L * 3600 * 24 * 15 > sdf.parse(s.format(new Date()) + " 00:00:00").getTime()) {
+                        isWork = 1;
+                    }
+                }
+                //判断只要存在一种情况,就写进数据库
+                if (isSure > 0 || isSuspected > 0 || isSymptom != "" || isContact > 0 || isFamliyContact > 0 || isWork > 0) {
+                    msReport.setIsSure(isSure);
+                    msReport.setIsSuspected(isSuspected);
+                    msReport.setIsSymptom(isSymptom);
+                    msReport.setIsContact(isContact);
+                    msReport.setIsFamliyContact(isFamliyContact);
+                    msReport.setIsWork(isWork);
+                    listReport.add(msReport);
+                }
+            }
+        }
+        return listReport;
+    }
+
+    public String getCough(Integer cough) {
+        if (cough == 0)
+            return "无咳嗽";
+        else if (cough == 1)
+            return "偶尔短暂咳嗽";
+        else if (cough == 2)
+            return "咳嗽轻度影响生活";
+        else if (cough == 3)
+            return "咳嗽严重影响生活";
+        return "";
+    }
+
+    public String getMuscle(Integer muscle) {
+        if (muscle == 0)
+            return "无";
+        else if (muscle == 1)
+            return "按压有";
+        else if (muscle == 2)
+            return "偶尔";
+        else if (muscle == 3)
+            return "持续有";
+        return "";
+    }
+
+    public String getDyspnea(Integer dyspnea) {
+        if (dyspnea == 0)
+            return "无";
+        else if (dyspnea == 1)
+            return "急走或上坡气短";
+        else if (dyspnea == 2)
+            return "气短而走路变慢";
+        else if (dyspnea == 3)
+            return "走路数分钟后气短";
+        else if (dyspnea == 4)
+            return "气短无法离开房间";
+        return "";
+    }
+
+    public String getFatigue(Integer fatigue) {
+        if (fatigue == 0)
+            return "无";
+        else if (fatigue == 1)
+            return "体力劳动后不能恢复";
+        else if (fatigue == 2)
+            return "轻体力活非常累";
+        else if (fatigue == 3)
+            return "不能正常生活";
+        return "";
+    }
+
+
+    public String getDiarrhea(Integer diarrhea) {
+        if (diarrhea == 0)
+            return "无";
+        else if (diarrhea == 1)
+            return "轻度腹泻(少于3次)";
+        else if (diarrhea == 2)
+            return "中度腹泻(4-6次)";
+        else if (diarrhea == 3)
+            return "重度腹泻(超过6次)";
+        return "";
+    }
+
 }