Ver código fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	whepi-web/src/main/resources/application.yml
guojing 5 anos atrás
pai
commit
71bf97f237

+ 19 - 10
whepi-ui/templates/home/ribao.ftl

@@ -53,45 +53,54 @@
                     <input id="suspectedId" type="text" hidden="hidden" value=""/>
                     <div style="height: 5vh; line-height: 5vh;margin-left: 2vw;">病情描述</div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 40%;">是否确诊</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 30%;">是否确诊</div>
                         <input id="switchQuezhen" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 40%;">单间隔离</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 30%;">单间隔离</div>
                         <input id="switchDanjiangeli" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
 
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 40%;">体温</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 30%;">体温</div>
                         <input id="js_input_user_tiwen" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="4" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 40%;">咳嗽</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 30%;">咳嗽现象</div>
                         <input id="js_input_user_kesou" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh;line-height: 5vh; width: 40%;">肌肉酸痛</div>
+                        <div style="color: gray;height: 5vh;line-height: 5vh; width: 30%;">肌肉酸痛</div>
                         <input id="js_input_user_jirou" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh;line-height: 5vh; width: 40%;">呼吸</div>
+                        <div style="color: gray;height: 5vh;line-height: 5vh; width: 30%;">呼吸困难</div>
                         <input id="js_input_user_huxi" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 40%;">乏力</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 30%;">乏力现象</div>
                         <input id="js_input_user_fali" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 40%;">腹泻</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh; width: 30%;">腹泻现象</div>
                         <input id="js_input_user_fuxie" class="weui-input" autofocus="" type="text" placeholder="请选择" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
-                        <div style="color: gray;height: 5vh; line-height: 5vh;margin-right: 2vw;width: 13%;">其他</div>
+                        <div style="color: gray;height: 5vh; line-height: 5vh;margin-right: 2vw;width: 30%;">其他描述</div>
                         <textarea id="shuruqita" class="weui-textarea" placeholder="输入内容(300字内)" rows="5" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; margin-top: 1vh;"></textarea>
                     </div>
+                    <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh;">
+                        <div style="color: gray;height: 5vh; line-height: 5vh;margin-right: 2vw;width: 30%;">
+                            <button id="ribao_score"  style="height:5vh;" class="weui-btn weui-btn_mini weui-btn_primary">健康评估</button></div>
+                            <input id="js_input_score_rezult" class="weui-input" autofocus=""  readonly="readonly" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+                             <input id="js_input_score_rezult_value" type="text" hidden="hidden" />
+                             <input id="js_input_temperature_score" type="text" hidden="hidden" />
+                             <input id="js_input_score_histroy" type="text" hidden="hidden" />
+                              <input id="js_input_score" type="text" hidden="hidden"/>
+                    </div>
                     <div style="display: flex; justify-content: center;">
                         <div style="width: 70%;color: red; text-align: center;">
-                            大家可以自愿填写病情描述(温度为必填项),根据每天病情变化趋势给出就诊评估建议
+                            自愿填写病情描述(温度为必填项),提交后会根据每天病情描述变化趋势给出更加科学的健康评估建议
                         </div>
                     </div>
                     <div style="display:flex; flex-direction: row; justify-content: space-between; margin-top: 1vh; margin-bottom: 5vh;">

+ 153 - 35
whepi-ui/templates/home/ribao.js

@@ -130,11 +130,11 @@ function ribao_init() {
         value: "0",
       },
       {
-        title: "可体力劳动但觉得累",
+        title: "体力劳动后不能恢复",
         value: "1",
       },
       {
-        title: "轻体力劳动后长时间不能恢复",
+        title: "轻体力活非常累",
         value: "2",
       },
       {
@@ -260,7 +260,6 @@ function ribao_refrash() {
             ribao_cell(v);
           });
         } else {
-
         }
       }
     },
@@ -287,7 +286,7 @@ function ribao_cell(v) {
   var temperature = "体温:" + v.temperature + ";";
   var cough = "";
   if (v.cough != 0)
-    cough = "咳嗽:" + getCough(v.cough) + ";";
+    cough = "咳嗽现象:" + getCough(v.cough) + ";";
   var muscle = "";
   if (v.muscle != 0)
     muscle = "肌肉酸痛:" + getMuscle(v.muscle) + ";";
@@ -296,17 +295,20 @@ function ribao_cell(v) {
     dyspnea = "呼吸困难:" + getDyspnea(v.dyspnea) + ";";
   var fatigue = "";
   if (v.fatigue != 0)
-    fatigue = "乏力:" + getFatigue(v.fatigue) + ";";
+    fatigue = "乏力现象:" + getFatigue(v.fatigue) + ";";
   var diarrhea = "";
   if (v.diarrhea != 0)
-    diarrhea = "腹泻:" + getDiarrhea(v.diarrhea) + ";";
+    diarrhea = "腹泻现象:" + getDiarrhea(v.diarrhea) + ";";
   var others = "";
   if (v.others != "")
     others = "其他:" + v.others;
+  var scoreRezult = "";
+  if (v.scoreRezult != 0)
+    scoreRezult = "评估结果:" + getScoreRezult(v.scoreRezult, v.temperatureScore) + ";";
   $('#rb_family').append($('<div class="weui-media-box weui-media-box_text" style="height: 12vh">\n' +
     '                                      <h4 class="weui-media-box__title">' + userName + '&nbsp;&nbsp;&nbsp;' + grender + '&nbsp;&nbsp;&nbsp;' + age + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="color: #bc4246" onclick=\'deleteSuspected(' + JSON.stringify(v.suspectedId) + ')\'>删除</a>\n' +
     '                                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="color: #2a62bc" onclick=\'updateSuspected(' + JSON.stringify(v.suspectedId) + ')\'>修改</a></h4>\n' +
-    '                                      <p class="weui-media-box__desc" style="height: 80%">' + familyStatus + medical + singleRoom + temperature + cough + muscle + dyspnea + fatigue + diarrhea + others + '</p>\n' +
+    '                                      <p class="weui-media-box__desc" style="height: 80%">' + familyStatus + medical + singleRoom + temperature + cough + muscle + dyspnea + fatigue + diarrhea + others + scoreRezult + '</p>\n' +
     '                                    </div>\n' +
     '                              '));
 }
@@ -321,6 +323,33 @@ function ribao_add() {
       $('#notOpenRibao')[0].style.display = '';
       $('#ribao')[0].style.display = 'none';
     }
+
+    $("#js_input_user_status").val(getFamilyStatus(0));
+    $("#js_input_user_status").attr("data-values", 0);
+
+    $("#switchQuezhen").val(getMedical(0));
+    $("#switchQuezhen").attr("data-values", 0);
+
+    $("#switchDanjiangeli").val(getSingleRoom(0));
+    $("#switchDanjiangeli").attr("data-values", 0);
+
+    $("#js_input_user_tiwen").val(0);
+
+    $("#js_input_user_kesou").val(getCough(0));
+    $("#js_input_user_kesou").attr("data-values", 0);
+
+    $("#js_input_user_jirou").val(getMuscle(0));
+    $("#js_input_user_jirou").attr("data-values", 0);
+
+    $("#js_input_user_huxi").val(getDyspnea(0));
+    $("#js_input_user_huxi").attr("data-values", 0);
+
+    $("#js_input_user_fali").val(getFatigue(0));
+    $("#js_input_user_fali").attr("data-values", 0);
+
+    $("#js_input_user_fuxie").val(getDiarrhea(0));
+    $("#js_input_user_fuxie").attr("data-values", 0);
+
   });
 }
 
