lange 5 роки тому
батько
коміт
14d7bdb0b3

+ 125 - 63
whepi-web/src/main/java/com/bofeng/controller/EpiLYExportController.java

@@ -1,8 +1,14 @@
 package com.bofeng.controller;
 
+import com.bofeng.dao.MsReportMapper;
+import com.bofeng.dao.UserOpenMapper;
+import com.bofeng.entity.*;
+import com.bofeng.service.MsReportService;
+import com.bofeng.service.MsTripService;
 import com.bofeng.word.WordUtils;
 import com.google.common.collect.Lists;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -10,42 +16,95 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 @RestController
 public class EpiLYExportController {
 
+    @Autowired
+    private UserOpenMapper userOpenMapper;
+    @Autowired
+    private MsReportMapper msReportMapper;
+    @Autowired
+    private MsTripService msTripService;
+    @Autowired
+    private MsReportService msReportService;
+
     @ApiOperation("导出单个健康及旅居申报表")
     @GetMapping("/whepi/export/lyReport")
     public @ResponseBody
     void exportSellPlan(HttpServletRequest request, HttpServletResponse response) {
-        Long suspectedId = Long.parseLong(request.getParameter("suspectedId"));
+        //Long userId = Long.parseLong(request.getParameter("1234"));
+        Long userId = 1234L;
+        String userName = "", workPlace = "", telPhone = "", isLeave = "", trip = "", blackTime = "", veicle = "", otherSymptom = "", isTrue = "";
+        //用户姓名,电话
+        UserOpen userOpen = userOpenMapper.selectUserBaseByUserId(userId);
+        if (userOpen != null) {
+            userName = userOpen.getLinkman();
+            telPhone = userOpen.getPhone();
+        }
+        //工作驻地
+        MsTrip msTrip = msReportMapper.selectWorkByUserId(userId);
+        if (msTrip != null)
+            workPlace = msReportService.getLocalOther(msTrip.getWorkLocal(), msTrip.getWorkLocalOther());
+        //是否离开过驻地
+        MsTrip msTrip1 = msReportMapper.selectIsTripByUserId(userId);
+        if (msTrip1 == null)
+            isLeave = "否";
+        else
+            isLeave = "是";
+        //15日居住地
+        List<MsTrip> listMsTrip = msReportMapper.select15TripByUserId(userId);
+        if (listMsTrip != null && listMsTrip.size() > 0) {
+            for (MsTrip msTrip2 : listMsTrip) {
+                trip += msReportService.getLocalOther(msTrip2.getTodayLocal(), msTrip2.getTodayLocalOther()) + ",";
+            }
+            trip = trip.substring(0, trip.length() - 1);
+        }
+        //返回时间
+        MsReport msReport = msReportMapper.selectBackTripByUserId(userId);
+        if (msReport != null) {
+            blackTime = msReport.getReportDate().toString();
+            //返回交通工具
+            List<MsTripDet> listMsTripDet = msReportMapper.selectBackTripByReportrId(msReport.getReportId());
+            if (listMsTripDet != null && listMsTripDet.size() > 0) {
+                for (MsTripDet msTripDet : listMsTripDet) {
+                    veicle += msReportService.getTripType(msTripDet.getTripType()) + ",";
+                }
+                veicle = veicle.substring(0, veicle.length() - 1);
+            }
+        }
         Map<String, Object> map = new HashMap<String, Object>();
-        map.put("userName", "张山");
-        map.put("workPlace", "武汉");
-        map.put("telPhone", "13245452345");
-        map.put("isLeave", "是");
-        map.put("trip", "北京、上海、武汉");
-        map.put("backTime", "2020-03-10");
-        map.put("vehicle", "火箭");
+        map.put("userName", userName);
+        map.put("workPlace", workPlace);
+        map.put("telPhone", telPhone);
+        map.put("isLeave", isLeave);
+        map.put("trip", trip);
+        map.put("backTime", blackTime);
+        map.put("vehicle", veicle);
 
         Map<String, Object> rt = new HashMap<String, Object>();
         map.put("rt", rt);
-        rt.put("d1", "02-20");
-        rt.put("d2", "02-21");
-        rt.put("d3", "02-22");
-        rt.put("d4", "02-23");
-        rt.put("d5", "02-24");
-        rt.put("t1", "-");
-        rt.put("t2", "37.0");
-        rt.put("t3", "36.6");
-        rt.put("t4", "36.6");
-        rt.put("t5", "36.8");
-
-        map.put("otherSymptom", "ee");
-        map.put("isTrue", "否");
+        for (int i = 1; i <= 5; i++) {
+            rt.put("d"+i, msReportService.getTimeByDate(i-5));
+            rt.put("t"+i,  msReportService.getTemperature(userId, i-5));
+        }
+
+        //是否有其他症状
+        List<MsSuspected> listSuspected1 = msReportMapper.selectOtherSymptomByReportrId(userId);
+        if (listSuspected1 != null && listSuspected1.size() > 0)
+            otherSymptom = "是";
+        else
+            otherSymptom = "否";
+        map.put("otherSymptom", otherSymptom);
+        Integer sureNum = msReportMapper.selectisSuspectedNum(userId);
+        if (sureNum == 0)
+            isTrue = "否";
+        else
+            isTrue = "是";
+        //是否确诊
+        map.put("isTrue", isTrue);
 
         WordUtils.exportWord("word/健康及旅居申报表_20200221.docx", "temp", "健康及旅居申报表.docx", map, request, response);
     }
@@ -83,8 +142,6 @@ public class EpiLYExportController {
             map.put("isTrue", "否");
             list.add(map);
         }
-
-
         WordUtils.exportWord("word/健康及旅居申报表_20200221.docx", "temp", "健康及旅居申报表.docx", list, request, response);
     }
 
