Ver Fonte

fix 列表查询,提取年龄

Administrator há 3 anos atrás
pai
commit
04b71b447f

+ 9 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/VaccineInfoController.java

@@ -12,6 +12,7 @@ import com.boman.common.log.enums.BusinessType;
 import com.boman.common.security.annotation.PreAuthorize;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.domain.VaccineInfoOperation;
+import com.boman.web.core.domain.VaccineInfoUser;
 import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
 import com.boman.web.core.service.vaccineInfo.IVaccineInfoUserService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -121,5 +122,13 @@ public class VaccineInfoController extends BaseController {
         return AjaxResult.success(hjInfo);
     }
 
+    /**
+     * 根据身份证号查询用户疫苗信息集合
+     */
+    @PostMapping("/findInfoUser")
+    public AjaxResult findInfoUser(@RequestBody VaccineInfoUser vaccineInfoUser) {
+        List<VaccineInfoUser> vaccineInfoUsers = vaccineInfoUserService.selectInfoUserByIdCard(vaccineInfoUser);
+        return AjaxResult.success(vaccineInfoUsers);
+    }
 
 }

+ 13 - 42
boman-web-core/src/main/java/com/boman/web/core/domain/VaccineInfoOperation.java

@@ -230,6 +230,19 @@ public class VaccineInfoOperation extends BaseEntity {
      */
     private List<VaccineInfoUser> vaccineInfoUserList;
 
+    /**
+     * 查询用的身份证集合
+     */
+    private List<String> idCardS;
+
+    public List<String> getIdCardS() {
+        return idCardS;
+    }
+
+    public void setIdCardS(List<String> idCardS) {
+        this.idCardS = idCardS;
+    }
+
     public Integer getAge() {
         return age;
     }
@@ -551,46 +564,4 @@ public class VaccineInfoOperation extends BaseEntity {
     }
 
 
-    @Override
-    public String toString() {
-        return "VaccineInfoOperation{" +
-                "id=" + id +
-                ", villageTowns='" + villageTowns + '\'' +
-                ", village='" + village + '\'' +
-                ", villagerGroup='" + villagerGroup + '\'' +
-                ", houseType='" + houseType + '\'' +
-                ", domicile='" + domicile + '\'' +
-                ", province='" + province + '\'' +
-                ", city='" + city + '\'' +
-                ", region='" + region + '\'' +
-                ", userName='" + userName + '\'' +
-                ", gender='" + gender + '\'' +
-                ", idCard='" + idCard + '\'' +
-                ", phoneNum='" + phoneNum + '\'' +
-                ", keyIndustries='" + keyIndustries + '\'' +
-                ", isVaccination='" + isVaccination + '\'' +
-                ", vaccineName='" + vaccineName + '\'' +
-                ", jici='" + jici + '\'' +
-                ", vaccinationTime=" + vaccinationTime +
-                ", vaccinationPlace='" + vaccinationPlace + '\'' +
-                ", contraindication='" + contraindication + '\'' +
-                ", suspend='" + suspend + '\'' +
-                ", death='" + death + '\'' +
-                ", lostInMissing='" + lostInMissing + '\'' +
-                ", shouldBe='" + shouldBe + '\'' +
-                ", other='" + other + '\'' +
-                ", progress='" + progress + '\'' +
-                ", status='" + status + '\'' +
-                ", isDel='" + isDel + '\'' +
-                ", operationType='" + operationType + '\'' +
-                ", vaccineInfoId=" + vaccineInfoId +
-                ", code='" + code + '\'' +
-                ", birthday='" + birthday + '\'' +
-                ", workUnit='" + workUnit + '\'' +
-                ", crowdClassification='" + crowdClassification + '\'' +
-                ", manufacturer='" + manufacturer + '\'' +
-                ", nowIn='" + nowIn + '\'' +
-                ", url='" + url + '\'' +
-                '}';
-    }
 }

+ 10 - 1
boman-web-core/src/main/java/com/boman/web/core/mapper/VaccineInfoUserMapper.java

@@ -2,6 +2,7 @@ package com.boman.web.core.mapper;
 
 import com.boman.web.core.domain.VaccineInfoOperation;
 import com.boman.web.core.domain.VaccineInfoUser;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,7 +18,7 @@ public interface VaccineInfoUserMapper {
      * @param idCard 用户身份证
      * @return 结果
      */
-    public List<VaccineInfoUser> selectVaccineInfoUserByIdCard(String idCard);
+    public List<VaccineInfoUser> selectVaccineInfoUserByIdCard(@Param("idCard") String idCard);
 
 
     /**
@@ -51,4 +52,12 @@ public interface VaccineInfoUserMapper {
      * @return 结果
      */
     public int deleteVaccineInfoUserByIds(Long[] ids);
+
+
+    /**
+     * 根据条件查询身份证列表
+     * @param vaccineInfoUser
+     * @return
+     */
+    public List<String> selectIdCardList(VaccineInfoUser vaccineInfoUser);
 }

