Explorar o código

Merge remote-tracking branch 'origin/master'

peiguo %!s(int64=5) %!d(string=hai) anos
pai
achega
3b529a0383

+ 5 - 0
admin-ui/app/whepi/tugou/tugou.js

@@ -262,6 +262,11 @@ define(function (require) {
                       title: '单价',
                     },
                     {
+                      field: 'tgItemNum',
+                      title: '单人限额',
+                      align:'left',
+                    },
+                    {
                       field: 'tgMinNum',
                       title: '最低配送(份)',
                       align: 'left',

+ 6 - 0
whepi-ui/templates/groupBuying/groupBuyingCx.ftl

@@ -27,6 +27,8 @@
             <div style="height: 1vh;"></div>
             <p style="text-indent: -0em;margin-left: 2em;">最大订量(份):&nbsp;&nbsp;${ tgItem.tgMaxNum }</p>
             <div style="height: 1vh;"></div>
+            <p id="cx_p_tgItemNum" style="text-indent: -0em;margin-left: 2em;">单人限额(份):&nbsp;&nbsp;</p>
+            <div style="height: 1vh;"></div>
             <p id="cx_p_endTime" style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;</p>
             <div style="height: 1vh;"></div>
             <p id="cx_p_deliverTime"style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;</p>
@@ -55,6 +57,10 @@
     $('#cx_p_endTime').append(tgItem.tgEndTime);
     $('#cx_p_deliverTime').append(tgItem.tgDeliverTime);
 
+    if (tgItem.tgItemNum != 0) {
+        $('#cx_p_tgItemNum').append(tgItem.tgItemNum);
+    }
+
     if (tgItem.remark.length > 0) {
         $('#cx_remark').val(tgItem.remark);
     }

+ 6 - 0
whepi-ui/templates/groupBuying/groupBuyingXx.ftl

@@ -28,6 +28,8 @@
             <div style="height: 1vh;"></div>
             <p style="text-indent: -0em;margin-left: 2em;">最大订量(份):&nbsp;&nbsp;${ tgItem.tgMaxNum }</p>
             <div style="height: 1vh;"></div>
+            <p id="p_tgItemNum" style="text-indent: -0em;margin-left: 2em;">单人限额(份):&nbsp;&nbsp;</p>
+            <div style="height: 1vh;"></div>
             <p id="p_endTime" style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;</p>
             <div style="height: 1vh;"></div>
             <p id="p_deliverTime" style="text-indent: -0em;margin-left: 2em;">预计送货时间:&nbsp;&nbsp;</p>
@@ -134,6 +136,10 @@
     $('#p_endTime').append(tgItem.tgEndTime);
     $('#p_deliverTime').append(tgItem.tgDeliverTime);
 
+    if (tgItem.tgItemNum != 0) {
+        $('#p_tgItemNum').append(tgItem.tgItemNum);
+    }
+
     $('#gb_zb').on('click', function () {
         window.location.href = "/yeweihui/groupBuyingCx.html?operation=remark&jmId=" + tgItem.jmId + "&userId=" + userId;
     });

+ 134 - 0
whepi-web/src/main/java/com/bofeng/service/RiBaoService.java

@@ -4,6 +4,7 @@ package com.bofeng.service;
 import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.*;
 import com.bofeng.entity.*;
+import com.yvan.platform.Conv;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.DateTime;
@@ -47,6 +48,95 @@ public class RiBaoService {
     @Autowired
     private UptownMapper uptownMapper;
 
+    //健康评估
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public MsSuspected getScore(Long susprectedId, String userName, Integer medical, 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(medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea));
+        Integer scoreHistroy = msSuspectedMapper.selectUserNameScore(userCreate, userName, susprectedId);
+        msSuspected.setScoreHistroy(scoreHistroy);
+        msSuspected.setScoreRezult(scoreRezulte(medical, 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(Integer medical, BigDecimal temperature, Integer cough, Integer muscle, Integer dyspnea, Integer fatigue, Integer diarrhea) {
+        Integer score = 0;
+
+        if (medical == 0) {
+            //温度
+            score += getTemperatureScore(temperature);
+            //咳嗽
+            score += cough;
+            //肌肉
+            score += muscle;
+            //肌肉
+            score += dyspnea;
+            //肌肉
+            score += fatigue;
+            //肌肉
+            score += diarrhea;
+        } else
+            score = 5;
+        return score;
+    }
+
+    //评估结果
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer scoreRezulte(Integer medical, Integer scoreHistory, Integer score) {
+        Integer scoreRezult = 0;
+        if (medical == 0) {
+            //判断用户是否含有历史评分
+            if (scoreHistory == null) {
+                //判断结果
+                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 >= 1 && score <= 3)
+                        scoreRezult = 2;
+                    if (score == 4)
+                        scoreRezult = 3;
+                    if (score > 4)
+                        scoreRezult = 4;
+                }
+            }
+        } else
+            scoreRezult = 4;
+        return scoreRezult;
+    }
+
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public MsReport editRibao(Long reportId) {
         DateTime dateTime = new DateTime();
@@ -93,11 +183,55 @@ public class RiBaoService {
         ribaoDetail.setSuspectedStatus(suspectedStatus);
         if (ribaoDetail.getSuspectedId() != null && ribaoDetail.getSuspectedId().longValue() > 0L) {
             ribaoDetail.setTimeUpdate(dateTime);
+
+            //判断是否评估
+            if (ribaoDetail.getScoreRezult() == 0) {
+                MsSuspected score = getScore(
+                        ribaoDetail.getSuspectedId(),
+                        ribaoDetail.getUserName(),
+                        ribaoDetail.getMedical(),
+                        ribaoDetail.getTemperature(),
+                        ribaoDetail.getCough(),
+                        ribaoDetail.getMuscle(),
+                        ribaoDetail.getDyspnea(),
+                        ribaoDetail.getFatigue(),
+                        ribaoDetail.getDiarrhea(),
+                        ribaoDetail.getUserCreate());
+                if (score != null) {
+                    ribaoDetail.setScoreRezult(score.getScoreRezult());
+                    ribaoDetail.setScore(score.getScore());
+                    ribaoDetail.setTemperatureScore(score.getTemperatureScore());
+                    ribaoDetail.setScoreHistroy(score.getScoreHistroy());
+                }
+            }
+
             msSuspectedMapper.updateById(ribaoDetail);
         } else {
             ribaoDetail.setSuspectedId(IdWorker.getId());
             ribaoDetail.setTimeCreate(dateTime);
             ribaoDetail.setTimeUpdate(dateTime);
+
+            //判断是否评估
+            if (ribaoDetail.getScoreRezult() == 0) {
+                MsSuspected score = getScore(
+                        0L,
+                        ribaoDetail.getUserName(),
+                        ribaoDetail.getMedical(),
+                        ribaoDetail.getTemperature(),
+                        ribaoDetail.getCough(),
+                        ribaoDetail.getMuscle(),
+                        ribaoDetail.getDyspnea(),
+                        ribaoDetail.getFatigue(),
+                        ribaoDetail.getDiarrhea(),
+                        ribaoDetail.getUserCreate());
+                if (score != null) {
+                    ribaoDetail.setScoreRezult(score.getScoreRezult());
+                    ribaoDetail.setScore(score.getScore());
+                    ribaoDetail.setTemperatureScore(score.getTemperatureScore());
+                    ribaoDetail.setScoreHistroy(score.getScoreHistroy());
+                }
+            }
+
             msSuspectedMapper.insert(ribaoDetail);
         }
 

+ 17 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/RiBaoController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -119,6 +120,22 @@ public class RiBaoController {
         return ModelOps.newSuccess(riBaoService.delRibaoDetail(suspectedId));
     }
 
+    // 健康评估 日报关联的家人
+    @PostMapping("/riBao/getScore")
+    public Model<MsSuspected> getScore(@JsonBody MsSuspected msSuspected) {
+        Long suspectedId = msSuspected.getSuspectedId();// 新增时传0
+        String userName = msSuspected.getUserName();
+        Long userCreate = msSuspected.getUserCreate();
+        Integer medical = msSuspected.getMedical();
+        BigDecimal temperature = msSuspected.getTemperature();
+        Integer cough = msSuspected.getCough();
+        Integer muscle = msSuspected.getMuscle();
+        Integer dyspnea = msSuspected.getDyspnea();
+        Integer fatigue = msSuspected.getFatigue();
+        Integer diarrhea = msSuspected.getDiarrhea();
+        return ModelOps.newSuccess(riBaoService.getScore(suspectedId, userName, medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea, userCreate));
+    }
+
 
     // 完成提交日报
     @PostMapping("/riBao/editRibao")

+ 1 - 1
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -68,7 +68,7 @@ public class UserOpenController {
             UserOpen userOpen = homeService.getUserOpen();
             list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
 //            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
-//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+//            UserOpen userOpen = userOpenMapper.select ByUserId(1225321682867105793L);
             userId = userOpen.getUserId();
             model.put("user", userOpen);
             model.put("user_id", "\"" + userOpen.getUserId() + "\"");