@@ -92,47 +149,52 @@ public class EpiLYExportController {
     @GetMapping("/whepi/export/lyApprove")
     public @ResponseBody
     void lyApprove(HttpServletRequest request, HttpServletResponse response) {
+
+        //Long userId = Long.parseLong(request.getParameter("1234"));
+        Long userId = 1234L;
+        String userName = "", org = "", gander = "", bAddr = "", backDate = "",otherSymptom="";
+        //用户姓名,部门
+        UserOpen userOpen = userOpenMapper.selectUserBaseByUserId(userId);
+        if (userOpen != null) {
+            userName = userOpen.getLinkman();
+            org = userOpen.getRidgepole() + userOpen.getUnit();
+        }
+        //性别
+        MsSuspected msSuspected = msReportMapper.selectGrenderUserId(userId);
+        if (msSuspected != null) {
+            if (msSuspected.getGrender() == 1)
+                gander = "男";
+            if (msSuspected.getGrender() == 2)
+                gander = "女";
+        }
+
+        //返回时间
+        MsReport msReport = msReportMapper.selectBackTripByUserId(userId);
+        if (msReport != null) {
+            backDate = msReport.getReportDate().toString();
+            bAddr = msReportService.getLocalOther(msReport.getTodayLocal(), msReport.getTodayLocalOther());
+        }
         Map<String, Object> map = new HashMap<String, Object>();
-        map.put("userName", "张山");
-        map.put("gander", "男");
-        map.put("org", "研发部");
-        map.put("bAddr", "北京");
-        map.put("backDate", "2020-03-10");
+        map.put("userName", userName);
+        map.put("gander", gander);
+        map.put("org", org);
+        map.put("bAddr", bAddr);
+        map.put("backDate", backDate);
 
+        //最近15天体温
         Map<String, Object> rt = new HashMap<String, Object>();
         map.put("rt", rt);
-        rt.put("d1", "02-20");
-        rt.put("d2", "02-21");
-        rt.put("d3", "02-22");
-        rt.put("d4", "02-23");
-        rt.put("d5", "02-24");
-        rt.put("d6", "02-25");
-        rt.put("d7", "02-26");
-        rt.put("d8", "02-27");
-        rt.put("d9", "02-28");
-        rt.put("d10", "02-29");
-        rt.put("d11", "03-01");
-        rt.put("d12", "03-02");
-        rt.put("d13", "03-03");
-        rt.put("d14", "03-04");
-        rt.put("d15", "03-05");
-        rt.put("t1", "-");
-        rt.put("t2", "37.0");
-        rt.put("t3", "36.6");
-        rt.put("t4", "36.6");
-        rt.put("t5", "36.8");
-        rt.put("t6", "-");
-        rt.put("t7", "37.0");
-        rt.put("t8", "36.6");
-        rt.put("t9", "36.6");
-        rt.put("t10", "36.8");
-        rt.put("t11", "-");
-        rt.put("t12", "37.0");
-        rt.put("t13", "36.6");
-        rt.put("t14", "36.6");
-        rt.put("t15", "36.8");
-
-        map.put("otherSymptom", "无");
+        for (int i = 1; i <= 15; i++) {
+            rt.put("d"+i, msReportService.getTimeByDate(i-15));
+            rt.put("t"+i,  msReportService.getTemperature(userId, i-15));
+        }
+
+        List<MsSuspected> listSuspected1 = msReportMapper.selectOtherSymptomByReportrId(userId);
+        if (listSuspected1 != null && listSuspected1.size() > 0)
+            otherSymptom = "是";
+        else
+            otherSymptom = "否";
+        map.put("otherSymptom", otherSymptom);
 
         WordUtils.exportWord("word/隔离人员解除隔离审批表_20200221.docx", "temp", "隔离人员解除隔离审批表.docx", map, request, response);
     }

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

@@ -2,6 +2,9 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.MsReport;
+import com.bofeng.entity.MsSuspected;
+import com.bofeng.entity.MsTrip;
+import com.bofeng.entity.MsTripDet;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -52,6 +55,72 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
     Integer selectAbnormalNum(@Param("reportId") Long reportId);
 
     /**
+     * 导出word
+     */
+    //工作驻地
+    @Select("select a.*\n" +
+            "from ms_trip a\n" +
+            "LEFT JOIN ms_suspected b on a.trip_id=b.suspected_id\n" +
+            "LEFT JOIN ms_report c on b.report_id=c.report_id\n" +
+            "where c.report_status=1 and c.user_create=#{userId} ORDER BY c.report_date desc LIMIT 1")
+    MsTrip selectWorkByUserId(@Param("userId") Long userId);
+
+    //是否离开
+    @Select("select a.*\n" +
+            "from ms_trip a\n" +
+            "LEFT JOIN ms_suspected b on a.trip_id=b.suspected_id\n" +
+            "LEFT JOIN ms_report c on b.report_id=c.report_id\n" +
+            "where c.report_status=1 and c.user_create=#{userId} and (a.work_local!=a.today_local or a.work_local_other!=a.today_local_other) ORDER BY c.report_date desc LIMIT 1")
+    MsTrip selectIsTripByUserId(@Param("userId") Long userId);
+
+    //十五日居住地
+    @Select("select * from (\n" +
+            "select a.today_local,a.today_local_other\n" +
+            "from ms_trip a\n" +
+            "LEFT JOIN ms_suspected b on a.trip_id=b.suspected_id\n" +
+            "LEFT JOIN ms_report c on b.report_id=c.report_id\n" +
+            "where c.report_status=1  and c.user_create=#{userId}  ORDER BY c.report_date desc  LIMIT 15 ) tt GROUP BY tt.today_local,tt.today_local_other")
+    List<MsTrip> select15TripByUserId(@Param("userId") Long userId);
+
+    //返回驻地时间
+    @Select("select a.report_date,a.report_id,c.today_local,c.today_local_other \n" +
+            "from ms_report a \n" +
+            "LEFT JOIN ms_suspected b on a.report_id=b.report_id\n" +
+            "left join ms_trip c on b.suspected_id=c.trip_id\n" +
+            "where (c.work_local =c.today_local or c.work_local_other =c.today_local_other) and c.is_trip=1 and a.report_status=1 and a.user_create=#{userId}\n" +
+            "ORDER BY a.report_date desc LIMIT 1")
+    MsReport selectBackTripByUserId(@Param("userId") Long userId);
+
+    //返回驻地交通方式
+    @Select("select a.trip_type\n" +
+            "from ms_trip_det a\n" +
+            "left JOIN ms_suspected b on a.trip_id=b.suspected_id where b.report_id=#{reportId} GROUP BY a.trip_type\n")
+    List<MsTripDet> selectBackTripByReportrId(@Param("reportId") Long reportId);
+
+    //近5日的
+    @Select("select b.temperature\n" +
+            "from ms_report a\n" +
+            "LEFT JOIN ms_suspected b on a.report_id=b.report_id\n" +
+            "where a.report_status=1 and a.user_create=#{userId} and a.report_date=#{reportDate}\n")
+    MsSuspected select5ByReportrId(@Param("userId") Long userId, @Param("reportDate") String reportDate);
+
+    //是否有其他症状
+    @Select("select b.*\n" +
+            "from ms_report a\n" +
+            "LEFT JOIN ms_suspected b on a.report_id=b.report_id\n" +
+            "where a.report_status=1  and a.user_create=#{userId} and (b.cough>0 or b.muscle>0 or b.dyspnea>0 or b.fatigue>0 or b.diarrhea>0)\n")
+    List<MsSuspected> selectOtherSymptomByReportrId(@Param("userId") Long userId);
+
+    //是否确诊
+    @Select("select count(a.suspected_id) from ms_suspected a inner join ms_report b on a.report_id=b.report_id where a.medical in (1,2,3) and b.report_status=1 and b.user_create=#{userId}")
+    Integer selectAbnormalNumUserId(@Param("userId") Long userId);
+
+    //性别
+    @Select("select a.* from ms_suspected a inner join ms_report b on a.report_id=b.report_id where b.report_status=1 and b.user_create=#{userId}")
+    MsSuspected selectGrenderUserId(@Param("userId") Long userId);
+
+
+    /**
      * 最近3天是否都有上报
      *
      * @param userId

+ 2 - 0
whepi-web/src/main/java/com/bofeng/dao/UserOpenMapper.java

@@ -31,4 +31,6 @@ public interface UserOpenMapper extends BaseMapper<UserOpen> {
     List<UserOpen> getOpenUser(@Param("start") Long start, @Param("count") Long count);
 
     List<UserOpen> getUsersByUptownId(@Param("uptownId") Long uptownId);
+
+    UserOpen selectUserBaseByUserId(@Param("userId") Long userId);
 }

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

@@ -72,4 +72,8 @@ public class MsReport {
 
     @TableField(exist = false)
     private String msgReport = "";
+    @TableField(exist = false)
+    private Integer todayLocal = 0;
+    @TableField(exist = false)
+    private String todayLocalOther = "";
 }

+ 10 - 0
whepi-web/src/main/java/com/bofeng/entity/UserOpen.java

@@ -54,4 +54,14 @@ public class UserOpen {
 
     @TableField("head_img_url")
     private String headImgUrl;
+
+    //导出word
+    @TableField(exist = false)
+    private String linkman = "";
+    @TableField(exist = false)
+    private String phone = "";
+    @TableField(exist = false)
+    private String ridgepole = "";
+    @TableField(exist = false)
+    private String unit = "";
 }

+ 29 - 2
whepi-web/src/main/java/com/bofeng/service/MsReportService.java

@@ -140,8 +140,7 @@ public class MsReportService {
             //今天不存在
             if (listReport1 != null && listReport1.size() > 0)
                 msReport = msReportMapper.selectById(Long.parseLong(listReport1.get(0).getReportId().toString()));
-        }
-        else {
+        } else {
 
             msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
         }
@@ -482,4 +481,32 @@ public class MsReportService {
     }
 
 
+    //获取时间
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public String getTimeByDate(Integer numdate) {
+        String reportDate = "";
+        SimpleDateFormat sj = new SimpleDateFormat("yyyy-MM-dd");
+        Date d = new Date();
+        if (numdate == 0) {
+            reportDate = sj.format(d);
+        } else {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(d);
+            calendar.add(Calendar.DATE, numdate);
+            reportDate = sj.format(calendar.getTime());
+        }
+        return reportDate;
+    }
+
+    //获取温度
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public String getTemperature(Long userId, Integer numdate) {
+        String temperature = "-";
+        MsSuspected msSuspected = msReportMapper.select5ByReportrId(userId, getTimeByDate(numdate));
+        if (msSuspected != null)
+            temperature = msSuspected.getTemperature().toString();
+        return temperature;
+    }
+
+
 }

+ 8 - 0
whepi-web/src/main/resources/mapper/UserOpen.xml

@@ -28,4 +28,12 @@
           inner join sys_uptown u on u.uptown_id = uu.uptown_id
         where u.uptown_id = #{uptownId}
     </select>
+    <select id="selectUserBaseByUserId" resultType="com.bofeng.entity.UserOpen">
+      select g.linkman,g.phone,d.ridgepole,d.unit,e.doorplate
+from sys_user_role t
+inner join sys_uptown_house e on e.house_id = t.property_id
+inner join sys_uptown_home g on g.house_id = t.property_id
+inner join sys_uptown_unit d on d.unit_id = e.unit_id
+where t.user_id = #{userId} and t.role_id =1
+    </select>
 </mapper>