+ 11 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/IVaccineInfoUserService.java

@@ -1,5 +1,9 @@
 package com.boman.web.core.service.vaccineInfo;
 
+import com.boman.web.core.domain.VaccineInfoUser;
+
+import java.util.List;
+
 /**
  * @author tjf
  * @Date: 2021/09/07/9:56
@@ -12,4 +16,11 @@ public interface IVaccineInfoUserService {
      * @return 结果
      */
     public int deleteVaccineInfoUserByIds(Long[] ids);
+
+    /**根据身份证号查询用户疫苗信息集合
+     *
+     * @param vaccineInfoUser
+     * @return
+     */
+    public List<VaccineInfoUser> selectInfoUserByIdCard(VaccineInfoUser vaccineInfoUser);
 }

+ 29 - 7
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -2,8 +2,10 @@ package com.boman.web.core.service.vaccineInfo.impl;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import com.alibaba.fastjson.JSONObject;
 import com.boman.common.core.utils.DateUtils;
@@ -43,13 +45,6 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
     @Resource
     private VaccineInfoUserMapper vaccineInfoUserMapper;
 
-
-    private void save(List<VaccineInfoOperation> list) {
-        for(VaccineInfoOperation operation : list) {
-            vaccineInfoMapper.insertVaccineInfo(operation);
-        }
-    }
-
     /**
      * 查询疫苗信息
      *
@@ -75,6 +70,33 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
      */
     @Override
     public List<VaccineInfoOperation> selectVaccineInfoList(VaccineInfoOperation vaccineInfoOperation) {
+        Map<String, Object> params = vaccineInfoOperation.getParams();
+        String age = params.get("age").toString();
+        if (StringUtils.isNotBlank(age)){
+            String[] split = age.split("-");
+            params.put("startAge",split[0]);
+            if (split.length == 2){
+                params.put("endAge",split[1]);
+            }
+        }
+        //疫苗名称
+        String vaccineName = vaccineInfoOperation.getVaccineName();
+        //计次
+        String jici = vaccineInfoOperation.getJici();
+        //接种时间
+        Date vaccinationTime = vaccineInfoOperation.getVaccinationTime();
+        //接种地点
+        String vaccinationPlace = vaccineInfoOperation.getVaccinationPlace();
+        List<String> idCardS = new ArrayList<>();
+        if (StringUtils.isNotBlank(vaccineName) || StringUtils.isNotBlank(jici) || vaccinationTime != null || StringUtils.isNotBlank(vaccinationPlace)){
+            VaccineInfoUser vaccineInfoUser = new VaccineInfoUser();
+            vaccineInfoUser.setVaccineName(vaccineName);
+            vaccineInfoUser.setJici(jici);
+            vaccineInfoUser.setVaccinationTime(vaccinationTime);
+            vaccineInfoUser.setVaccinationPlace(vaccinationPlace);
+            idCardS = vaccineInfoUserMapper.selectIdCardList(vaccineInfoUser);
+            vaccineInfoOperation.setIdCardS(idCardS);
+        }
         return vaccineInfoMapper.selectVaccineInfoList(vaccineInfoOperation);
     }
 

+ 19 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoUserServiceImpl.java

@@ -1,10 +1,14 @@
 package com.boman.web.core.service.vaccineInfo.impl;
 
+import com.boman.common.core.utils.StringUtils;
+import com.boman.web.core.domain.VaccineInfoUser;
 import com.boman.web.core.mapper.VaccineInfoUserMapper;
 import com.boman.web.core.service.vaccineInfo.IVaccineInfoUserService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author tjf
@@ -25,4 +29,19 @@ public class VaccineInfoUserServiceImpl implements IVaccineInfoUserService {
     public int deleteVaccineInfoUserByIds(Long[] ids) {
         return vaccineInfoUserMapper.deleteVaccineInfoUserByIds(ids);
     }
+
+    /**
+     * 根据身份证号查询用户疫苗信息集合
+     * @param vaccineInfoUser
+     * @return
+     */
+    @Override
+    public List<VaccineInfoUser> selectInfoUserByIdCard(VaccineInfoUser vaccineInfoUser) {
+        String idCard = vaccineInfoUser.getIdCard();
+        List<VaccineInfoUser> list  = new ArrayList();
+        if (StringUtils.isNotBlank(idCard)){
+            list = vaccineInfoUserMapper.selectVaccineInfoUserByIdCard(idCard.trim());
+        }
+        return list;
+    }
 }

