Browse Source

20220527_sun#721享受社区服务老年人

15143018065 2 years ago
parent
commit
78c3473109

+ 14 - 0
ruoyi-modules/mz-business/src/main/java/com/ruoyi/business/controller/YljgKhJbxxController.java

@@ -4,6 +4,7 @@ import com.ruoyi.business.domain.YljgKhChxxx;
 import com.ruoyi.business.domain.YljgKhJbxx;
 import com.ruoyi.business.domain.YljgKhJbxx;
 import com.ruoyi.business.domain.YljgKhJtxx;
 import com.ruoyi.business.domain.YljgKhJtxx;
 import com.ruoyi.business.service.IYljgKhJbxxService;
 import com.ruoyi.business.service.IYljgKhJbxxService;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -11,6 +12,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.common.security.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
@@ -42,6 +44,18 @@ public class YljgKhJbxxController extends BaseController
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
+    /**
+     * 查询养老机构_客户_基本信息列表
+     */
+    @RequiresPermissions("business:rzjg:list")
+    @GetMapping("/sq/list")
+    public TableDataInfo sqList(YljgKhJbxx yljgKhJbxx)
+    {
+        startPage();
+        List<YljgKhJbxx> list = yljgKhJbxxService.selectYljgKhJbxxSqList(yljgKhJbxx);
+        return getDataTable(list);
+    }
+
     /**
     /**
      * 查询养老机构_客户_基本信息列表
      * 查询养老机构_客户_基本信息列表
      */
      */

+ 2 - 0
ruoyi-modules/mz-business/src/main/java/com/ruoyi/business/mapper/YljgKhJbxxMapper.java

@@ -40,6 +40,8 @@ public interface YljgKhJbxxMapper extends BaseMapperPlus<YljgKhJbxx>
      */
      */
     public List<YljgKhJbxx> selectYljgKhJbxxList(YljgKhJbxx yljgKhJbxx);
     public List<YljgKhJbxx> selectYljgKhJbxxList(YljgKhJbxx yljgKhJbxx);
 
 
+    public List<YljgKhJbxx> selectYljgKhJbxxSqList(YljgKhJbxx yljgKhJbxx);
+
     public List<YljgKhJtxx> selectJtxxList(YljgKhJtxx jtxx);
     public List<YljgKhJtxx> selectJtxxList(YljgKhJtxx jtxx);
 
 
     public List<YljgKhChxxx> selectChxxxList(YljgKhChxxx chxxx);
     public List<YljgKhChxxx> selectChxxxList(YljgKhChxxx chxxx);

+ 2 - 0
ruoyi-modules/mz-business/src/main/java/com/ruoyi/business/service/IYljgKhJbxxService.java

@@ -30,6 +30,8 @@ public interface IYljgKhJbxxService
      */
      */
     public List<YljgKhJbxx> selectYljgKhJbxxList(YljgKhJbxx yljgKhJbxx);
     public List<YljgKhJbxx> selectYljgKhJbxxList(YljgKhJbxx yljgKhJbxx);
 
 
