Browse Source

fix 新增疫苗操作记录

Administrator 3 năm trước cách đây
mục cha
commit
93e9017f5a

+ 34 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/AdministrativeInfoController.java

@@ -0,0 +1,34 @@
+package com.boman.web.core.controller;
+
+import com.boman.domain.SysDept;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.web.core.domain.AdministrativeInfo;
+import com.boman.web.core.service.vaccineInfo.AdministrativeInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author tjf
+ * @Date: 2021/09/05/13:21
+ */
+@RestController
+@RequestMapping("/administrativeInfo")
+public class AdministrativeInfoController {
+
+    @Resource
+    private AdministrativeInfoService administrativeInfoService;
+    /**
+     * 获取乡镇列表
+     */
+    @GetMapping("/treeSelect")
+    public AjaxResult treeSelect(AdministrativeInfo administrativeInfo)
+    {
+        List<AdministrativeInfo> administrativeInfos = administrativeInfoService.selectAdministrativeInfoList(administrativeInfo);
+        return AjaxResult.success(administrativeInfoService.buildAdministrativeInfoTreeSelect(administrativeInfos));
+    }
+}

+ 130 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/AdministrativeInfo.java

@@ -0,0 +1,130 @@
+package com.boman.web.core.domain;
+
+import com.boman.domain.BaseEntity;
+import com.boman.domain.SysDept;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**乡镇/村/村居委
+ * @author tjf
+ * @Date: 2021/09/05/13:10
+ */
+public class AdministrativeInfo extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private Long id;
+
+    /**
+     * 父id
+     */
+    private Long parentId;
+
+    /**
+     * 名称
+     */
+    private String administrativeName;
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 是否删除 N:未删除 Y:删除
+     */
+    private String isDel;
+
+    /** 子部门 */
+    private List<AdministrativeInfo> children = new ArrayList<AdministrativeInfo>();
+
+    public List<AdministrativeInfo> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<AdministrativeInfo> children) {
+        this.children = children;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getAdministrativeName() {
+        return administrativeName;
+    }
+
+    public void setAdministrativeName(String administrativeName) {
+        this.administrativeName = administrativeName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Integer getOrderNum() {
+        return orderNum;
+    }
+
+    public void setOrderNum(Integer orderNum) {
+        this.orderNum = orderNum;
+    }
+
+    @Override
+    public String getRemark() {
+        return remark;
+    }
+
+    @Override
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getIsDel() {
+        return isDel;
+    }
+
+    public void setIsDel(String isDel) {
+        this.isDel = isDel;
+    }
+
+    @Override
+    public String toString() {
+        return "AdministrativeInfo{" +
+                "id=" + id +
+                ", parentId=" + parentId +
+                ", administrativeName='" + administrativeName + '\'' +
+                ", status='" + status + '\'' +
+                ", orderNum=" + orderNum +
+                ", remark='" + remark + '\'' +
+                ", isDel='" + isDel + '\'' +
+                '}';
+    }
+}

+ 70 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/TreeSelect.java

@@ -0,0 +1,70 @@
+package com.boman.web.core.domain;
+
+import com.boman.domain.SysDept;
+import com.boman.domain.SysMenu;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Treeselect树结构实体类
+ * 
+ * @author ruoyi
+ */
+public class TreeSelect implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 节点ID */
+    private Long id;
+
+    /** 节点名称 */
+    private String label;
+
+    /** 子节点 */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<TreeSelect> children;
+
+    public TreeSelect()
+    {
+
+    }
+
+    public TreeSelect(AdministrativeInfo administrativeInfo) {
+        this.id = administrativeInfo.getId();
+        this.label = administrativeInfo.getAdministrativeName();
+        this.children = administrativeInfo.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public void setLabel(String label)
+    {
+        this.label = label;
+    }
+
+    public List<TreeSelect> getChildren()
+    {
+        return children;
+    }
+
+    public void setChildren(List<TreeSelect> children)
+    {
+        this.children = children;
+    }
+}

+ 19 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/AdministrativeInfoMapper.java

@@ -0,0 +1,19 @@
+package com.boman.web.core.mapper;
+
+import com.boman.web.core.domain.AdministrativeInfo;
+
+import java.util.List;
+
+/**
+ * @author tjf
+ * @Date: 2021/09/05/13:22
+ */
+public interface AdministrativeInfoMapper {
+    /**
+     * 查询乡镇数据
+     *
+     * @param administrativeInfo
+     * @return
+     */
+    List<AdministrativeInfo> selectAdministrativeInfoList(AdministrativeInfo administrativeInfo);
+}

+ 27 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/AdministrativeInfoService.java

@@ -0,0 +1,27 @@
+package com.boman.web.core.service.vaccineInfo;
+
+import com.boman.web.core.domain.AdministrativeInfo;
+import com.boman.web.core.domain.TreeSelect;
+
+import java.util.List;
+
+/**
+ * @author tjf
+ * @Date: 2021/09/05/13:22
+ */
+public interface AdministrativeInfoService {
+    /**
+     * AdministrativeInfo
+     * @param administrativeInfo
+     * @return
+     */
+    List<AdministrativeInfo> selectAdministrativeInfoList(AdministrativeInfo administrativeInfo);
+
+    /**
+     * 构建前端所需要下拉树结构
+     *
+     * @param administrativeInfoList 乡镇列表
+     * @return 下拉树结构列表
+     */
+    List<TreeSelect> buildAdministrativeInfoTreeSelect(List<AdministrativeInfo> administrativeInfoList);
+}

+ 125 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/AdministrativeInfoServiceImpl.java

@@ -0,0 +1,125 @@
+package com.boman.web.core.service.vaccineInfo.impl;
+
+import com.boman.common.core.utils.StringUtils;
+import com.boman.domain.SysDept;
+import com.boman.web.core.domain.AdministrativeInfo;
+import com.boman.web.core.domain.TreeSelect;
+import com.boman.web.core.mapper.AdministrativeInfoMapper;
+import com.boman.web.core.service.vaccineInfo.AdministrativeInfoService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author tjf
+ * @Date: 2021/09/05/13:23
+ */
+@Service
+public class AdministrativeInfoServiceImpl implements AdministrativeInfoService {
+
+    @Resource
+    private AdministrativeInfoMapper administrativeInfoMapper;
+
+    /**
+     * 获取乡镇下拉树
+     * @param administrativeInfo
+     * @return
+     */
+    @Override
+    public List<AdministrativeInfo> selectAdministrativeInfoList(AdministrativeInfo administrativeInfo) {
+        List<AdministrativeInfo> administrativeInfos = administrativeInfoMapper.selectAdministrativeInfoList(administrativeInfo);
+        return administrativeInfos;
+    }
+
+    /**
+     * 构建前端所需要下拉树结构
+     *
+     * @param administrativeInfoList 乡镇列表
+     * @return 下拉树结构列表
+     */
+    @Override
+    public List<TreeSelect> buildAdministrativeInfoTreeSelect(List<AdministrativeInfo> administrativeInfoList) {
+        List<AdministrativeInfo> administrativeInfoTrees = buildAdministrativeInfoTree(administrativeInfoList);
+        return administrativeInfoTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
+    }
+
+
+    /**
+     * 构建前端所需要树结构
+     *
+     * @param administrativeInfoList 乡镇列表
+     * @return 树结构列表
+     */
+    public List<AdministrativeInfo> buildAdministrativeInfoTree(List<AdministrativeInfo> administrativeInfoList)
+    {
+        List<AdministrativeInfo> returnList = new ArrayList<AdministrativeInfo>();
+        List<Long> tempList = new ArrayList<Long>();
+        for (AdministrativeInfo administrativeInfo : administrativeInfoList)
+        {
+            tempList.add(administrativeInfo.getId());
+        }
+        for (Iterator<AdministrativeInfo> iterator = administrativeInfoList.iterator(); iterator.hasNext();)
+        {
+            AdministrativeInfo administrativeInfo = (AdministrativeInfo) iterator.next();
+            // 如果是顶级节点, 遍历该父节点的所有子节点
+            if (!tempList.contains(administrativeInfo.getParentId()))
+            {
+                recursionFn(administrativeInfoList, administrativeInfo);
+                returnList.add(administrativeInfo);
+            }
+        }
+        if (returnList.isEmpty())
+        {
+            returnList = administrativeInfoList;
+        }
+        return administrativeInfoList;
+    }
+
+
+    /**
+     * 递归列表
+     */
+    private void recursionFn(List<AdministrativeInfo> list, AdministrativeInfo t)
+    {
+        // 得到子节点列表
+        List<AdministrativeInfo> childList = getChildList(list, t);
+        t.setChildren(childList);
+        for (AdministrativeInfo tChild : childList)
+        {
+            if (hasChild(list, tChild))
+            {
+                recursionFn(list, tChild);
+            }
+        }
+    }
+
+    /**
+     * 得到子节点列表
+     */
+    private List<AdministrativeInfo> getChildList(List<AdministrativeInfo> list, AdministrativeInfo t)
+    {
+        List<AdministrativeInfo> tlist = new ArrayList<AdministrativeInfo>();
+        Iterator<AdministrativeInfo> it = list.iterator();
+        while (it.hasNext())
+        {
+            AdministrativeInfo n = (AdministrativeInfo) it.next();
+            if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue())
+            {
+                tlist.add(n);
+            }
+        }
+        return tlist;
+    }
+
+    /**
+     * 判断是否有子节点
+     */
+    private boolean hasChild(List<AdministrativeInfo> list, AdministrativeInfo t)
+    {
+        return getChildList(list, t).size() > 0;
+    }
+}

