浏览代码

xielianghe

lange 5 年之前
父节点
当前提交
0700ae66dc

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

@@ -22,8 +22,8 @@ public interface MsSuspectedMapper extends BaseMapper<MsSuspected> {
     List<MsSuspected> selectByReportId(@Param("reportId") Long reportId);
 
     //判断家人姓名是否重复
-    @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 a.* from ms_suspected  a LEFT JOIN ms_report b on a.report_id=b.report_id  where a.report_id=#{reportId} and a.user_name=#{userName} and b.report_date=#{reportDate}")
+    List<MsSuspected> selectUserNameNum(@Param("reportId") Long reportId, @Param("userName") String userName, @Param("reportDate") String reportDate);
 
     //判断家人是否有历史评分
     @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")

+ 4 - 6
whepi-web/src/main/java/com/bofeng/service/MsSuspectedService.java

@@ -102,7 +102,7 @@ public class MsSuspectedService {
             suspectedStatus = 1;
         if (suspectedId == 0L) {
             //判断家人是否同名
-            List<MsSuspected> list = msSuspectedMapper.selectUserNameNum(reportId, userName);
+            List<MsSuspected> list = msSuspectedMapper.selectUserNameNum(reportId, userName,reportDate);
             if (list != null && list.size() > 0)
                 return 2L;
             MsSuspected msSuspected = new MsSuspected();
@@ -134,12 +134,12 @@ public class MsSuspectedService {
             msSuspectedMapper.insert(msSuspected);
         } else {
             //判断家人是否同名
-            List<MsSuspected> list = msSuspectedMapper.selectUserNameNum(reportId, userName);
+            List<MsSuspected> list = msSuspectedMapper.selectUserNameNum(reportId, userName,reportDate);
             if (list != null && list.size() > 0) {
                 if (list.size() > 1)
                     return 2L;
                 else {
-                    if (list.get(0).getSuspectedId() != suspectedId)
+                    if (list.get(0).getSuspectedId().longValue() != suspectedId.longValue())
                         return 2L;
                 }
             }
@@ -233,8 +233,6 @@ public class MsSuspectedService {
         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;
@@ -280,7 +278,7 @@ public class MsSuspectedService {
     public Integer scoreRezulte(Integer scoreHistory, Integer score) {
         Integer scoreRezult = 0;
         //判断用户是否含有历史评分
-        if (scoreHistory == 0) {
+        if (scoreHistory == null) {
             //判断结果
             if (score < 1)
                 scoreRezult = 1;