+    public List<YljgKhJbxx> selectYljgKhJbxxSqList(YljgKhJbxx yljgKhJbxx);
+
     public List<YljgKhJtxx> selectJtxxList(YljgKhJtxx jtxx);
     public List<YljgKhJtxx> selectJtxxList(YljgKhJtxx jtxx);
     public List<YljgKhChxxx> selectChxxxList(YljgKhChxxx chxxx);
     public List<YljgKhChxxx> selectChxxxList(YljgKhChxxx chxxx);
     /**
     /**

+ 23 - 0
ruoyi-modules/mz-business/src/main/java/com/ruoyi/business/service/impl/YljgKhJbxxServiceImpl.java

@@ -132,6 +132,29 @@ public class YljgKhJbxxServiceImpl implements IYljgKhJbxxService
         return res;
         return res;
     }
     }
 
 
+    /**
+     * 查询养老机构_客户_基本信息列表
+     *
+     * @param yljgKhJbxx 养老机构_客户_基本信息
+     * @return 养老机构_客户_基本信息
+     */
+    @Override
+    public List<YljgKhJbxx> selectYljgKhJbxxSqList(YljgKhJbxx yljgKhJbxx)
+    {
+        List<YljgKhJbxx> res = yljgKhJbxxMapper.selectYljgKhJbxxSqList(yljgKhJbxx);
+        res.forEach(r -> {
+            r.setAge(String.valueOf(DateUtils.getCurrentAge(
+                    DateUtils.dateTime(YYYYMMDD, r.getCsrq()))) + "岁");
+            Map<String, Object> map = sysDeptJlMapper.selectJlDeptByParams(null, r.getXjdxzqy());
+            if (ObjectUtils.isNotEmpty(map)) {
+                if (map.containsKey(SysDeptJlStatus.NAME.getCode())) {
+                    r.setXjdxzqy(map.get(SysDeptJlStatus.NAME.getCode()).toString());
+                }
+            }
+        });
+        return res;
+    }
+
     @Override
     @Override
     public List<YljgKhJtxx> selectJtxxList(YljgKhJtxx jtxx) {
     public List<YljgKhJtxx> selectJtxxList(YljgKhJtxx jtxx) {
         return yljgKhJbxxMapper.selectJtxxList(jtxx);
         return yljgKhJbxxMapper.selectJtxxList(jtxx);

+ 24 - 2
ruoyi-modules/mz-business/src/main/resources/mapper/business/YljgKhJbxxMapper.xml

@@ -132,7 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select a.id, a.jg_id, a.xm, a.xb, a.zjhm, a.csrq, a.nlpg, a.is_cj, b.jgmc as jgmc,
         select a.id, a.jg_id, a.xm, a.xb, a.zjhm, a.csrq, a.nlpg, a.is_cj, b.jgmc as jgmc,
          b.szxzqh as xjdxzqy
          b.szxzqh as xjdxzqy
          from yljg_kh_jbxx a
          from yljg_kh_jbxx a
-         left join yljg_jcxx b on a.jg_id = b.id
+         left join yljg_jcxx b on a.jg_id = b.id and b.state = '0'
     </sql>
     </sql>
 
 
     <select id="selectYljgKhJbxxList" parameterType="YljgKhJbxx" resultMap="YljgKhJbxxResult">
     <select id="selectYljgKhJbxxList" parameterType="YljgKhJbxx" resultMap="YljgKhJbxxResult">
@@ -140,12 +140,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
         <where>
             a.state = '0'
             a.state = '0'
             and a.is_rz = '1'
             and a.is_rz = '1'
+            and a.create_user_type = '01'
             <if test="xm != null  and xm != ''"> and a.xm like concat('%', #{xm}, '%')</if>
             <if test="xm != null  and xm != ''"> and a.xm like concat('%', #{xm}, '%')</if>
             <if test="zjhm != null  and zjhm != ''"> and a.zjhm like concat('%', #{zjhm}, '%')</if>
             <if test="zjhm != null  and zjhm != ''"> and a.zjhm like concat('%', #{zjhm}, '%')</if>
             <if test="jgmc != null  and jgmc != ''"> and b.jgmc like concat('%', #{jgmc}, '%')</if>
             <if test="jgmc != null  and jgmc != ''"> and b.jgmc like concat('%', #{jgmc}, '%')</if>
             <if test="nlpg != null  and nlpg != ''"> and a.nlpg = #{nlpg}</if>
             <if test="nlpg != null  and nlpg != ''"> and a.nlpg = #{nlpg}</if>
             <if test="isCj != null  and isCj != ''"> and a.is_cj = #{isCj}</if>
             <if test="isCj != null  and isCj != ''"> and a.is_cj = #{isCj}</if>
-            <if test="xzqhId != null  and xzqhId != ''"> and b.szxzqh = #{xzqhId}</if>
+            <if test="xzqhId != null  and xzqhId != ''"> and (b.szxzqh IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{xzqhId} or find_in_set( #{xzqhId} , ancestors ) ))</if>
+        </where>
+    </select>
+
+    <sql id="selectYljgKhJbxxSqVo">
+        select a.id, a.jg_id, a.xm, a.xb, a.zjhm, a.csrq, a.nlpg, a.is_cj, b.jgmc as jgmc,
+         b.szxzqh as xjdxzqy
+         from yljg_kh_jbxx a
+         left join yljgsq_jcxx b on a.jg_id = b.id and b.state = '0'
+    </sql>
+
+    <select id="selectYljgKhJbxxSqList" parameterType="YljgKhJbxx" resultMap="YljgKhJbxxResult">
+        <include refid="selectYljgKhJbxxSqVo"/>
+        <where>
+            a.state = '0'
+            and a.create_user_type = '02'
+            <if test="xm != null  and xm != ''"> and a.xm like concat('%', #{xm}, '%')</if>
+            <if test="zjhm != null  and zjhm != ''"> and a.zjhm like concat('%', #{zjhm}, '%')</if>
+            <if test="jgmc != null  and jgmc != ''"> and b.jgmc like concat('%', #{jgmc}, '%')</if>
+            <if test="nlpg != null  and nlpg != ''"> and a.nlpg = #{nlpg}</if>
+            <if test="isCj != null  and isCj != ''"> and a.is_cj = #{isCj}</if>
+            <if test="xzqhId != null  and xzqhId != ''"> and (b.szxzqh IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{xzqhId} or find_in_set( #{xzqhId} , ancestors ) ))</if>
         </where>
         </where>
     </select>
     </select>
 
 

+ 10 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptJlController.java

@@ -54,6 +54,16 @@ public class SysDeptJlController extends BaseController
         return AjaxResult.success(list);
         return AjaxResult.success(list);
     }
     }
 
 
+    @GetMapping("/tree")
+    public AjaxResult tree(SysDeptJl sysDeptJl)
+    {
+        if(StringUtils.isEmpty(sysDeptJl.getParentId()) && StringUtils.isEmpty(sysDeptJl.getId())){
+            sysDeptJl.setParentId("479a446fce894740b373f9c4b356daac");
+        }
+        List<SysDeptJl> list = sysDeptJlService.selectSysDeptJlTree(sysDeptJl);
+        return AjaxResult.success(list);
+    }
+
     /**
     /**
      *
      *
      * 同步行政区 到部门表
      * 同步行政区 到部门表

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptJlMapper.java

@@ -31,6 +31,8 @@ public interface SysDeptJlMapper extends BaseMapperPlus<SysDeptJl>
      */
      */
     public List<SysDeptJl> selectSysDeptJlList(SysDeptJl sysDeptJl);
     public List<SysDeptJl> selectSysDeptJlList(SysDeptJl sysDeptJl);
 
 
+    public List<SysDeptJl> selectSysDeptJlTree(SysDeptJl sysDeptJl);
+
     /**
     /**
      * 新增吉林地区管理
      * 新增吉林地区管理
      *
      *

+ 1 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptJlService.java

@@ -29,6 +29,7 @@ public interface ISysDeptJlService
      */
      */
     public List<SysDeptJl> selectSysDeptJlList(SysDeptJl sysDeptJl);
     public List<SysDeptJl> selectSysDeptJlList(SysDeptJl sysDeptJl);
 
 
+    public List<SysDeptJl> selectSysDeptJlTree(SysDeptJl sysDeptJl);
     /**
     /**
      * 检查是否有父级行政地区id信息
      * 检查是否有父级行政地区id信息
      *
      *

+ 7 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptJlServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
 import com.alibaba.nacos.client.utils.LogUtils;
 import com.alibaba.nacos.client.utils.LogUtils;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.datascope.annotation.DataScope;
 import com.ruoyi.common.redis.service.RedisService;
 import com.ruoyi.common.redis.service.RedisService;
 import com.ruoyi.system.api.domain.SysDept;
 import com.ruoyi.system.api.domain.SysDept;
 import com.ruoyi.system.domain.SysDeptJl;
 import com.ruoyi.system.domain.SysDeptJl;
@@ -57,6 +58,12 @@ public class SysDeptJlServiceImpl implements ISysDeptJlService {
         return sysDeptJlMapper.selectSysDeptJlList(sysDeptJl);
         return sysDeptJlMapper.selectSysDeptJlList(sysDeptJl);
     }
     }
 
 
+    @Override
+    @DataScope(deptAlias = "a")
+    public List<SysDeptJl> selectSysDeptJlTree(SysDeptJl sysDeptJl) {
+        return sysDeptJlMapper.selectSysDeptJlTree(sysDeptJl);
+    }
+
     @Override
     @Override
     public void checkParentId(String parentId) {
     public void checkParentId(String parentId) {
         if (StringUtils.isNull(sysDeptJlMapper.selectSysDeptJlById(parentId))) {
         if (StringUtils.isNull(sysDeptJlMapper.selectSysDeptJlById(parentId))) {

+ 16 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptJlMapper.xml

@@ -45,6 +45,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by a.code asc
         order by a.code asc
     </select>
     </select>
 
 
+    <select id="selectSysDeptJlTree" parameterType="SysDeptJl" resultMap="SysDeptJlResult">
+        select * from (select id, code, code as dept_id, name, parent_id, level
+        from sys_dept_jl) as a
+        <where>
+            a.level &lt; 4
+            <if test="id != null  and id != ''"> and a.id = #{id}</if>
+            <if test="code != null  and code != ''"> and a.code = #{code}</if>
+            <if test="name != null  and name != ''"> and a.name like concat('%', #{name}, '%')</if>
+            <if test="parentId != null  and parentId != ''"> and (select id from sys_dept_jl where code = #{parentId}) = a.parent_id</if>
+            <if test="level != null "> and level = #{level}</if>
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by a.code asc
+    </select>
+
     <select id="selectSysDeptJlById" parameterType="String" resultMap="SysDeptJlResult">
     <select id="selectSysDeptJlById" parameterType="String" resultMap="SysDeptJlResult">
         <include refid="selectSysDeptJlVo"/>
         <include refid="selectSysDeptJlVo"/>
         where a.id = #{id}
         where a.id = #{id}

+ 8 - 0
ruoyi-ui/src/api/business/xxcx/lrxx/rzjg.js

@@ -8,6 +8,14 @@ export function listKhxxByJg(query) {
   })
   })
 }
 }
 
 
+export function listKhxxBySqJg(query) {
+  return request({
+    url: '/business/lrxxcx/sq/list',
+    method: 'get',
+    params: query
+  })
+}
+
 export function getKhxxByJg(id) {
 export function getKhxxByJg(id) {
   return request({
   return request({
     url: '/business/lrxxcx/' + id,
     url: '/business/lrxxcx/' + id,

+ 9 - 0
ruoyi-ui/src/api/system/region.js

@@ -8,3 +8,12 @@ export function CountryDeptList(query) {
     params: query
     params: query
   })
   })
 }
 }
+
+
+export function treeDeptJlList(query) {
+  return request({
+    url: '/system/jlDept/tree',
+    method: 'get',
+    params: query
+  })
+}

+ 9 - 9
ruoyi-ui/src/views/business/xxcx/lrxx/rzjg/index.vue

@@ -522,7 +522,7 @@
 <script>
 <script>
 import { listKhxxByJg, getKhxxByJg, listJtxx, listChxxx } from "@/api/business/xxcx/lrxx/rzjg";
 import { listKhxxByJg, getKhxxByJg, listJtxx, listChxxx } from "@/api/business/xxcx/lrxx/rzjg";
 import Treeselect from "@riophae/vue-treeselect";
 import Treeselect from "@riophae/vue-treeselect";
-import {listDeptByData, treeselect} from "@/api/system/dept";
+import { treeDeptJlList } from "@/api/system/region";
 import {mapState,mapGetters} from "vuex";
 import {mapState,mapGetters} from "vuex";
 
 
 export default {
 export default {
@@ -613,7 +613,7 @@ export default {
       },
       },
       defaultProps: {
       defaultProps: {
         children: "children",
         children: "children",
-        label: "deptName"
+        label: "name"
       },
       },
       // 表单参数
       // 表单参数
       form: {},
       form: {},
@@ -643,17 +643,17 @@ export default {
         return;
         return;
       }
       }
       if (this.queryStr == queryString){
       if (this.queryStr == queryString){
-        cb(this.queryDataList.data.map(item=>{return {value:item.deptName,...item}}));
+        cb(this.queryDataList.data.map(item=>{return {value:item.name,...item}}));
         return;
         return;
       }
       }
-      this.queryDataList = await listDeptByData({
-        deptName: queryString,
+      this.queryDataList = await treeDeptJlList({
+        name: queryString,
       });
       });
       if (this.queryDataList.code !== 200) {
       if (this.queryDataList.code !== 200) {
         return;
         return;
       }
       }
       this.queryStr = queryString;
       this.queryStr = queryString;
-      cb(this.queryDataList.data.map(item=>{return {value:item.deptName,...item}}));
+      cb(this.queryDataList.data.map(item=>{return {value:item.name,...item}}));
     },
     },
 
 
     handleSelect(item) {
     handleSelect(item) {
@@ -666,13 +666,13 @@ export default {
     },
     },
     // 节点单击事件
     // 节点单击事件
     handleNodeClick(data) {
     handleNodeClick(data) {
-      this.queryParams.xzqhId = data.deptId;
+      this.queryParams.xzqhId = data.code;
       console.log(data)
       console.log(data)
       this.handleQuery();
       this.handleQuery();
     },
     },
     async loadNode(node, resolve) {
     async loadNode(node, resolve) {
-      const parentId = node.level == 0? this.user.userData.dept.parentId :node.data.deptId;
-      let {code, data} = await listDeptByData({
+      const parentId = node.level == 0? this.user.userData.dept.parentId :node.data.code;
+      let {code, data} = await treeDeptJlList({
         parentId
         parentId
       });
       });
       if (code !== 200) {
       if (code !== 200) {

+ 11 - 11
ruoyi-ui/src/views/business/xxcx/lrxx/sqfw/index.vue

@@ -520,9 +520,9 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { listKhxxByJg, getKhxxByJg, listJtxx, listChxxx } from "@/api/business/xxcx/lrxx/rzjg";
+import { listKhxxBySqJg, getKhxxByJg, listJtxx, listChxxx } from "@/api/business/xxcx/lrxx/rzjg";
 import Treeselect from "@riophae/vue-treeselect";
 import Treeselect from "@riophae/vue-treeselect";
-import {listDeptByData, treeselect} from "@/api/system/dept";
+import { treeDeptJlList } from "@/api/system/region";
 import {mapState,mapGetters} from "vuex";
 import {mapState,mapGetters} from "vuex";
 
 
 export default {
 export default {
@@ -613,7 +613,7 @@ export default {
       },
       },
       defaultProps: {
       defaultProps: {
         children: "children",
         children: "children",
-        label: "deptName"
+        label: "name"
       },
       },
       // 表单参数
       // 表单参数
       form: {},
       form: {},
@@ -643,17 +643,17 @@ export default {
         return;
         return;
       }
       }
       if (this.queryStr == queryString){
       if (this.queryStr == queryString){
-        cb(this.queryDataList.data.map(item=>{return {value:item.deptName,...item}}));
+        cb(this.queryDataList.data.map(item=>{return {value:item.name,...item}}));
         return;
         return;
       }
       }
-      this.queryDataList = await listDeptByData({
-        deptName: queryString,
+      this.queryDataList = await treeDeptJlList({
+        name: queryString,
       });
       });
       if (this.queryDataList.code !== 200) {
       if (this.queryDataList.code !== 200) {
         return;
         return;
       }
       }
       this.queryStr = queryString;
       this.queryStr = queryString;
-      cb(this.queryDataList.data.map(item=>{return {value:item.deptName,...item}}));
+      cb(this.queryDataList.data.map(item=>{return {value:item.name,...item}}));
     },
     },
 
 
     handleSelect(item) {
     handleSelect(item) {
@@ -666,13 +666,13 @@ export default {
     },
     },
     // 节点单击事件
     // 节点单击事件
     handleNodeClick(data) {
     handleNodeClick(data) {
-      this.queryParams.xzqhId = data.deptId;
+      this.queryParams.xzqhId = data.code;
       console.log(data)
       console.log(data)
       this.handleQuery();
       this.handleQuery();
     },
     },
     async loadNode(node, resolve) {
     async loadNode(node, resolve) {
-      const parentId = node.level == 0? this.user.userData.dept.parentId :node.data.deptId;
-      let {code, data} = await listDeptByData({
+      const parentId = node.level == 0? this.user.userData.dept.parentId :node.data.code;
+      let {code, data} = await treeDeptJlList({
         parentId
         parentId
       });
       });
       if (code !== 200) {
       if (code !== 200) {
@@ -740,7 +740,7 @@ export default {
     /** 查询养老机构_客户_基本信息列表 */
     /** 查询养老机构_客户_基本信息列表 */
     getList() {
     getList() {
       this.loading = true;
       this.loading = true;
-      listKhxxByJg(this.queryParams).then((response) => {
+      listKhxxBySqJg(this.queryParams).then((response) => {
         this.khjbxxList = response.rows;
         this.khjbxxList = response.rows;
         this.total = response.total;
         this.total = response.total;
         this.loading = false;
         this.loading = false;