+ 43 - 0
boman-web-core/src/main/resources/mapper/AdministrativeInfoMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.boman.web.core.mapper.AdministrativeInfoMapper">
+    
+    <resultMap type="AdministrativeInfo" id="AdministrativeInfoResult">
+        <result property="id"    column="id"    />
+        <result property="parentId"    column="parent_id"    />
+        <result property="administrativeName"    column="administrative_name"    />
+        <result property="status"    column="status"    />
+        <result property="orderNum"    column="order_num"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDel"    column="is_del"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectAdministrativeInfoVo">
+        select id,parent_id, administrative_name, status, create_by, create_time, update_by, update_time, is_del,remark from sys_administrative_info
+    </sql>
+
+    <select id="selectAdministrativeInfoList" parameterType="com.boman.web.core.domain.AdministrativeInfo" resultMap="AdministrativeInfoResult">
+        <include refid="selectAdministrativeInfoVo"/>
+        <where>
+         is_del = 'N'
+        <if test="parentId != null and parentId != 0">
+            AND parent_id = #{parentId}
+        </if>
+        <if test="administrativeName != null and administrativeName != ''">
+            AND administrative_name like concat('%', #{administrativeName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by parent_id, order_num
+    </select>
+</mapper>

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

@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="domicile"    column="domicile"   />
         <result property="province"    column="province"  />
         <result property="city"    column="city"  />
-        <result property="area"    column="area"  />
+        <result property="region"    column="region"  />
         <result property="userName"    column="user_name"  />
         <result property="gender"    column="gender"  />
         <result property="idCard"    column="id_card"  />
@@ -38,10 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="isDel"    column="is_del"    />
+        <result property="code"    column="code"    />
+        <result property="birthday"    column="birthday"    />
+        <result property="workUnit"    column="work_unit"    />
+        <result property="crowdClassification"    column="crowd_classification"    />
+        <result property="manufacturer"    column="manufacturer"    />
+        <result property="nowIn"    column="now_in"    />
     </resultMap>
 
     <sql id="selectVaccineInfoVo">
-        select id, village_towns, village, villager_group, house_type, domicile, province, city, region, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vaccine_name, jici, vaccination_time, vaccination_place, contraindication, suspend, death, lost_in_missing, should_be, other, progress, remark, status, create_by, create_time, update_by, update_time, is_del from vaccine_info
+        select id, village_towns, village, villager_group, house_type, domicile, province, city, region, user_name, gender, id_card, phone_num, key_industries, is_vaccination, vaccine_name, jici, vaccination_time, vaccination_place, contraindication, suspend, death, lost_in_missing, should_be, other, progress, remark, status, create_by, create_time, update_by, update_time, is_del,code,birthday,work_unit,crowd_classification,manufacturer,now_in from vaccine_info
     </sql>
 
     <select id="selectVaccineInfoList" parameterType="VaccineInfoOperation" resultMap="VaccineInfoResult">
@@ -99,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="domicile != null">domicile,</if>
             <if test="province != null">province,</if>
             <if test="city != null">city,</if>
-            <if test="area != null and area != ''">area,</if>
+            <if test="region != null and region != ''">region,</if>
             <if test="userName != null">user_name,</if>
             <if test="gender != null">gender,</if>
             <if test="idCard != null">id_card,</if>
@@ -133,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="domicile != null">#{domicile},</if>
             <if test="province != null">#{province},</if>
             <if test="city != null">#{city},</if>
-            <if test="area != null and area != ''">#{area},</if>
+            <if test="region != null and region != ''">#{region},</if>
             <if test="userName != null">#{userName},</if>
             <if test="gender != null">#{gender},</if>
             <if test="idCard != null">#{idCard},</if>
@@ -171,7 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="domicile != null">domicile = #{domicile},</if>
             <if test="province != null">province = #{province},</if>
             <if test="city != null">city = #{city},</if>
-            <if test="area != null and area != ''">area = #{area},</if>
+            <if test="region != null and region != ''">region = #{region},</if>
             <if test="userName != null">user_name = #{userName},</if>
             <if test="gender != null">gender = #{gender},</if>
             <if test="idCard != null">id_card = #{idCard},</if>