@@ -339,28 +368,6 @@ function ribao_cancel() {
 }
 
 function ribaoCommit() {
-
-  // console.log("sss");
-  // console.log(
-  //     "姓名", $("#js_input_user_name").val(),
-  //     "性别", $("#js_input_user_sex").val(), "实际值", $("#js_input_user_sex").attr("data-values"),
-  //     "年龄", $("#js_input_user_age").val(),
-  //     "基本状况", $("#js_input_user_status").val(),
-  //     "状况描述", $("#jibenmiaoshu").val(),
-  //     "是否确诊", $("#switchQuezhen").val(),
-  //     "体温", $("#js_input_user_tiwen").val(),
-  //     "咳嗽", $("#js_input_user_kesou").val(),
-  //     "肌肉酸痛", $("#js_input_user_jirou").val(),
-  //     "呼吸困难", $("#js_input_user_huxi").val(),
-  //     "胸闷", $("#js_input_user_xiongmen").val(),
-  //     "乏力", $("#js_input_user_fali").val(),
-  //     "腹泻", $("#js_input_user_fuxie").val(),
-  //     "次数", $("#js_input_user_cishu").val(),
-  //     "其他", $("#shuruqita").val()
-  // );
-  // return;
-
-
   var suspectedId = $("#suspectedId").val();
   var userId = $("#userId").val();
   var userName = $("#js_input_user_name").val();
@@ -377,6 +384,10 @@ function ribaoCommit() {
   var fatigue = $("#js_input_user_fali").attr("data-values") == undefined ? 0 : $("#js_input_user_fali").attr("data-values");
   var diarrhea = $("#js_input_user_fuxie").attr("data-values") == undefined ? 0 : $("#js_input_user_fuxie").attr("data-values");
   var others = $("#shuruqita").val() == undefined ? "" : $("#shuruqita").val();
+  var scoreRezult = $("#js_input_score_rezult_value").val() == undefined ? "" : $("#js_input_score_rezult_value").val();
+  var temperatureScore = $("#js_input_temperature_score").val() == undefined ? "" : $("#js_input_temperature_score").val();
+  var scoreHistroy = $("#js_input_score_histroy").val() == undefined ? "" : $("#js_input_score_histroy").val();
+  var score = $("#js_input_score").val() == undefined ? "" : $("#js_input_score").val();
 
   if (userName == undefined || userName == '') {
     $.alert("请填写姓名");
@@ -424,8 +435,16 @@ function ribaoCommit() {
       "fatigue": fatigue,
       "diarrhea": diarrhea,
       "others": others,
+      "scoreRezult": scoreRezult,
+      "temperatureScore": temperatureScore,
+      "scoreHistroy": scoreHistroy,
+      "score": score,
     },
     success: function (data) {
+      if (data.msgReport == "2"){
+        $.toast("家人姓名不能重复,如果重复,可以带上称呼");
+        return;
+       }
       if ($('#ribao')[0].style.display == 'none') {
         $('#notOpenRibao').toggle();
         $('#ribao')[0].style.display = '';
@@ -512,6 +531,11 @@ function updateSuspected(suspectedId) {
         $("#js_input_user_fuxie").attr("data-values", suspected.diarrhea);
 
         $("#shuruqita").val(suspected.others);
+        $("#js_input_score_rezult").val(getScoreRezult(suspected.scoreRezult, suspected.temperatureScore));
+        $("#js_input_score_rezult_value").val(suspected.scoreRezult);
+        $("#js_input_temperature_score").val(suspected.temperatureScore);
+        $("#js_input_score_histroy").val(suspected.scoreHistroy);
+        $("#js_input_score").val(suspected.score);
       }
     },
   });
@@ -586,7 +610,7 @@ function helpValue1(v) {
   var temperature = "体温:" + v.temperature + ";";
   var cough = "";
   if (v.cough != 0)
-    cough = "咳嗽:" + getCough(v.cough) + ";";
+    cough = "咳嗽现象:" + getCough(v.cough) + ";";
   var muscle = "";
   if (v.muscle != 0)
     muscle = "肌肉酸痛:" + getMuscle(v.muscle) + ";";
@@ -595,16 +619,19 @@ function helpValue1(v) {
     dyspnea = "呼吸困难:" + getDyspnea(v.dyspnea) + ";";
   var fatigue = "";
   if (v.fatigue != 0)
-    fatigue = "乏力:" + getFatigue(v.fatigue) + ";";
+    fatigue = "乏力现象:" + getFatigue(v.fatigue) + ";";
   var diarrhea = "";
   if (v.diarrhea != 0)
-    diarrhea = "腹泻:" + getDiarrhea(v.diarrhea) + ";";
+    diarrhea = "腹泻现象:" + getDiarrhea(v.diarrhea) + ";";
   var others = "";
   if (v.others != "")
     others = "其他:" + v.others;
+  var scoreRezult = "";
+  if (v.scoreRezult != 0)
+    scoreRezult = "评估结果:" + getScoreRezult(v.scoreRezult, v.temperatureScore) + ";";
   $('#ribao_famliy').append($('<div class="weui-media-box weui-media-box_text" style="height: 12vh">\n' +
     '                                      <h4 class="weui-media-box__title">' + userName + '&nbsp;&nbsp;&nbsp;' + grender + '&nbsp;&nbsp;&nbsp;' + age + '</h4>\n' +
-    '                                      <p class="weui-media-box__desc" style="height: 80%">' + familyStatus + medical + singleRoom + temperature + cough + muscle + dyspnea + fatigue + diarrhea + others + '</p>\n' +
+    '                                      <p class="weui-media-box__desc" style="height: 80%">' + familyStatus + medical + singleRoom + temperature + cough + muscle + dyspnea + fatigue + diarrhea + others + scoreRezult + '</p>\n' +
     '                                    </div>\n' +
     '                              '));
 }
@@ -680,9 +707,9 @@ function getFatigue(fatigue) {
   if (fatigue == 0)
     return "无";
   else if (fatigue == 1)
-    return "可体力劳动但觉得累";
+    return "体力劳动后不能恢复";
   else if (fatigue == 2)
-    return "轻体力劳动后长时间不能恢复";
+    return "轻体力活非常累";
   else if (fatigue == 3)
     return "不能正常生活";
   return "";
@@ -753,6 +780,97 @@ function clearShow() {
   $("#js_input_user_fuxie").attr("data-values", "");
 
   $("#shuruqita").val("");
+  $("#js_input_score_rezult").val("");
+  $("#js_input_score_rezult_value").val("");
+  $("#js_input_temperature_score").val("");
+  $("#js_input_score_histroy").val("");
+  $("#js_input_score").val("");
+}
+
+//健康评估
+$('#ribao_score').on('click', function () {
+  var suspectedId = $("#suspectedId").val();
+  var userId = $("#userId").val();
+  var userName = $("#js_input_user_name").val();
+  var temperature = $("#js_input_user_tiwen").val() == "" ? 0 : $("#js_input_user_tiwen").val();
+  var cough = $("#js_input_user_kesou").attr("data-values") == undefined ? 0 : $("#js_input_user_kesou").attr("data-values");
+  var muscle = $("#js_input_user_jirou").attr("data-values") == undefined ? 0 : $("#js_input_user_jirou").attr("data-values");
+  var dyspnea = $("#js_input_user_huxi").attr("data-values") == undefined ? 0 : $("#js_input_user_huxi").attr("data-values");
+  var fatigue = $("#js_input_user_fali").attr("data-values") == undefined ? 0 : $("#js_input_user_fali").attr("data-values");
+  var diarrhea = $("#js_input_user_fuxie").attr("data-values") == undefined ? 0 : $("#js_input_user_fuxie").attr("data-values");
+  if (userName == undefined || userName == '') {
+    $.alert("请填写姓名");
+    return;
+  }
+  if (temperature <= 0) {
+    $.alert("请填写体温");
+    return;
+  }
+  if (temperature > 50 || temperature < 30) {
+    $.alert("请填写正确的体温");
+    return;
+  }
+
+  $.ajax({
+    url: '/home/addScore',
+    type: "post",
+    data: {
+      "userName": userName,
+      "suspectedId": suspectedId,
+      "userCreate": userId,
+      "temperature": temperature,
+      "cough": cough,
+      "muscle": muscle,
+      "dyspnea": dyspnea,
+      "fatigue": fatigue,
+      "diarrhea": diarrhea,
+    },
+    success: function (data) {
+      if (data == undefined) {
+        $('#js_input_score_rezult').empty();
+        $('#js_input_score_rezult_value').empty();
+        $('#js_input_temperature_score').empty();
+        $('#js_input_score_histroy').empty();
+        $('#js_input_score').empty();
+      }
+      else {
+        $('#js_input_score_rezult').empty();
+        $('#js_input_temperature_score').empty();
+        $('#js_input_score_histroy').empty();
+        $('#js_input_score').empty();
+        var ScoreRezult = getScoreRezult(data.scoreRezult, data.temperatureScore);
+        $("#js_input_score_rezult").val(ScoreRezult);
+        $("#js_input_score_rezult_value").val(data.scoreRezult);
+        $("#js_input_temperature_score").val(data.temperatureScore);
+        $("#js_input_score_histroy").val(data.scoreHistory);
+        $("#js_input_score").val(data.score);
+      }
+    },
+  });
+});
+
+
+function getScoreRezult(scoreRezult, temperatureScore) {
+  if (scoreRezult == 0)
+    return "未评估";
+  else if (scoreRezult == 1) {
+    if (temperatureScore > 1)
+      return "正常,间隔时间服用退烧药,多休息,多喝水";
+    else
+      return "正常";
+  }
+  else if (scoreRezult == 2) {
+    if (temperatureScore > 1)
+      return "注意观察,间隔时间服用退烧药,多休息,多喝水";
+    else
+      return "注意观察";
+  }
+  else if (scoreRezult == 3)
+    return "联系社区医生(或者在线问诊)";
+  else if (scoreRezult == 4)
+    return "尽快就诊";
+  return "";
 }
 
 
+

+ 16 - 0
whepi-web/src/main/java/com/bofeng/controller/WxUserOpenController.java

@@ -1,11 +1,13 @@
 package com.bofeng.controller;
 
 import com.bofeng.dao.UserRoleMapper;
+import com.bofeng.entity.OwnerLinkman;
 import com.bofeng.entity.UserOpen;
 import com.bofeng.entity.UserRole;
 import com.bofeng.service.HomeService;
 import com.bofeng.service.WxUserOpenService;
 import com.yvan.Model;
+import com.yvan.mvc.JsonBody;
 import com.yvan.platform.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -91,4 +93,18 @@ public class WxUserOpenController {
         return Model.newSuccess(wxUserOpenService.createFamily(unitId, doorPlate, linkMan, helpNum, phone));
     }
 
+    @ApiOperation("完善家庭及住宅信息")
+    @PostMapping("/userOpen/createYWH")
+    public Model<Long> createYWH(HttpServletRequest request, @JsonBody List<OwnerLinkman> lstOwner) throws Exception {
+        Long uptownId = Long.parseLong(request.getParameter("uptownId"));
+        if (uptownId == null || uptownId == 0L) {
+            return Model.newFail("请选择所在小区");
+        }
+        if (lstOwner == null || lstOwner.size() == 0) {
+            return Model.newFail("请增加业委会成员");
+        }
+        //成功返回用户Id
+        return Model.newSuccess(wxUserOpenService.createYWH(lstOwner, uptownId));
+    }
+
 }

+ 6 - 2
whepi-web/src/main/java/com/bofeng/dao/MsSuspectedMapper.java

@@ -22,6 +22,10 @@ public interface MsSuspectedMapper extends BaseMapper<MsSuspected> {
     List<MsSuspected> selectByReportId(@Param("reportId") Long reportId);
 
     //判断家人姓名是否重复
-    @Select("select count(*) from ms_suspected where report_id=#{reportId} and user_name=#{userName}")
-    Integer selectUserNameNum(@Param("reportId") Long reportId,@Param("userName") String userName);
+    @Select("select * from ms_suspected where report_id=#{reportId} and user_name=#{userName}")
+    List<MsSuspected> selectUserNameNum(@Param("reportId") Long reportId, @Param("userName") String userName);
+
+    //判断家人是否有历史评分
+    @Select("select score from ms_suspected where user_create=#{userCreate} and user_name=#{userName} and suspected_id !=#{suspectedId}  order by time_update desc limit 1")
+    Integer selectUserNameScore(@Param("userCreate") Long userCreate, @Param("userName") String userName, @Param("suspectedId") Long suspectedId);
 }

+ 18 - 0
whepi-web/src/main/java/com/bofeng/dao/OwnerLinkmanMapper.java

@@ -0,0 +1,18 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.OwnerLinkman;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface OwnerLinkmanMapper extends BaseMapper<OwnerLinkman> {
+
+    @Select("select * from sys_owner_linkman where owner_id = #{ownerId}")
+    List<OwnerLinkman> getOwnerLinkmanByOwnerId(@Param("ownerId") Long ownerId);
+}

+ 7 - 0
whepi-web/src/main/java/com/bofeng/dao/OwnerMapper.java

@@ -3,9 +3,16 @@ package com.bofeng.dao;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.Owner;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Mapper
 @Repository
 public interface OwnerMapper extends BaseMapper<Owner> {
+
+    @Select("select * from sys_owner where uptown_id = #{uptownId}")
+    List<Owner> getOwnerByUptownId(@Param("uptownId") Long uptownId);
 }

+ 13 - 0
whepi-web/src/main/java/com/bofeng/dao/RbMapper.java

@@ -82,6 +82,19 @@ public interface RbMapper extends BaseMapper<sysUptownUnit> {
     List<ExcelRiBao> selectExcelRiBao(@Param("uptownId") Long uptownId, @Param("date") String date);
 
     @Select(
+            "select suu.ridgepole,suu.unit,suh.doorplate,suho.linkman,suho.phone,msr.safety_num as safetyNum," +
+                    "msr.sure_num as sureNum,msr.suspected_num as suspectedNum,msr.normal_num as normalNum," +
+                    "msr.single_num as singleNum,mss.user_name as userName,mss.grender," +
+                    "mss.age,mss.family_status as familyStatus,mss.medical,mss.temperature,mss.cough,mss.muscle ,mss.dyspnea," +
+                    "mss.fatigue,mss.diarrhea,mss.single_room as singleRoom from ms_suspected mss "+
+                    "inner join ms_report msr on msr.report_id = mss.report_id and msr.report_date = #{date} "+
+                    "inner join sys_uptown_house suh on suh.house_id = msr.house_id "+
+                    "inner join sys_uptown_unit suu on suu.unit_id = suh.unit_id and suu.uptown_id=#{uptownId} "+
+                    "left join sys_uptown_home suho on suho.house_id = suh.house_id order by doorplate asc"
+    )
+    List<ExcelRiBaoPrivate> selectExcelRiBaoPrivate(@Param("uptownId") Long uptownId, @Param("date") String date);
+
+    @Select(
             "select u.* from sys_user_role ur " +
                     "left join sys_uptown_house up on up.house_id = ur.property_id " +
                     "left join sys_uptown_unit uu on uu.unit_id = up.unit_id " +

+ 1 - 1
whepi-web/src/main/java/com/bofeng/dao/UptownHomeMapper.java

@@ -14,5 +14,5 @@ import java.util.List;
 public interface UptownHomeMapper extends BaseMapper<UptownHome> {
 
     @Select("select * from sys_uptown_home where house_id = #{houseId} and status = 1")
-    List<UptownHome> getUptownHomeBy(@Param("houseId")Long houseId, @Param("doorplate")String doorplate);
+    List<UptownHome> getUptownHomeBy(@Param("houseId") Long houseId);
 }

+ 202 - 0
whepi-web/src/main/java/com/bofeng/entity/ExcelRiBaoPrivate.java

@@ -0,0 +1,202 @@
+package com.bofeng.entity;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.google.common.base.Strings;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class ExcelRiBaoPrivate {
+
+    private String ridgepole;
+    private String unit;
+    private String doorplate;
+    private int grender;
+    private int familyStatus;
+    private int medical;
+    private int cough;
+    private int muscle;
+    private int dyspnea;
+    private int fatigue;
+    private int diarrhea;
+    private int singleRoom;
+    private String statusDesp = "";
+    private String others = "";
+
+
+    @ExcelProperty(value = "楼栋", index = 0)
+    private String loudong = "";
+
+    public String getLoudong() {
+        if (loudong.length() <= 0) {
+            loudong = ridgepole + "栋" + unit + "单元";
+        }
+        return loudong;
+    }
+
+    @ExcelProperty(value = "房号", index = 1)
+    private String fanghao = "";
+
+    public String getFanghao() {
+        if (fanghao.length() <= 0) {
+            fanghao = doorplate;
+        }
+        return fanghao;
+    }
+
+    @ExcelProperty(value = "联系人", index = 2)
+    private String linkman;
+
+    @ExcelProperty(value = "联系电话", index = 3)
+    private String phone;
+
+    @ExcelProperty(value = "今日居家人数", index = 4)
+    private int safetyNum;
+
+    @ExcelProperty(value = "确诊人数", index = 5)
+    private int sureNum;
+
+    @ExcelProperty(value = "隔离人数", index = 6)
+    private int singleNum;
+
+    @ExcelProperty(value = "异常观察人数", index = 7)
+    private int suspectedNum;
+
+    @ExcelProperty(value = "身体正常人数", index = 8)
+    private int normalNum;
+
+    @ExcelProperty(value = "居家人员姓名", index = 9)
+    private String userName;
+
+    @ExcelProperty(value = "性别", index = 10)
+    private String grenderStr;
+
+    public String getGrenderStr() {
+        if (grender == 1) {
+            grenderStr = "男";
+        } else if (grender == 2) {
+            grenderStr = "女";
+        } else {
+            grenderStr = "未知";
+        }
+        return grenderStr;
+    }
+
+    @ExcelProperty(value = "年龄", index = 11)
+    private String age;
+
+    @ExcelProperty(value = "体温", index = 12)
+    private BigDecimal temperature;
+
+    @ExcelProperty(value = "确诊", index = 13)
+    private String medicalStr;
+    public String getMedicalStr() {
+        if (medical == 0) {
+            medicalStr = "否";
+        } else {
+            medicalStr = "是";
+        }
+        return medicalStr;
+    }
+
+    @ExcelProperty(value = "单间隔离", index = 14)
+    private String singleRoomStr;
+    public String getSingleRoomStr() {
+        if (singleRoom == 0) {
+            singleRoomStr = "否";
+        } else {
+            singleRoomStr = "是";
+        }
+        return singleRoomStr;
+    }
+
+    @ExcelProperty(value = "身体基本情况", index = 15)
+    private String baseDesc;
+    public String getBaseDesc() {
+        if (familyStatus == 0) {
+            baseDesc = "无病史";
+        } else if (familyStatus == 1) {
+            baseDesc = "心血管疾病(服用ARB)";
+        } else if (familyStatus == 2) {
+            baseDesc = "心血管疾病(未服用ARB)";
+        } else if (familyStatus == 3) {
+            baseDesc = "呼吸系统病史";
+        } else if (familyStatus == 4) {
+            baseDesc = "肿瘤病史";
+        } else if (familyStatus == 5) {
+            baseDesc = "糖尿病史";
+        } else if (familyStatus == 6) {
+            baseDesc = "服用过激素药物";
+        } else if (familyStatus == 7) {
+            baseDesc = "妊娠期";
+        } else {
+            baseDesc = "其他";
+        }
+        return baseDesc;
+    }
+
+    @ExcelProperty(value = "病情描述", index = 16)
+    private String bingqingDesc = "";
+    public String getBingqingDesc() {
+
+        if (medical == 1) {
+            bingqingDesc += "已确诊、";
+        }
+
+        if (singleRoom == 1) {
+            bingqingDesc += "单间隔离、";
+        }
+
+        bingqingDesc = bingqingDesc + "体温:" + temperature + "、";
+
+        if (cough == 1) {
+            bingqingDesc += "偶尔短暂咳嗽、";
+        } else if (cough == 2) {
+            bingqingDesc += "咳嗽轻度影响生活、";
+        } else if (cough == 3) {
+            bingqingDesc += "咳嗽严重影响生活、";
+        }
+        if (muscle == 1) {
+            bingqingDesc += "肌肉按压有酸痛、";
+        } else if (muscle == 2) {
+            bingqingDesc += "偶尔肌肉按压酸痛、";
+        } else if (muscle == 3) {
+            bingqingDesc += "肌肉按压持续酸痛、";
+        }
+        if (dyspnea == 1) {
+            bingqingDesc += "呼吸急走或上坡气短、";
+        } else if (dyspnea == 2) {
+            bingqingDesc += "呼吸气短而走路变慢、";
+        } else if (dyspnea == 3) {
+            bingqingDesc += "呼吸走路数分钟后气短、";
+        } else if (dyspnea == 4) {
+            bingqingDesc += "呼吸气短无法离开房间、";
+        }
+        if (fatigue == 1) {
+            bingqingDesc += "可体力劳动但觉得累、";
+        } else if (fatigue == 2) {
+            bingqingDesc += "轻体力劳动后长时间不能恢复、";
+        } else if (fatigue == 3) {
+            bingqingDesc += "不能正常生活、";
+        }
+        if (diarrhea == 1) {
+            bingqingDesc += "轻度腹泻少于于3次、";
+        } else if (diarrhea == 2) {
+            bingqingDesc += "中度腹泻4-6次、";
+        } else if (diarrhea == 3) {
+            bingqingDesc += "重度腹泻超过6次、";
+        }
+
+        if (!Strings.isNullOrEmpty(statusDesp)) {
+            bingqingDesc += statusDesp;
+            bingqingDesc += "、";
+        }
+        if (!Strings.isNullOrEmpty(others)) {
+            bingqingDesc += others;
+        }
+        return bingqingDesc;
+    }
+}

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

@@ -68,4 +68,8 @@ public class MsReport {
 
     @TableField("time_update")
     private DateTime timeUpdate;
+
+
+    @TableField(exist = false)
+    private String msgReport = "";
 }

+ 12 - 0
whepi-web/src/main/java/com/bofeng/entity/MsSuspected.java

@@ -56,6 +56,9 @@ public class MsSuspected {
     @TableField("temperature")
     private BigDecimal temperature;
 
+    @TableField("temperature_score")
+    private Integer temperatureScore;
+
     @TableField("cough")
     private Integer cough;
 
@@ -83,6 +86,15 @@ public class MsSuspected {
     @TableField("diarrhea")
     private Integer diarrhea;
 
+    @TableField("score_histroy")
+    private Integer scoreHistroy;
+
+    @TableField("score")
+    private Integer score;
+
+    @TableField("score_rezult")
+    private Integer scoreRezult;
+
     @TableField(exist = false)
     private String diarrheaStr = "";
 

+ 53 - 0
whepi-web/src/main/java/com/bofeng/entity/OwnerLinkman.java

@@ -0,0 +1,53 @@
+package com.bofeng.entity;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.joda.time.DateTime;
+
+@Getter
+@Setter
+@TableName("SYS_OWNER_LINKMAN")
+public class OwnerLinkman {
+
+    @ApiModelProperty("业委会联系人ID")
+    @TableId("LINKMAN_ID")
+    private Long linkmanId;
+
+    @ApiModelProperty("业委会ID")
+    @TableField("OWNER_ID")
+    private Long ownerId;
+
+    @ApiModelProperty("类型:1负责人、2成员")
+    @TableField("TYPE")
+    private Long type;
+
+    @ApiModelProperty("联系人名称")
+    @TableField("LINKMAN")
+    private String linkman;
+
+    @ApiModelProperty("联系人电话")
+    @TableField("PHONE")
+    private String phone;
+
+    @ApiModelProperty("新增人")
+    @TableField("USER_CREATE")
+    private Long userCreate;
+
+    @ApiModelProperty("新增时间")
+    @TableField("TIME_CREATE")
+    private DateTime timeCreate;
+
+    @ApiModelProperty("修改人")
+    @TableField("USER_UPDATE")
+    private Long userUpdate;
+
+    @ApiModelProperty("修改时间")
+    @TableField("TIME_UPDATE")
+    private DateTime timeUpdate;
+
+
+}

+ 4 - 3
whepi-web/src/main/java/com/bofeng/entity/Uptown.java

@@ -1,6 +1,7 @@
 package com.bofeng.entity;
 
 import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 import lombok.Getter;
 import lombok.Setter;
@@ -14,7 +15,7 @@ import org.joda.time.DateTime;
 @TableName("sys_uptown")
 public class Uptown {
 
-    @TableField("uptown_id")
+    @TableId("uptown_id")
     private Long uptownId;
 
     @TableField("uptown_name")
@@ -38,13 +39,13 @@ public class Uptown {
     @TableField("status")
     private Integer status;
 
-    @TableField("user_create")
+    @TableField(exist = false)
     private Long userCreate;
 
     @TableField(exist = false)
     private DateTime timeCreate;
 
-    @TableField("user_update")
+    @TableField(exist = false)
     private Long userUpdate;
 
     @TableField(exist = false)

+ 4 - 0
whepi-web/src/main/java/com/bofeng/service/MsReportService.java

@@ -163,6 +163,10 @@ public class MsReportService {
                     msSuspected1.setDiarrhea(msSuspected.getDiarrhea());
                     msSuspected1.setSingleRoom(msSuspected.getSingleRoom());
                     msSuspected1.setOthers(msSuspected.getOthers());
+                    // msSuspected1.setScoreRezult(msSuspected.getScoreRezult());
+                    // msSuspected1.setScore(msSuspected.getScore());
+                    // msSuspected1.setScoreHistroy(msSuspected.getScoreHistroy());
+                    // msSuspected1.setTemperatureScore(msSuspected.getTemperatureScore());
                     msSuspected1.setSuspectedStatus(0);
                     msSuspected1.setUserCreate(userCreate);
                     msSuspected1.setTimeCreate(DateTime.now());

+ 108 - 3
whepi-web/src/main/java/com/bofeng/service/MsSuspectedService.java

@@ -6,6 +6,8 @@ import com.bofeng.dao.MsReportMapper;
 import com.bofeng.dao.MsSuspectedMapper;
 import com.bofeng.entity.MsReport;
 import com.bofeng.entity.MsSuspected;
+import com.yvan.platform.Conv;
+import io.swagger.models.auth.In;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -41,7 +43,7 @@ public class MsSuspectedService {
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public Long addSuspected(Long suspectedId, String userName, Integer grender, Integer age, Integer familyStatus,
                              String statusDesp, Integer medical, BigDecimal temperature, Integer cough, Integer muscle,
-                             Integer dyspnea, Integer fatigue, Integer diarrhea, Integer singleRoom, String others, Long userCreate) {
+                             Integer dyspnea, Integer fatigue, Integer diarrhea, Integer singleRoom, String others, Long userCreate, Integer scoreRezult, Integer temperatureScore, Integer scoreHistroy, Integer score) {
         Long reportId = 0L;
         //如果是当前日期 已经添加
         Date t = new Date();
@@ -81,7 +83,7 @@ public class MsSuspectedService {
         if (singleRoom == 1)
             suspectedStatus = 1;
         //体温
-        if (temperature.compareTo(new BigDecimal(36)) == -1 || temperature.compareTo(new BigDecimal(37.3)) == 1)
+        if (Conv.NFloat(temperature) < Conv.NFloat(36) || Conv.NFloat(temperature) > Conv.NFloat(37.3))
             suspectedStatus = 1;
         //咳嗽
         if (cough > 0)
@@ -99,7 +101,10 @@ public class MsSuspectedService {
         if (diarrhea > 0)
             suspectedStatus = 1;
         if (suspectedId == 0L) {
-            //添加家人
+            //判断家人是否同名
+            List<MsSuspected> list = msSuspectedMapper.selectUserNameNum(reportId, userName);
+            if (list != null && list.size() > 0)
+                return 2L;
             MsSuspected msSuspected = new MsSuspected();
             msSuspected.setSuspectedId(IdWorker.getId());
             msSuspected.setReportId(reportId);
@@ -118,12 +123,26 @@ public class MsSuspectedService {
             msSuspected.setSingleRoom(singleRoom);
             msSuspected.setOthers(others);
             msSuspected.setSuspectedStatus(suspectedStatus);
+            msSuspected.setScoreRezult(scoreRezult);
+            msSuspected.setScore(score);
+            msSuspected.setScoreHistroy(scoreHistroy);
+            msSuspected.setTemperatureScore(temperatureScore);
             msSuspected.setUserCreate(userCreate);
             msSuspected.setTimeCreate(DateTime.now());
             msSuspected.setUserUpdate(userCreate);
             msSuspected.setTimeUpdate(DateTime.now());
             msSuspectedMapper.insert(msSuspected);
         } else {
+            //判断家人是否同名
+            List<MsSuspected> list = msSuspectedMapper.selectUserNameNum(reportId, userName);
+            if (list != null && list.size() > 0) {
+                if (list.size() > 1)
+                    return 2L;
+                else {
+                    if (list.get(0).getSuspectedId() != suspectedId)
+                        return 2L;
+                }
+            }
             MsSuspected msSuspected1 = msSuspectedMapper.selectById(suspectedId);
             if (msSuspected1 != null) {
                 msSuspected1.setUserName(userName);
@@ -140,6 +159,10 @@ public class MsSuspectedService {
                 msSuspected1.setDiarrhea(diarrhea);
                 msSuspected1.setSingleRoom(singleRoom);
                 msSuspected1.setOthers(others);
+                msSuspected1.setScoreRezult(scoreRezult);
+                msSuspected1.setScore(score);
+                msSuspected1.setScoreHistroy(scoreHistroy);
+                msSuspected1.setTemperatureScore(temperatureScore);
                 msSuspected1.setSuspectedStatus(suspectedStatus);
                 msSuspectedMapper.updateById(msSuspected1);
             }
@@ -202,4 +225,86 @@ public class MsSuspectedService {
             msReportMapper.updateById(msReport);
         }
     }
+
+    //健康评估
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public MsSuspected getScore(Long susprectedId, String userName, BigDecimal temperature, Integer cough, Integer muscle, Integer dyspnea, Integer fatigue, Integer diarrhea, Long userCreate) {
+        MsSuspected msSuspected = new MsSuspected();
+        msSuspected.setTemperatureScore(getTemperatureScore(temperature));
+        msSuspected.setScore(addScore(temperature, cough, muscle, dyspnea, fatigue, diarrhea));
+        Integer scoreHistroy = msSuspectedMapper.selectUserNameScore(userCreate, userName, susprectedId);
+        if (scoreHistroy == null)
+            scoreHistroy = 0;
+        msSuspected.setScoreHistroy(scoreHistroy);
+        msSuspected.setScoreRezult(scoreRezulte(msSuspected.getScoreHistroy(), msSuspected.getScore()));
+        return msSuspected;
+    }
+
+    //获取温度评分
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer getTemperatureScore(BigDecimal temperature) {
+        Integer score = 0;
+        //温度
+        if (Conv.NFloat(temperature) < Conv.NFloat(37.3))//37.3以下0分
+            score += 0;
+        if (Conv.NFloat(temperature) >= Conv.NFloat(37.4) && Conv.NFloat(temperature) <= Conv.NFloat(38))//   37.3~38℃为 1分
+            score += 1;
+        if (Conv.NFloat(temperature) >= Conv.NFloat(38.1) && Conv.NFloat(temperature) <= Conv.NFloat(39))// 38.1~39℃为中度发热 2分
+            score += 2;
+        if (Conv.NFloat(temperature) >= Conv.NFloat(39.1) && Conv.NFloat(temperature) <= Conv.NFloat(40))//39.1~40℃为高热 3分
+            score += 3;
+        if (Conv.NFloat(temperature) > Conv.NFloat(40))//340℃以上为超高热 4分
+            score += 4;
+        return score;
+    }
+
+    //获取总评分
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer addScore(BigDecimal temperature, Integer cough, Integer muscle, Integer dyspnea, Integer fatigue, Integer diarrhea) {
+        Integer score = getTemperatureScore(temperature);
+        //咳嗽
+        score += cough;
+        //肌肉
+        score += muscle;
+        //肌肉
+        score += dyspnea;
+        //肌肉
+        score += fatigue;
+        //肌肉
+        score += diarrhea;
+        return score;
+    }
+
+    //评估结果
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer scoreRezulte(Integer scoreHistory, Integer score) {
+        Integer scoreRezult = 0;
+        //判断用户是否含有历史评分
+        if (scoreHistory == 0) {
+            //判断结果
+            if (score < 1)
+                scoreRezult = 1;
+            if (score >= 1 && score <= 3)
+                scoreRezult = 2;
+            if (score == 4)
+                scoreRezult = 3;
+            if (score > 4)
+                scoreRezult = 4;
+
+        } else {
+            if (score - scoreHistory >= 3)
+                return 4;
+            else {
+                if (score <= 1)
+                    scoreRezult = 1;
+                if (score >= 2 && score <= 3)
+                    scoreRezult = 2;
+                if (score == 4)
+                    scoreRezult = 3;
+                if (score > 4)
+                    scoreRezult = 4;
+            }
+        }
+        return scoreRezult;
+    }
 }

+ 195 - 50
whepi-web/src/main/java/com/bofeng/service/RiBaoService.java

@@ -37,8 +37,6 @@ public class RiBaoService {
     private MsSuspectedMapper msSuspectedMapper;
     @Autowired
     private MsReportMapper msReportMapper;
-    @Autowired
-    private RiBaoService msReportService;
 
     @Autowired
     private UptownHouseMapper uptownHouseMapper;
@@ -46,40 +44,111 @@ public class RiBaoService {
     @Autowired
     private UptownUnitMapper uptownUnitMapper;
 
-    public List<MsSuspected> getByReportId(Long reportId) {
-        return msSuspectedMapper.selectByReportId(reportId);
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public MsReport editRibao(Long reportId) {
+        DateTime dateTime = new DateTime();
+
+        MsReport msReport = msReportMapper.selectById(reportId);
+        if (msReport != null) {
+            msReport.setReportStatus(1);
+            msReport.setTimeUpdate(dateTime);
+            msReportMapper.updateById(msReport);
+        }
+
+        return msReport;
     }
 
-    public MsReport selectById(Long reportId) {
-        return msReportMapper.selectById(reportId);
+    // 删除家人
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public int delRibaoDetail(Long suspectedId) {
+        MsSuspected msSuspectedDb = msSuspectedMapper.selectById(suspectedId);
+        int num = msSuspectedMapper.deleteById(suspectedId);
+        //更新今日日报
+        updateRibao(msSuspectedDb.getReportId());
+        return num;
     }
 
-    //获取前一天数据
-//    public List<MsSuspected> getByReportReportDate(String reportDate, Long userCreate) {
-//
-//        List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
-//        List<MsSuspected> listSuspected = null;
-//        if (listReport != null && listReport.size() > 0) {
-//            listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
-//        }
-//        return listSuspected;
-//    }
+    // 添加修改家人
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public MsSuspected addOrEditRibaoDetail(MsSuspected ribaoDetail) {
+        DateTime dateTime = new DateTime();
 
-    //获取今天数据
-    public MsReport getReportByDateNow(Long userCreate) {
-        //根据昨天的获取今天的
-        msReportService.getNowByYesterday(userCreate);
-        Date t = new Date();
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-        String reportDate = df.format(t);
-        List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
-        MsReport msReport = new MsReport();
-        if (listReport != null && listReport.size() > 0) {
-            msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
+        //判断是否疑似
+        Integer suspectedStatus = 0;
+        if (ribaoDetail.getMuscle().intValue() == 1 ||
+                ribaoDetail.getSingleRoom().intValue() == 1 ||
+                ribaoDetail.getTemperature().compareTo(new BigDecimal(36)) == -1 ||
+                ribaoDetail.getTemperature().compareTo(new BigDecimal(37.3)) == 1 ||
+                ribaoDetail.getCough() > 0 ||
+                ribaoDetail.getMuscle() > 0 ||
+                ribaoDetail.getDyspnea() > 0 ||
+                ribaoDetail.getFatigue() > 0 ||
+                ribaoDetail.getDiarrhea() > 0) {
+            suspectedStatus = 1;
         }
-        return msReport;
+
+        ribaoDetail.setSuspectedStatus(suspectedStatus);
+        if (ribaoDetail.getSuspectedId().longValue() > 0L) {
+            ribaoDetail.setTimeUpdate(dateTime);
+            msSuspectedMapper.updateById(ribaoDetail);
+        } else {
+            ribaoDetail.setSuspectedId(IdWorker.getId());
+            ribaoDetail.setTimeCreate(dateTime);
+            ribaoDetail.setTimeUpdate(dateTime);
+            msSuspectedMapper.insert(ribaoDetail);
+        }
+
+        //更新今日日报
+        updateRibao(ribaoDetail.getReportId());
+
+        return ribaoDetail;
     }
 
+    // 更新今日日报
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public void updateRibao(Long reportId) {
+        //更新今日日报
+        Integer trueNum = 0, singleNum = 0, isSuspected = 0, isNoSuspected = 0, isFamliy = 0;
+
+        //确诊
+        trueNum = msReportMapper.selectSuspectedNum(reportId);
+
+        //居家隔离
+        singleNum = msReportMapper.selectSingleRoomNum(reportId);
+
+        //正常
+        isSuspected = msReportMapper.selectisSuspectedNum(reportId);
+
+        //疑似
+        isNoSuspected = msReportMapper.selectisNoSuspectedNum(reportId);
+
+        //今日居家
+        List<MsSuspected> list = msSuspectedMapper.selectByReportId(reportId);
+        if (list != null && list.size() > 0)
+            isFamliy = list.size();
+        MsReport msReport = msReportMapper.selectById(reportId);
+        if (msReport != null) {
+            msReport.setSureNum(trueNum);
+            msReport.setSingleNum(singleNum);
+            msReport.setSuspectedNum(isNoSuspected);
+            msReport.setNormalNum(isSuspected);
+            msReport.setSafetyNum(isFamliy);
+            if (isNoSuspected > 0)
+                msReport.setMsStatus(2);// 健康状态:1正常,2异常
+            else
+                msReport.setMsStatus(1);
+            msReportMapper.updateById(msReport);
+        }
+    }
+
+
+    public MsReport getRibao(Long reportId) {
+        MsReport msReport = msReportMapper.selectById(reportId);
+        String houseStr = this.getHouseStr(msReport.getHouseId());
+        msReport.setHouseIdStr(houseStr);
+
+        return msReport;
+    }
 
     //获取今天数据
     public String getHouseStr(Long houseId) {
@@ -101,30 +170,106 @@ public class RiBaoService {
         return houseStr;
     }
 
-    //上报
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public Integer addReport(Long userCreate) {
-        Date t = new Date();
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-        String reportDate = df.format(t);
-        List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
-        if (listReport == null || listReport.size() == 0)
-            return 0;
-
-        //判断体温是否填写
-        List<MsSuspected> listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
-        for (MsSuspected msSuspected : listSuspected) {
-            if (msSuspected.getTemperature().compareTo(new BigDecimal(0)) == 0)
-                return 2;
+    public MsSuspected getRibaoDetail(Long suspectedId) {
+        MsSuspected obj = msSuspectedMapper.selectById(suspectedId);
+
+        if (obj.getGrender().intValue() == 1) {
+            obj.setGrenderStr("男");
+        } else if (obj.getGrender().intValue() == 2) {
+            obj.setGrenderStr("女");
         }
-        MsReport msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
-        if (msReport != null) {
-            msReport.setReportStatus(1);
-            msReport.setUserUpdate(userCreate);
-            msReport.setTimeUpdate(DateTime.now());
-            msReportMapper.updateById(msReport);
+
+        if (obj.getFamilyStatus().intValue() == 0) {
+            obj.setFamilyStatusStr("正常");
+        } else if (obj.getFamilyStatus().intValue() == 1) {
+            obj.setFamilyStatusStr("心血管疾病(服用ARB)");
+        } else if (obj.getFamilyStatus().intValue() == 2) {
+            obj.setFamilyStatusStr("心血管疾病(未服用ARB)");
+        } else if (obj.getFamilyStatus().intValue() == 3) {
+            obj.setFamilyStatusStr("呼吸系统病史");
+        } else if (obj.getFamilyStatus().intValue() == 4) {
+            obj.setFamilyStatusStr("肿瘤病史");
+        } else if (obj.getFamilyStatus().intValue() == 5) {
+            obj.setFamilyStatusStr("糖尿病史");
+        } else if (obj.getFamilyStatus().intValue() == 6) {
+            obj.setFamilyStatusStr("服用过激素药物");
+        } else if (obj.getFamilyStatus().intValue() == 7) {
+            obj.setFamilyStatusStr("妊娠期");
+        } else if (obj.getFamilyStatus().intValue() == 8) {
+            obj.setFamilyStatusStr("其他");
+        }
+
+        if (obj.getMedical().intValue() == 0) {
+            obj.setMedicalStr("否");
+        } else if (obj.getMedical().intValue() == 1) {
+            obj.setMedicalStr("是");
         }
-        return 1;
+
+        if (obj.getCough().intValue() == 0) {
+            obj.setCoughStr("无咳嗽");
+        } else if (obj.getCough().intValue() == 1) {
+            obj.setCoughStr("偶有短暂咳嗽");
+        } else if (obj.getCough().intValue() == 2) {
+            obj.setCoughStr("咳嗽轻度影响生活");
+        } else if (obj.getCough().intValue() == 3) {
+            obj.setCoughStr("咳嗽严重影响生活");
+        }
+
+        if (obj.getMuscle().intValue() == 0) {
+            obj.setMuscleStr("无");
+        } else if (obj.getMuscle().intValue() == 1) {
+            obj.setMuscleStr("按压有");
+        } else if (obj.getMuscle().intValue() == 2) {
+            obj.setMuscleStr("偶尔");
+        } else if (obj.getMuscle().intValue() == 3) {
+            obj.setMuscleStr("持续有");
+        }
+
+        if (obj.getDyspnea().intValue() == 0) {
+            obj.setDyspneaStr("无");
+        } else if (obj.getDyspnea().intValue() == 1) {
+            obj.setDyspneaStr("急走或上坡气短");
+        } else if (obj.getDyspnea().intValue() == 2) {
+            obj.setDyspneaStr("气短而走路变慢");
+        } else if (obj.getDyspnea().intValue() == 3) {
+            obj.setDyspneaStr("走路数分钟后气短");
+        } else if (obj.getDyspnea().intValue() == 4) {
+            obj.setDyspneaStr("气短无法离开房间");
+        }
+
+        if (obj.getFatigue().intValue() == 0) {
+            obj.setFatigueStr("无");
+        } else if (obj.getFatigue().intValue() == 1) {
+            obj.setFatigueStr("可体力劳动但觉得累");
+        } else if (obj.getFatigue().intValue() == 2) {
+            obj.setFatigueStr("轻体力劳动后长时间不能恢复");
+        } else if (obj.getFatigue().intValue() == 3) {
+            obj.setFatigueStr("不能正常生活");
+        }
+
+        if (obj.getDiarrhea().intValue() == 0) {
+            obj.setDiarrheaStr("无");
+        } else if (obj.getDiarrhea().intValue() == 1) {
+            obj.setDiarrheaStr("轻度腹泻少于于3次");
+        } else if (obj.getDiarrhea().intValue() == 2) {
+            obj.setDiarrheaStr("中度腹泻4-6次");
+        } else if (obj.getDiarrhea().intValue() == 3) {
+            obj.setDiarrheaStr("重度腹泻超过6次");
+        }
+
+        if (obj.getSingleRoom().intValue() == 0) {
+            obj.setSingleRoomStr("否");
+        } else if (obj.getSingleRoom().intValue() == 1) {
+            obj.setSingleRoomStr("是");
+        }
+
+        if (obj.getSuspectedStatus().intValue() == 0) {
+            obj.setSuspectedStatusStr("否");
+        } else if (obj.getSuspectedStatus().intValue() == 1) {
+            obj.setSuspectedStatusStr("是");
+        }
+
+        return obj;
     }
 
     //    @Pd(name = "userName") String userName,// 家人姓名

+ 100 - 22
whepi-web/src/main/java/com/bofeng/service/WxUserOpenService.java

@@ -1,13 +1,8 @@
 package com.bofeng.service;
 
 import com.baomidou.mybatisplus.toolkit.IdWorker;
-import com.bofeng.dao.UptownHomeMapper;
-import com.bofeng.dao.UptownHouseMapper;
-import com.bofeng.dao.UserRoleMapper;
-import com.bofeng.entity.UptownHome;
-import com.bofeng.entity.UptownHouse;
-import com.bofeng.entity.UserOpen;
-import com.bofeng.entity.UserRole;
+import com.bofeng.dao.*;
+import com.bofeng.entity.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -28,6 +23,10 @@ public class WxUserOpenService {
     private UptownHouseMapper uptownHouseMapper;
     @Autowired
     private UptownHomeMapper uptownHomeMapper;
+    @Autowired
+    private OwnerMapper ownerMapper;
+    @Autowired
+    private OwnerLinkmanMapper ownerLinkmanMapper;
 
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public Long createRole(Long isFamily, Long isYWH) throws Exception {
@@ -69,29 +68,30 @@ public class WxUserOpenService {
         if (userOpen == null) {
             throw new Exception("微信登录失败");
         }
-        //判断该用户是否已经创建了角色
+        //判断该用户是否已经创建了家庭用户角色
         List<UserRole> lstUserRole = new ArrayList<>();
         if (userOpen.getUserId() > 0L) {
             lstUserRole = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
         }
-        if (lstUserRole.size() == 0) {
-            throw new Exception("尚未创建任何角色");
-        }
-        //判断该用户是否创建了家庭用户的角色
-        Boolean isFamily = false;
-        for (UserRole item : lstUserRole) {
-            if (item.getRoleId() == 1L) {
-                isFamily = true;
-                continue;
+        if (lstUserRole.size() > 0) {
+            for (UserRole item : lstUserRole) {
+                if (item.getRoleId() == 1L) {
+                    throw new Exception("家庭用户角色已存在");   //todo 暂时只允许一个用户角色绑定一个家庭门牌号
+                }
             }
         }
-        if (!isFamily) {
-            throw new Exception("尚未创建家庭用户角色");
-        }
+        //创建家庭用户角色
+        UserRole userRole = new UserRole();
+        userRole.setUrId(IdWorker.getId());
+        userRole.setUserId(userOpen.getUserId());
+        userRole.setUserCreate(userOpen.getUserId());
+        userRole.setUserUpdate(userOpen.getUserId());
+        userRole.setRoleId(1);  //家庭用户
+
         //判断该门牌号是否被创建(该楼栋单元下)
         List<UptownHouse> lstUptownHouse = uptownHouseMapper.getUptownHouseBy(unitId, doorPlate);
         if (lstUptownHouse.size() > 0) {
-            throw new Exception("该门牌已有人入住!");
+            throw new Exception("当前单元下已有该门牌信息!");
         }
         UptownHouse uptownHouse = new UptownHouse();
         uptownHouse.setHouseId(IdWorker.getId());
@@ -101,8 +101,9 @@ public class WxUserOpenService {
         if (uptownHouseMapper.insert(uptownHouse) != 1) {
             throw new Exception("创建门牌失败!");
         }
+        userRole.setPropertyId(uptownHouse.getHouseId());   //绑定家庭用户角色的门牌id
         //判断该门牌是否存在家庭信息
-        List<UptownHome> lstUptownHome = uptownHomeMapper.getUptownHomeBy(uptownHouse.getHouseId(), doorPlate);
+        List<UptownHome> lstUptownHome = uptownHomeMapper.getUptownHomeBy(uptownHouse.getHouseId());
         if (lstUptownHome.size() > 0) {
             throw new Exception("该门牌已有人入住!");
         }
@@ -118,6 +119,83 @@ public class WxUserOpenService {
         if (uptownHomeMapper.insert(uptownHome) != 1) {
             throw new Exception("创建家庭信息失败!");
         }
+        userRoleMapper.insert(userRole);
+
+        return 1L;
+    }
+
+    public Long createYWH(List<OwnerLinkman> lstOwnerMan, Long uptownId) throws Exception {
+        UserOpen userOpen = homeService.getUserOpen();
+        if (userOpen == null) {
+            throw new Exception("微信登录失败");
+        }
+        //判断该用户是否已经创建了业委会角色
+        List<UserRole> lstUserRole = new ArrayList<>();
+        if (userOpen.getUserId() > 0L) {
+            lstUserRole = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+        }
+        if (lstUserRole.size() > 0) {
+            //判断该用户是否创建了业委会的角色
+            for (UserRole item : lstUserRole) {
+                if (item.getRoleId() == 2L) {
+                    throw new Exception("业委会用户角色已存在");   //todo 暂时只允许一个用户角色绑定一个业委会
+                }
+            }
+        }
+        //创建业委会用户角色
+        UserRole userRole = new UserRole();
+        userRole.setUrId(IdWorker.getId());
+        userRole.setUserId(userOpen.getUserId());
+        userRole.setUserCreate(userOpen.getUserId());
+        userRole.setUserUpdate(userOpen.getUserId());
+        userRole.setRoleId(2);  //业委会
+
+        //判断业委会是否已经建立
+        List<Owner> lstOwner = new ArrayList<>();
+        Owner owner;
+        if (uptownId > 0L) {
+            lstOwner = ownerMapper.getOwnerByUptownId(uptownId);
+        }
+        if (lstOwner.size() > 0) {
+            //判断该用户是否创建了业委会
+            for (Owner item : lstOwner) {
+                if (item.getUptownId() == uptownId) {
+                    throw new Exception("该小区已建立业委会");
+                }
+            }
+        }
+        owner = new Owner();
+        owner.setOwnerId(IdWorker.getId());
+        owner.setUptownId(uptownId);
+        owner.setUserCreate(userOpen.getUserId());
+        owner.setUserUpdate(userOpen.getUserId());
+
+        userRole.setPropertyId(owner.getOwnerId());
+        userRoleMapper.insert(userRole);
+
+        //建立业委会成员
+        if (lstOwnerMan == null) {
+            throw new Exception("请新增业委会成员");
+        }
+        int masterNum = 0;
+        for (OwnerLinkman item : lstOwnerMan) {
+            if (item.getType() == 1L) {
+                masterNum++;
+            }
+        }
+        if (masterNum != 1L) {
+            throw new Exception("业委会负责人只允许有一个");
+        }
+        for (OwnerLinkman item : lstOwnerMan) {
+            if (item.getType() == 1L) {
+                owner.setLinkman(item.getLinkman());
+                owner.setPhone(item.getPhone());
+            }
+            item.setOwnerId(owner.getOwnerId());
+            ownerLinkmanMapper.insert(item);
+        }
+        ownerMapper.insert(owner);
+
         return 1L;
     }
 

+ 29 - 3
whepi-web/src/main/java/com/bofeng/wx/controller/MsReportController.java

@@ -34,10 +34,11 @@ public class MsReportController {
     //添加家人
     @PostMapping("/home/addRibao")
     public MsReport saveUser(HttpServletRequest request) {
+
         //初始化今日日报
         Long suspectedId = Conv.NL(request.getParameter("suspectedId"));
         Long userCreate = Conv.NL(request.getParameter("userCreate"));
-        String userName = request.getParameter("userName");
+        String userName = request.getParameter("userName").trim();
         Integer grender = Conv.NI(request.getParameter("grender"));
         Integer age = Conv.NI(request.getParameter("age"));
         Integer familyStatus = Conv.NI(request.getParameter("familyStatus"));
@@ -51,9 +52,18 @@ public class MsReportController {
         Integer diarrhea = Conv.NI(request.getParameter("diarrhea"));
         Integer singleRoom = Conv.NI(request.getParameter("singleRoom"));
         String others = request.getParameter("others");
-        Long reportId =msSuspectedService.addSuspected(suspectedId, userName, grender, age, familyStatus, statusDesp, medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea, singleRoom, others, userCreate);
+        Integer scoreRezult = Conv.NI(request.getParameter("scoreRezult"));
+        Integer temperatureScore = Conv.NI(request.getParameter("temperatureScore"));
+        Integer scoreHistroy = Conv.NI(request.getParameter("scoreHistroy"));
+        Integer score = Conv.NI(request.getParameter("score"));
 
-        return msReportService.getByReport(reportId);
+        MsReport msReport=new MsReport();
+        Long reportId =msSuspectedService.addSuspected(suspectedId, userName, grender, age, familyStatus, statusDesp, medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea, singleRoom, others, userCreate,scoreRezult,temperatureScore,scoreHistroy,score);
+        if(reportId==2L)
+            msReport.setMsgReport("2");
+        else
+            msReport= msReportService.getByReport(reportId);
+        return msReport;
     }
 
     //查询家人
@@ -119,4 +129,20 @@ public class MsReportController {
         msReportService.getNowByYesterday(userCreate);
         return 1;
     }
+
+    //健康评估
+    @PostMapping("/home/addScore")
+    public MsSuspected addScore(HttpServletRequest request) {
+        Long suspectedId = Conv.NL(request.getParameter("suspectedId"));
+        String userName = request.getParameter("userName");
+        Long userCreate = Conv.NL(request.getParameter("userCreate"));
+        BigDecimal temperature = new BigDecimal(request.getParameter("temperature"));
+        Integer cough = Conv.NI(request.getParameter("cough"));
+        Integer muscle = Conv.NI(request.getParameter("muscle"));
+        Integer dyspnea = Conv.NI(request.getParameter("dyspnea"));
+        Integer fatigue = Conv.NI(request.getParameter("fatigue"));
+        Integer diarrhea = Conv.NI(request.getParameter("diarrhea"));
+        return msSuspectedService.getScore(suspectedId,userName,temperature, cough, muscle, dyspnea, fatigue, diarrhea, userCreate);
+    }
+
 }

+ 41 - 73
whepi-web/src/main/java/com/bofeng/wx/controller/RiBaoController.java

@@ -9,13 +9,8 @@ import com.yvan.Model;
 import com.yvan.ModelOps;
 import com.yvan.mvc.Pd;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -54,22 +49,28 @@ public class RiBaoController {
 //    private String time_update;
 
 
-    //查询家人
+    //查询日报
     @GetMapping("/riBao/getRibao")
-    public Model<MsReport> queryRibao(@Pd(name = "userCreate") Long userCreate) {
+    public Model<MsReport> getRibao(@Pd(name = "userCreate") Long userCreate) {
 //    public MsReport queryRibao(@RequestBody MsReport msReportQuery) {
 //    public MsReport queryRibao(@RequestParam(name = "userCreate") Long userCreate) {
 //        Long userCreate = Long.parseLong(request.getParameter("userCreate"));
 //        Long userCreate = msReportQuery.getUserCreate();
-        Long reportId = riBaoService.getNowByYesterday(userCreate);
+
+
+        /*Long reportId = riBaoService.getNowByYesterday(userCreate);
         MsReport msReport = riBaoService.selectById(reportId);
         String houseStr = riBaoService.getHouseStr(msReport.getHouseId());
-        msReport.setHouseIdStr(houseStr);
+        msReport.setHouseIdStr(houseStr);*/
+
 //        return msReport;
+
+        Long reportId = riBaoService.getNowByYesterday(userCreate);
+        MsReport msReport = riBaoService.getRibao(reportId);
         return Model.newSuccess(msReport);
     }
 
-    // 进入日报首页
+    // 查询日报关联的家人列表
     @GetMapping("/riBao/queryRibaoDetailList")
     public Model<List<MsSuspected>> queryRibaoDetailList(@Pd(name = "userCreate") Long userCreate) {
         Long reportId = riBaoService.getNowByYesterday(userCreate);
@@ -77,8 +78,35 @@ public class RiBaoController {
         return Model.newSuccess(listSuspected);
     }
 
+    //查询日报关联的家人
+    @PostMapping("/riBao/getRibaoDetail")
+    public MsSuspected getRibaoDetail(@Pd(name = "suspectedId") Long suspectedId) {
+        return riBaoService.getRibaoDetail(suspectedId);
+    }
+
+    // 新增或者修改日报关联的家人 必须传reportId,userCreate,userUpdate
+    @PostMapping("/riBao/addOrEditRibaoDetail")
+    public Model<MsSuspected> addOrEditRibaoDetail(@RequestBody MsSuspected ribaoDetail) {
+        return ModelOps.newSuccess(riBaoService.addOrEditRibaoDetail(ribaoDetail));
+    }
+
+    // 删除日报关联的家人
+    @PostMapping("/riBao/delRibaoDetail")
+    public ModelOps delRibaoDetail(@RequestParam("suspectedId") Long suspectedId) {
+        return ModelOps.newSuccess(riBaoService.delRibaoDetail(suspectedId));
+    }
+
+
+    // 完成提交日报
+    @PostMapping("/riBao/editRibao")
+    public Model<MsReport> editRibao(@RequestParam("reportId") Long reportId) {
+        MsReport msReport = riBaoService.editRibao(reportId);
+
+        return ModelOps.newSuccess(msReport);
+    }
+
     // 添加日报
-    @PostMapping("/riBao/addOrEditRibao")
+    /*@PostMapping("/riBao/addOrEditRibao")
     public ModelOps addOrEditRibao(
             @Pd(name = "suspectedId") Long suspectedId,
             @Pd(name = "userName") String userName,// 家人姓名
@@ -99,67 +127,7 @@ public class RiBaoController {
             @Pd(name = "userCreate") Long userCreate) {
         msSuspectedService.addSuspected(suspectedId, userName, grender, age, familyStatus, statusDesp, medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea, singleRoom, others, userCreate);
         return ModelOps.newSuccess();
-    }
-
-
-    //查询家人
-    @PostMapping("/riBao/selectSuspected")
-    public MsSuspected selectSuspected(HttpServletRequest request) {
-        //初始化今日日报
-        Long suspectedId = Long.parseLong(request.getParameter("suspectedId"));
-        return msSuspectedService.selectSuspected(suspectedId);
-    }
-
-    //删除家人病例
-    @PostMapping("/riBao/deleteSuspected")
-    public Integer deleteSuspected(HttpServletRequest request) {
-        Long suspectedId = Long.parseLong(request.getParameter("suspectedId"));
-        msSuspectedService.deleteSuspected(suspectedId);
-        return 1;
-    }
+    }*/
 
-//    //根据登录人获取家人
-//    @GetMapping("/riBao/queryRibao")
-//    public Model<List<MsSuspected>> queryRibao(@Pd(name = "userCreate") Long userCreate) {
-//        Date t = new Date();
-//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-//        String reportDate = df.format(t);
-//        return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userCreate));
-//    }
-
-    //根据日报获取家人
-    @PostMapping("/riBao/queryRibaoRefresh")
-    public Model<List<MsSuspected>> queryRibaoRefresh(@Pd(name = "reportId") Long reportId) {
-        return Model.newSuccess(riBaoService.getByReportId(reportId));
-    }
-
-    //全家报平安
-    @PostMapping("/riBao/addReport")
-    public ModelOps addReport(HttpServletRequest request) {
-        Long userCreate = Long.parseLong(request.getParameter("userCreate"));
-        int re = riBaoService.addReport(userCreate);
-        if (re == 1) {
-            return ModelOps.newSuccess();
-        } else if (re == 2) { //没有上报体温
-            return ModelOps.newFail("请填报今日体温!");
-        }
-        return ModelOps.newFail("上报错误");
-    }
 
-    //根据日期获取家人
-    @PostMapping("/riBao/queryRibaoReportDate")
-    public Model<List<MsSuspected>> queryRibaoReportDate(
-            @Pd(name = "reportDate") String reportDate,
-            @Pd(name = "userCreate") Long userCreate) {
-//        return Model.newSuccess(riBaoService.getByReportReportDate(reportDate, userCreate));
-        return Model.newSuccess(new ArrayList<>());
-    }
-
-    //通过昨天数据更新今天数据
-    @PostMapping("/riBao/getNowByYesterday")
-    public Integer getNowByYesterday(HttpServletRequest request) {
-        Long userCreate = Long.parseLong(request.getParameter("userCreate"));
-        riBaoService.getNowByYesterday(userCreate);
-        return 1;
-    }
 }

+ 23 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -1,6 +1,7 @@
 package com.bofeng.wx.controller;
 
 import com.bofeng.dao.RbMapper;
+import com.bofeng.dao.UptownMapper;
 import com.bofeng.entity.*;
 import com.bofeng.excel.ExcelUtils;
 import com.bofeng.service.HomeService;
@@ -45,6 +46,9 @@ public class YeWeiHuiController {
     private HomeService homeService;
 
     @Autowired
+    private UptownMapper uptownMapper;
+
+    @Autowired
     private RbMapper rbMapper;
 
     @GetMapping("/yeweihui/home.html")
@@ -228,4 +232,23 @@ public class YeWeiHuiController {
             ExcelUtils.writeSheet(ExcelRiBao.class, list).export(resp, fileName);
         }
     }
+
+    @ApiOperation("导出家庭上报明细")
+    @GetMapping("/yeweihui/EXR")
+    @SneakyThrows
+    public void exportRiBaoByXiaoQu(@Pd(name = "xid") Long xid,
+                            @Pd(name = "d") String d,
+                            HttpServletResponse resp) {
+
+        Uptown uptown = uptownMapper.selectById(xid);
+
+        if (uptown!=null && uptown.getUptownId()>0) {
+            Long upId = uptown.getUptownId();
+            String fileName = uptown.getUptownName();
+            fileName += "上报信息-";
+            fileName += d;
+            List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId,d);
+            ExcelUtils.writeSheet(ExcelRiBaoPrivate.class, list).export(resp, fileName);
+        }
+    }
 }