Explorar o código

Merge branch '20220602_sun优化客户管理入住管理相关页面' of sckj/mz-cloud into master

sckj %!s(int64=2) %!d(string=hai) anos
pai
achega
94f91664a2

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

@@ -136,4 +136,6 @@ public interface YljgKhJbxxMapper extends BaseMapperPlus<YljgKhJbxx>
     public int deleteYljgKhFwxmByKhId(String id);
 
     public List<YljgKhJbxx> checkYljgKhJbxx(YljgKhJbxx yljgKhJbxx);
+
+    public List<YljgKhJbxx> selectYljgKhJbxxJkglList(YljgKhJbxx yljgKhJbxx);
 }

+ 11 - 11
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgKhJbxxServiceImpl.java

@@ -155,17 +155,17 @@ public class YljgKhJbxxServiceImpl implements IYljgKhJbxxService
     @Override
     public List<YljgKhJbxx> selectYljgKhJbxxJkglList(YljgKhJbxx yljgKhJbxx)
     {
-        List<YljgKhJbxx> res = yljgKhJbxxMapper.selectYljgKhJbxxList(yljgKhJbxx);
-        for (YljgKhJbxx r: res) {
-            YljgKhHtxx htxxQuery = new YljgKhHtxx();
-            htxxQuery.setKhId(r.getId());
-            YljgKhHtxx htxx = yljgKhHtxxMapper.selectYljgKhHtxxList(htxxQuery).stream().findFirst()
-                    .orElse(null);
-            if (ObjectUtils.isNotEmpty(htxx)) {
-                r.setFjh(yljgFwcdFjMapper.selectYljgFwcdFjById(htxx.getFjId()).getFjmc());
-                r.setCwh(yljgFwcdCwMapper.selectYljgFwcdCwById(htxx.getCwId()).getCwh());
-            }
-        }
+        List<YljgKhJbxx> res = yljgKhJbxxMapper.selectYljgKhJbxxJkglList(yljgKhJbxx);
+//        for (YljgKhJbxx r: res) {
+//            YljgKhHtxx htxxQuery = new YljgKhHtxx();
+//            htxxQuery.setKhId(r.getId());
+//            YljgKhHtxx htxx = yljgKhHtxxMapper.selectYljgKhHtxxList(htxxQuery).stream().findFirst()
+//                    .orElse(null);
+//            if (ObjectUtils.isNotEmpty(htxx)) {
+//                r.setFjh(yljgFwcdFjMapper.selectYljgFwcdFjById(htxx.getFjId()).getFjmc());
+//                r.setCwh(yljgFwcdCwMapper.selectYljgFwcdCwById(htxx.getCwId()).getCwh());
+//            }
+//        }
         return res;
     }
 

+ 53 - 16
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgKhRztzxxServiceImpl.java

