shiqian пре 3 година
родитељ
комит
ab081e7eb2

+ 40 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/VaccineInfoOperation.java

@@ -1,5 +1,6 @@
 package com.boman.domain;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import com.boman.domain.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
 
@@ -266,6 +267,45 @@ public class VaccineInfoOperation extends BaseEntity {
     /** true已认领,false未认领**/
     private Boolean ryrl;
 
+    private String deleteReason;
+
+
+    /**
+     * 检索开始时间
+     */
+    @JSONField(format = "yyyy-MM-dd HH:mm")
+    private Date startTime;
+
+    /**
+     * 检索结束时间
+     */
+    @JSONField(format = "yyyy-MM-dd HH:mm")
+    private Date endTime;
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getDeleteReason() {
+        return deleteReason;
+    }
+
+    public void setDeleteReason(String deleteReason) {
+        this.deleteReason = deleteReason;
+    }
+
     public Boolean isRyrl() {
         return ryrl;
     }

+ 13 - 3
boman-web-core/src/main/java/com/boman/web/core/controller/CzrkController.java

@@ -1,5 +1,6 @@
 package com.boman.web.core.controller;
 
+import com.boman.domain.VaccineInfoOperation;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,8 +17,6 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/core/czrk")
 public class CzrkController {
 
-
-
     @Autowired
     private IVaccineInfoService vaccineInfoService;
 
@@ -26,9 +25,20 @@ public class CzrkController {
      *
      * @return com.boman.domain.dto.AjaxResult
      */
-    @GetMapping("/sts")
+    @GetMapping("/stsByCzrk")
     public AjaxResult stsByCzrk() {
         return AjaxResult.success("成功", vaccineInfoService.stsByCzrk());
     }
 
+    /**
+     * 功能描述: 删除常住人口
+     *
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @GetMapping("/deleteCzrk")
+    public AjaxResult deleteCzrk(VaccineInfoOperation vaccineInfoOperation) {
+        return vaccineInfoService.deleteCzrk(vaccineInfoOperation);
+    }
+
+
 }

+ 2 - 2
boman-web-core/src/main/java/com/boman/web/core/controller/RyrlController.java

@@ -74,8 +74,8 @@ public class RyrlController extends BaseController {
      * @return com.boman.domain.dto.AjaxResult
      */
     @GetMapping("/sts")
-    public AjaxResult sts() {
-        return AjaxResult.success("成功", vaccineInfoService.sts());
+    public AjaxResult stsByApplet() {
+        return AjaxResult.success("成功", vaccineInfoService.stsByApplet());
     }
 
 

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/VaccineInfoMapper.java

@@ -106,4 +106,6 @@ public interface VaccineInfoMapper
     int stsByYrl(@Param("deptIdList") List<Long> deptIdList);
 
     int stsByWrl(@Param("deptIdList") List<Long> deptIdList);
+
+    int deleteCzrk(VaccineInfoOperation vaccineInfoOperation);
 }

+ 3 - 1
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/IVaccineInfoService.java

@@ -94,7 +94,9 @@ public interface IVaccineInfoService
 
     VaccineInfoOperation getById(Long id);
 
-    JSONObject sts();
+    JSONObject stsByApplet();
 
     JSONObject stsByCzrk();
+
+    AjaxResult deleteCzrk(VaccineInfoOperation vaccineInfoOperation);
 }

+ 80 - 8
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -41,6 +41,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import static com.boman.common.core.utils.StringUtils.isNotEmpty;
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
 
 /**
  * 疫苗信息Service业务层处理
@@ -166,7 +167,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
                 PageHelper.startPage(pageNum, pageSize, orderBy);
             }
 
-            if (deptId != null){
+            if (deptId != null) {
                 List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
                 List<Long> deptIdList = new ArrayList<>();
                 if (sysDepts != null && sysDepts.size() > 0) {
@@ -915,7 +916,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
     public AjaxResult statistic() {
         List<SysDept> allTowns = remoteDeptService.getByParentId(1L);
         List<JSONObject> result = new ArrayList<>(allTowns.size());
-        List<String> townNameList = ObjectUtils.map(allTowns, SysDept::getDeptName);
+        List<String> townNameList = map(allTowns, SysDept::getDeptName);
 
         LOGGER.info("开始查询");
         long l = System.currentTimeMillis();
@@ -1048,7 +1049,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
             }
         }
 
-        if (deptId != null){
+        if (deptId != null) {
             List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
             List<Long> deptIdList = new ArrayList<>();
             if (sysDepts != null && sysDepts.size() > 0) {
@@ -1063,8 +1064,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
-        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
-        {
+        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
             String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
             PageHelper.startPage(pageNum, pageSize, orderBy);
         }
@@ -1090,7 +1090,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
     }
 
     @Override
-    public JSONObject sts() {
+    public JSONObject stsByApplet() {
         Long deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
         //判断是否是管理员
         List<SysRole> roles = AuthUtils.getLoginUser().getSysUser().getRoles();
@@ -1135,13 +1135,85 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
         // 当前登陆人的deptId
         SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
         String deptName = sysUser.getDept().getDeptName();
+        Long deptId = sysUser.getDeptId();
+        // 当前单位
         result.put("dqdw", deptName);
 
-        Long deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
-//        int village = remoteDeptService.countChildrenByVillage(deptId);
+        List<SysRole> roles = sysUser.getRoles();
+        List<String> roleKeySets = map(roles, SysRole::getRoleKey);
+        // 市领导
+        if (roleKeySets.contains("city") || roleKeySets.contains("admin")) {
+            List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
+            List<SysDept> townsDepts = filter(allDepts, dept -> 1L == dept.getParentId());
+            result.put("zhen", townsDepts.size()); // 镇
+
+            List<SysDept> cunDepts = new ArrayList<>(16);
+            for (SysDept townsDept : townsDepts) {
+                for (SysDept allDept : allDepts) {
+                    if (townsDept.getId().equals(allDept.getParentId())) {
+                        cunDepts.add(allDept);
+                    }
+                }
+            }
+            result.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
 
+            List<SysDept> zuDept = new ArrayList<>(16);
+            for (SysDept cunDept : cunDepts) {
+                for (SysDept allDept : allDepts) {
+                    if (cunDept.getId().equals(allDept.getParentId())) {
+                        zuDept.add(allDept);
+                    }
+                }
+            }
+            result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
+
+            VaccineInfoOperation condition = new VaccineInfoOperation();
+            condition.setStartTime(DateUtils.getTodayStart());
+            condition.setEndTime(DateUtils.getTodayEnd());
+
+//            if (deptId == null) {
+//                deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
+//                //判断是否是管理员
+//                if (isNotEmpty(roles)) {
+//                    for (SysRole role : roles) {
+//                        String roleKey = role.getRoleKey();
+//                        if ("admin".equals(roleKey) || "city".equals(roleKey)) {
+//                            deptId = null;
+//                            break;
+//                        }
+//                    }
+//                }
+//            }
+//
+//            List<Long> deptIdList = new ArrayList<>();
+//            if (deptId != null) {
+//                List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
+//                if (sysDepts != null && sysDepts.size() > 0) {
+//                    for (SysDept sysDept : sysDepts) {
+//                        Long id = sysDept.getId();
+//                        deptIdList.add(id);
+//                    }
+//                }
+//            }
+//            condition.setDeptIdList(deptIdList);
+            List<VaccineInfoOperation> list = vaccineInfoMapper.selectVaccineInfoList(condition);
+
+            result.put("xz", 0);
+            result.put("js", 0);
+        } else if (roleKeySets.contains("sys:town")) {
+            // 镇领导
+
+        }
+//        int village = remoteDeptService.countChildrenByVillage(deptId);
 
 
         return null;
     }
+
+    @Override
+    public AjaxResult deleteCzrk(VaccineInfoOperation vaccineInfoOperation) {
+        vaccineInfoOperation.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
+        int delete = vaccineInfoMapper.deleteCzrk(vaccineInfoOperation);
+        return delete > 0 ? AjaxResult.success() : AjaxResult.error();
+    }
 }

+ 19 - 4
boman-web-core/src/main/resources/mapper/VaccineInfoMapper.xml

@@ -115,6 +115,9 @@ 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="shouldSlow != null and shouldSlow != ''"> and vi.should_slow = #{shouldSlow}</if>
+            <if test="createTime != null and createTime != ''"> and vi.create_time &gt;= #{startTime}</if>
+            <if test="endTime != null and endTime != ''"> and vi.create_time &lt;= #{endTime}</if>
             <if test="shouldSlow != null  and shouldSlow != ''"> and vi.should_slow = #{shouldSlow}</if>
             <if test="idCardS != null  and idCardS.size() > 0">
              and vi.id_card in
@@ -155,7 +158,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 DATE_FORMAT(#{vaccinationTime},'%Y-%m-%d')
             </if>
             <if test="region != null  and region != ''">and vi.region = #{region}</if>
-            <if test="userName != null  and userName != ''">and vi.user_name like concat('%', #{userName}, '%')</if>
+            <!--小程序,一个搜索框既可以搜索姓名,也可以搜索身份证-->
+            <if test="userName != null  and userName != ''">
+                and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
+            </if>
             <if test="gender != null  and gender != ''">and vi.gender = #{gender}</if>
             <if test="idCard != null  and idCard != ''">and vi.id_card like concat('%', #{idCard}, '%')</if>
             <if test="phoneNum != null  and phoneNum != ''">and vi.phone_num = #{phoneNum}</if>
@@ -163,9 +169,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isVaccination != null  and isVaccination != ''">and vi.is_vaccination = #{isVaccination}</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="contraindication != null  and contraindication != ''">and vi.contraindication = #{contraindication}</if>
             <if test="suspend != null  and suspend != ''">and vi.suspend = #{suspend}</if>
             <if test="shouldBe != null  and shouldBe != ''">and vi.should_be = #{shouldBe}</if>
             <if test="other != null  and other != ''">and vi.other = #{other}</if>
@@ -223,6 +227,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
+    <update id="deleteCzrk">
+        update vaccine_info
+        set is_del        = 'Y'
+          , delete_reason = #{deleteReason}
+          , update_by     = #{updateBy}
+          , update_time   = sysdate()
+        where id = #{id}
+    </update>
+
     <select id="selectVaccineInfoListByPage" parameterType="Integer" resultMap="VaccineInfoResult">
         select * from vaccine_info limit   #{startNum}, #{endNum}
     </select>
@@ -293,6 +306,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="otherUrl != null and otherUrl != ''">other_url,</if>
             <if test="age != null and age != ''">age,</if>
             <if test="deptId != null">dept_id,</if>
+            <if test="deleteReason != null">delete_reason,</if>
             create_time
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -337,6 +351,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="otherUrl != null and otherUrl != ''">#{otherUrl},</if>
             <if test="age != null and age != ''">#{age},</if>
             <if test="deptId != null">#{deptId},</if>
+            <if test="deleteReason != null">#{deleteReason},</if>
             sysdate()
          </trim>
     </insert>