+ 8 - 5
boman-web-core/src/main/resources/mapper/VaccineInfoMapper.xml

@@ -88,17 +88,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="phoneNum != null  and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
             <if test="keyIndustries != null  and keyIndustries != ''"> and vi.key_industries = #{keyIndustries}</if>
             <if test="isVaccination != null  and isVaccination != ''"> and vi.is_vaccination = #{isVaccination}</if>
-<!--            <if test="vaccineName != null  and vaccineName != ''"> and viu.vaccine_name like concat('%', #{vaccineName}, '%')</if>
-            <if test="jici != null  and jici != ''"> and viu.jici = #{jici}</if>
-            <if test="vaccinationTime != null "> and viu.vaccination_time = #{vaccinationTime}</if>
-            <if test="vaccinationPlace != null  and vaccinationPlace != ''"> and viu.vaccination_place = #{vaccinationPlace}</if>-->
+            <if test="params.startAge != null  and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>
             <if test="contraindication != null  and contraindication != ''"> and vi.contraindication = #{contraindication}</if>
             <if test="suspend != null  and suspend != ''"> and vi.suspend = #{suspend}</if>
             <if test="death != null  and death != ''"> and vi.death = #{death}</if>
             <if test="lostInMissing != null  and lostInMissing != ''"> and vi.lost_in_missing = #{lostInMissing}</if>
             <if test="shouldBe != null  and shouldBe != ''"> and vi.should_be = #{shouldBe}</if>
             <if test="other != null  and other != ''"> and vi.other = #{other}</if>
-<!--            <if test="progress != null  and progress != ''"> and viu.progress = #{progress}</if>-->
             <if test="status != null  and status != ''"> and vi.status = #{status}</if>
             <if test="code != null  and code != ''"> and vi.code = #{code}</if>
             <if test="birthday != null  and birthday != ''"> and vi.birthday = #{birthday}</if>
@@ -106,6 +103,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="crowdClassification != null  and crowdClassification != ''"> and vi.crowd_classification = #{crowdClassification}</if>
             <if test="manufacturer != null  and manufacturer != ''"> and vi.manufacturer = #{manufacturer}</if>
             <if test="nowIn != null  and nowIn != ''"> and vi.now_in = #{nowIn}</if>
+            <if test="idCardS != null  and idCardS.size() > 0">
+             and vi.id_card in
+            <foreach item="idCard" collection="idCardS" open="(" separator="," close=")">
+                #{idCard}
+            </foreach>
+            </if>
         </where>
         order by vi.create_time DESC
     </select>

+ 15 - 2
boman-web-core/src/main/resources/mapper/VaccineInfoUserMapper.xml

@@ -21,9 +21,22 @@
         <result property="isDel"    column="is_del"    />
     </resultMap>
 
-    <select id="selectVaccineInfoUserByIdCard" parameterType="String">
-       select id from vaccine_info_user  where id_card = #{idCard} and is_del = 'N'
+
+    <select id="selectVaccineInfoUserByIdCard" resultMap="VaccineInfoUser">
+               select id,id_card,vaccine_name,jici,vaccination_time,vaccination_place,progress,status from vaccine_info_user  where id_card = #{idCard} and is_del = 'N'
+    </select>
+
+    <select id="selectIdCardList" parameterType="VaccineInfoUser" resultType="java.lang.String">
+        SELECT DISTINCT id_card FROM vaccine_info_user
+        <where>
+            is_del = 'N'
+            <if test="vaccineName != null  and vaccineName != ''"> and vaccine_name like concat('%', #{vaccineName}, '%')</if>
+            <if test="jici != null  and jici != ''"> and jici = #{jici}</if>
+            <if test="vaccinationTime != null "> and DATE_FORMAT(vaccination_time,'yyyy-MM-dd') = DATE_FORMAT(#{vaccinationTime},'yyyy-MM-dd')</if>
+            <if test="vaccinationPlace != null  and vaccinationPlace != ''"> and vaccination_place = #{vaccinationPlace}</if>
+        </where>
     </select>
+
     <insert id="insertVaccineInfoUser" parameterType="VaccineInfoUser" useGeneratedKeys="true" keyProperty="id">
         insert into vaccine_info_user
         <trim prefix="(" suffix=")" suffixOverrides=",">