@@ -14,7 +14,9 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * 养老机构_客户_入住退住信息Service业务层处理
@@ -73,7 +75,21 @@ public class YljgKhRztzxxServiceImpl implements IYljgKhRztzxxService
     @Override
     public List<YljgKhRztzxx> selectYljgKhRztzxxListByHtxx(YljgKhRztzxx yljgKhRztzxx)
     {
-        return yljgKhRztzxxMapper.selectYljgKhRztzxxListByHtxx(yljgKhRztzxx);
+        List<YljgKhRztzxx> res = yljgKhRztzxxMapper.selectYljgKhRztzxxListByHtxx(yljgKhRztzxx);
+        for (YljgKhRztzxx tz: res) {
+            YljgKhRztzxx query = new YljgKhRztzxx();
+            query.setJgId(yljgKhRztzxx.getJgId());
+            query.setKhId(tz.getKhId());
+            query.setState(StateStatus.NORMAL.getCode());
+            Optional<YljgKhRztzxx> insertTz = yljgKhRztzxxMapper.selectYljgKhRztzxxList(query).stream().filter(y
+                    -> StringUtils.isEmpty(y.getTzsqrq())).max(Comparator
+                    .comparing(YljgKhRztzxx::getCreateTimeStr));
+            insertTz.ifPresent(khRztzxx -> {
+                tz.setId(khRztzxx.getId());
+                tz.setSjrzsj(khRztzxx.getSjrzsj());
+            });
+        }
+        return res;
     }
 
     /**
@@ -86,21 +102,24 @@ public class YljgKhRztzxxServiceImpl implements IYljgKhRztzxxService
     public List<YljgKhRztzxx> selectYljgKhRztzxxListByHtxxTz(YljgKhRztzxx yljgKhRztzxx)
     {
         List<YljgKhRztzxx> res = yljgKhRztzxxMapper.selectYljgKhRztzxxListByHtxxTz(yljgKhRztzxx);
-//        for (YljgKhRztzxx tz: res) {
-//            YljgKhRztzxx query = new YljgKhRztzxx();
-//            query.setKhId(tz.getKhId());
-//            Optional<YljgKhRztzxx> insertTz = yljgKhRztzxxMapper.selectYljgKhRztzxxList(query).stream().filter(y
-//                    -> StringUtils.isNotEmpty(y.getTzsqrq())).max(Comparator
-//                    .comparing(YljgKhRztzxx::getCreateTimeStr));
-//            insertTz.ifPresent(khRztzxx -> {
-//                tz.setId(khRztzxx.getId());
-//                tz.setTzsqrq(khRztzxx.getTzsqrq());
-//                tz.setIsSh(khRztzxx.getIsSh());
-////                tz.setRzzt(khRztzxx.getRzzt());
+
+        for (YljgKhRztzxx tz: res) {
+            YljgKhRztzxx query = new YljgKhRztzxx();
+            query.setJgId(yljgKhRztzxx.getJgId());
+            query.setKhId(tz.getKhId());
+            Optional<YljgKhRztzxx> insertTz = yljgKhRztzxxMapper.selectYljgKhRztzxxList(query).stream().filter(y
+                    -> StringUtils.isNotEmpty(y.getTzsqrq())).max(Comparator
+                    .comparing(YljgKhRztzxx::getCreateTimeStr));
+            insertTz.ifPresent(khRztzxx -> {
+                tz.setId(khRztzxx.getId());
+                tz.setTzsqrq(khRztzxx.getTzsqrq());
+                tz.setIsSh(khRztzxx.getIsSh());
+                tz.setShxx(khRztzxx.getShxx());
+//                tz.setRzzt(khRztzxx.getRzzt());
 //                tz.setSjrzsj(khRztzxx.getSjrzsj());
-//                tz.setState(khRztzxx.getState());
-//            });
-//        }
+                tz.setState(khRztzxx.getState());
+            });
+        }
         return res;
     }
 
@@ -113,7 +132,25 @@ public class YljgKhRztzxxServiceImpl implements IYljgKhRztzxxService
     @Override
     public List<YljgKhRztzxx> selectYljgKhRztzxxListByHtxxSh(YljgKhRztzxx yljgKhRztzxx)
     {
-        return yljgKhRztzxxMapper.selectYljgKhRztzxxListByHtxxSh(yljgKhRztzxx);
+        List<YljgKhRztzxx> res = yljgKhRztzxxMapper.selectYljgKhRztzxxListByHtxxSh(yljgKhRztzxx);
+        for (YljgKhRztzxx tz: res) {
+            YljgKhRztzxx query = new YljgKhRztzxx();
+            query.setJgId(yljgKhRztzxx.getJgId());
+            query.setKhId(tz.getKhId());
+            Optional<YljgKhRztzxx> insertTz = yljgKhRztzxxMapper.selectYljgKhRztzxxList(query).stream().filter(y
+                    -> StringUtils.isNotEmpty(y.getTzsqrq())).max(Comparator
+                    .comparing(YljgKhRztzxx::getCreateTimeStr));
+            insertTz.ifPresent(khRztzxx -> {
+                tz.setId(khRztzxx.getId());
+                tz.setTzsqrq(khRztzxx.getTzsqrq());
+                tz.setIsSh(khRztzxx.getIsSh());
+                tz.setShxx(khRztzxx.getShxx());
+                tz.setRzzt(khRztzxx.getRzzt());
+//                tz.setSjrzsj(khRztzxx.getSjrzsj());
+                tz.setState(khRztzxx.getState());
+            });
+        }
+        return res;
     }
 
     /**

+ 38 - 3
ruoyi-modules/mz-organization/src/main/resources/mapper/organization/YljgKhHfdjMapper.xml

@@ -53,13 +53,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectYljgKhHfdjListByHtxx" parameterType="YljgKhHfdj" resultMap="YljgKhHfdjResult">
-        select * from v_yljg_kh_htxx_hfdj
+        SELECT
+        `sjrzsj` AS `rzrq`,
+        `id` AS `ht_id`,
+        `jg_id` AS `jg_id`,
+        `kh_id` AS `kh_id`,
+        `lc_id` AS `lc_id`,
+        `xm` AS `xm`,
+        `zjhm` AS `zjhm`,
+        `create_by` AS `blr`,
+        `create_time_str` AS `create_time_str`,
+        (
+        SELECT
+        `yljg_fwcd_fj`.`fjmc`
+        FROM
+        `yljg_fwcd_fj`
+        WHERE
+        (
+        `yljg_fwcd_fj`.`id` = `fj_id`
+        )
+        ) AS `rzfj`,
+        (
+        SELECT
+        `yljg_fwcd_cw`.`cwh`
+        FROM
+        `yljg_fwcd_cw`
+        WHERE
+        (
+        `yljg_fwcd_cw`.`id` = `cw_id`
+        )
+        ) AS `rzcw`,
+        `rzzt` AS `rzzt`
+        FROM
+        (
+        `yljg_kh_htxx` `a`
+        )
         <where>
+            rzzt IN ('1', '2', '4')
             <if test="jgId != null  and jgId != ''"> and jg_id = #{jgId}</if>
             <if test="xm != null  and xm != ''"> and xm like concat('%', #{xm}, '%')</if>
             <if test="zjhm != null  and zjhm != ''"> and zjhm like concat('%', #{zjhm}, '%')</if>
-            <if test="rzrq != null  and rzrq != ''"> and rzrq = #{rzrq}</if>
-            <if test="rzfj != null  and rzfj != ''"> and rzfj = #{rzfj}</if>
+            <if test="rzrq != null  and rzrq != ''"> and sjrzsj = #{rzrq}</if>
+            <if test="rzfj != null  and rzfj != ''"> and fjh = #{rzfj}</if>
         </where>
         ORDER BY create_time_str DESC
     </select>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 44 - 0
ruoyi-modules/mz-organization/src/main/resources/mapper/organization/YljgKhJbxxMapper.xml


+ 115 - 13
ruoyi-modules/mz-organization/src/main/resources/mapper/organization/YljgKhRztzxxMapper.xml

@@ -51,22 +51,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="khId != null  and khId != ''"> and kh_id = #{khId}</if>
             <if test="htksrq != null  and htksrq != ''"> and htksrq = #{htksrq}</if>
             <if test="htjsrq != null  and htjsrq != ''"> and htjsrq = #{htjsrq}</if>
-            <if test="rzfj != null  and rzfj != ''"> and rzfj = #{rzfj}</if>
-            <if test="rzcw != null  and rzcw != ''"> and rzcw = #{rzcw}</if>
+            <if test="rzfj != null  and rzfj != ''"> and fjh = #{rzfj}</if>
+            <if test="rzcw != null  and rzcw != ''"> and cwh = #{rzcw}</if>
             <if test="params.beginYjrzrq != null and params.beginYjrzrq != '' and params.endYjrzrq != null and params.endYjrzrq != ''"> and yjrzrq between #{params.beginYjrzrq} and #{params.endYjrzrq}</if>
         </where>
     </select>
 
     <select id="selectYljgKhRztzxxListByHtxx" parameterType="YljgKhRztzxx" resultMap="YljgKhRztzxxResult">
-        select * from v_yljg_kh_htxx_rztzxx
+        SELECT
+        `id` AS `ht_id`,
+        `jg_id` AS `jg_id`,
+        `kh_id` AS `kh_id`,
+        `xm` AS `xm`,
+        `zjhm` AS `zjhm`,
+        `htksrq` AS `htksrq`,
+        `htjsrq` AS `htjsrq`,
+        `create_time_str` AS `create_time_str`,
+        (
+        SELECT
+        `mz-cloud`.`yljg_fwcd_fj`.`fjmc`
+        FROM
+        `mz-cloud`.`yljg_fwcd_fj`
+        WHERE
+        (
+        `mz-cloud`.`yljg_fwcd_fj`.`id` = `fj_id`
+        )
+        ) AS `rzfj`,
+        (
+        SELECT
+        `mz-cloud`.`yljg_fwcd_cw`.`cwh`
+        FROM
+        `mz-cloud`.`yljg_fwcd_cw`
+        WHERE
+        (
+        `mz-cloud`.`yljg_fwcd_cw`.`id` = `cw_id`
+        )
+        ) AS `rzcw`,
+        `yjrzrq` AS `yjrzrq`,
+        `htqdrq` AS `htqdrq`,
+        `rzzt` AS `rzzt`,
+        `create_by` AS `blr`
+        FROM
+        `mz-cloud`.`yljg_kh_htxx`
         <where>
+            `state` = '0'
             <if test="xm != null  and xm != ''"> and xm like concat('%', #{xm}, '%')</if>
             <if test="jgId != null  and jgId != ''"> and jg_id = #{jgId}</if>
             <if test="zjhm != null  and zjhm != ''"> and zjhm like concat('%', #{zjhm}, '%')</if>
             <if test="htksrq != null  and htksrq != ''"> and htksrq = #{htksrq}</if>
             <if test="htjsrq != null  and htjsrq != ''"> and htjsrq = #{htjsrq}</if>
-            <if test="rzfj != null  and rzfj != ''"> and rzfj = #{rzfj}</if>
-            <if test="rzcw != null  and rzcw != ''"> and rzcw = #{rzcw}</if>
+            <if test="rzfj != null  and rzfj != ''"> and fjh = #{rzfj}</if>
+            <if test="rzcw != null  and rzcw != ''"> and cwh = #{rzcw}</if>
             <if test="rzzt == '0'"> and id IS NULL</if>
             <if test="rzzt == '1'"> and id IS NOT NULL</if>
             <if test="params.beginYjrzrq != null and params.beginYjrzrq != '' and params.endYjrzrq != null and params.endYjrzrq != ''"> and yjrzrq between #{params.beginYjrzrq} and #{params.endYjrzrq}</if>
@@ -76,39 +111,106 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectYljgKhRztzxxListByHtxxTz" parameterType="YljgKhRztzxx" resultMap="YljgKhRztzxxResult">
-        select * from v_yljg_kh_htxx_tzxx
+        SELECT
+        `sjrzsj` AS `sjrzsj`,
+        `id` AS `ht_id`,
+        `jg_id` AS `jg_id`,
+        `kh_id` AS `kh_id`,
+        `xm` AS `xm`,
+        `zjhm` AS `zjhm`,
+        `htksrq` AS `htksrq`,
+        `htjsrq` AS `htjsrq`,
+        `create_time_str` AS `create_time_str`,
+        (
+        SELECT
+        `mz-cloud`.`yljg_fwcd_fj`.`fjmc`
+        FROM
+        `mz-cloud`.`yljg_fwcd_fj`
+        WHERE
+        (
+        `mz-cloud`.`yljg_fwcd_fj`.`id` = `fj_id`
+        )
+        ) AS `rzfj`,
+        (
+        SELECT
+        `mz-cloud`.`yljg_fwcd_cw`.`cwh`
+        FROM
+        `mz-cloud`.`yljg_fwcd_cw`
+        WHERE
+        (
+        `mz-cloud`.`yljg_fwcd_cw`.`id` = `cw_id`
+        )
+        ) AS `rzcw`,
+        `yjrzrq` AS `yjrzrq`,
+        `htqdrq` AS `htqdrq`,
+        `rzzt` AS `rzzt`,
+        `create_by` AS `blr`
+        FROM
+        `mz-cloud`.`yljg_kh_htxx`
         <where>
+            sjrzsj is not null and sjrzsj != ''
             <if test="xm != null  and xm != ''"> and xm like concat('%', #{xm}, '%')</if>
             <if test="jgId != null  and jgId != ''"> and jg_id = #{jgId}</if>
             <if test="zjhm != null  and zjhm != ''"> and zjhm like concat('%', #{zjhm}, '%')</if>
             <if test="htksrq != null  and htksrq != ''"> and htksrq = #{htksrq}</if>
             <if test="htjsrq != null  and htjsrq != ''"> and htjsrq = #{htjsrq}</if>
-            <if test="rzfj != null  and rzfj != ''"> and rzfj = #{rzfj}</if>
-            <if test="rzcw != null  and rzcw != ''"> and rzcw = #{rzcw}</if>
+            <if test="rzfj != null  and rzfj != ''"> and fjh = #{rzfj}</if>
+            <if test="rzcw != null  and rzcw != ''"> and cwh = #{rzcw}</if>
             <if test="rzzt != null  and rzzt != ''"> and rzzt = #{rzzt}</if>
             <if test="params.beginYjrzrq != null and params.beginYjrzrq != '' and params.endYjrzrq != null and params.endYjrzrq != ''"> and yjrzrq between #{params.beginYjrzrq} and #{params.endYjrzrq}</if>
             <if test="params.beginSjrzrq != null and params.beginSjrzrq != '' and params.endSjrzrq != null and params.endSjrzrq != ''"> and sjrzsj between #{params.beginSjrzrq} and #{params.endSjrzrq}</if>
             <if test="params.beginTzsqrq != null and params.beginTzsqrq != '' and params.endTzsqrq != null and params.endTzsqrq != ''"> and tzsqrq between #{params.beginTzsqrq} and #{params.endTzsqrq}</if>
         </where>
-        ORDER BY create_time_str DESC
     </select>
 
     <select id="selectYljgKhRztzxxListByHtxxSh" parameterType="YljgKhRztzxx" resultMap="YljgKhRztzxxResult">
-        select * from v_yljg_kh_htxx_tzsh
+        select `sjrzsj` AS `sjrzsj`,
+        `id` AS `ht_id`,
+        `jg_id` AS `jg_id`,
+        `kh_id` AS `kh_id`,
+        `xm` AS `xm`,
+        `zjhm` AS `zjhm`,
+        `htksrq` AS `htksrq`,
+        `htjsrq` AS `htjsrq`,
+        `create_time_str` AS `create_time_str`,
+        (
+        SELECT
+        `yljg_fwcd_fj`.`fjmc`
+        FROM
+        `yljg_fwcd_fj`
+        WHERE
+        (
+        `yljg_fwcd_fj`.`id` = `fj_id`
+        )
+        ) AS `rzfj`,
+        (
+        SELECT
+        `yljg_fwcd_cw`.`cwh`
+        FROM
+        `yljg_fwcd_cw`
+        WHERE
+        (
+        `yljg_fwcd_cw`.`id` = `cw_id`
+        )
+        ) AS `rzcw`,
+        `yjrzrq` AS `yjrzrq`,
+        `htqdrq` AS `htqdrq`,
+        `create_by` AS `blr`
+        from yljg_kh_htxx
         <where>
+            rzzt IN ('2', '3', '4')
             <if test="xm != null  and xm != ''"> and xm like concat('%', #{xm}, '%')</if>
             <if test="jgId != null  and jgId != ''"> and jg_id = #{jgId}</if>
             <if test="zjhm != null  and zjhm != ''"> and zjhm like concat('%', #{zjhm}, '%')</if>
             <if test="htksrq != null  and htksrq != ''"> and htksrq = #{htksrq}</if>
             <if test="htjsrq != null  and htjsrq != ''"> and htjsrq = #{htjsrq}</if>
-            <if test="rzfj != null  and rzfj != ''"> and rzfj = #{rzfj}</if>
-            <if test="rzcw != null  and rzcw != ''"> and rzcw = #{rzcw}</if>
+            <if test="rzfj != null  and rzfj != ''"> and fjh = #{rzfj}</if>
+            <if test="rzcw != null  and rzcw != ''"> and cwh = #{rzcw}</if>
             <if test="rzzt != null  and rzzt != ''"> and rzzt = #{rzzt}</if>
             <if test="params.beginYjrzrq != null and params.beginYjrzrq != '' and params.endYjrzrq != null and params.endYjrzrq != ''"> and yjrzrq between #{params.beginYjrzrq} and #{params.endYjrzrq}</if>
             <if test="params.beginSjrzrq != null and params.beginSjrzrq != '' and params.endSjrzrq != null and params.endSjrzrq != ''"> and sjrzsj between #{params.beginSjrzrq} and #{params.endSjrzrq}</if>
             <if test="params.beginTzsqrq != null and params.beginTzsqrq != '' and params.endTzsqrq != null and params.endTzsqrq != ''"> and tzsqrq between #{params.beginTzsqrq} and #{params.endTzsqrq}</if>
         </where>
-        ORDER BY create_time_str DESC
     </select>
 
     <select id="selectYljgKhRztzxxById" parameterType="String" resultMap="YljgKhRztzxxResult">