Browse Source

接受会诊中大科室可以看到小科室的人小科室看不到大科室的人

xiaochan 3 years ago
parent
commit
5991562b6c

+ 2 - 2
src/main/java/thyyxxk/webserver/dao/his/PublicDao.java

@@ -92,8 +92,8 @@ public interface PublicDao {
      * @param deptCode 科室编码
      * @return 返回自生和子科室
      */
-    @Select("select code from zd_unit_code where (parent_code = #{deptCode} or code = #{deptCode}) and isnull(del_flag,0) = 0")
-    List<String> getKeShiLieBiao(String deptCode);
+    @Select("select code, parent_code from zd_unit_code where (parent_code = #{deptCode} or code = #{deptCode}) and isnull(del_flag,0) = 0")
+    List<GetDropdownBox> getKeShiLieBiao(String deptCode);
 
     @Select("<script>" +
             "select code from zd_unit_code where (parent_code in " +

+ 7 - 11
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/JieShouHuiZhenDao.java

@@ -1,5 +1,7 @@
 package thyyxxk.webserver.dao.his.casefrontsheet;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -18,18 +20,12 @@ import thyyxxk.webserver.entity.casefrontsheet.JieShouHuiZhenPojo;
 @Mapper
 public interface JieShouHuiZhenDao {
 
-    @Select("<script>" +
-            "select bed_no,name,a.admiss_times,a.inpatient_no,req_times from ysh_hz_record a with(nolock) inner join zy_actpatient b with(nolock) on " +
-            "    (b.inpatient_no = a.inpatient_no) where status_flag = 1 " +
-            "<if test=\"deptCode!=3100000\">" +
-            "and (req_dept1 = #{deptCode} or req_dept2 = #{deptCode})" +
-            "</if>" +
-            "and req_date &gt;= #{startTime} and req_date &lt;= #{endTime}" +
-            "</script>")
+    @Select("select bed_no,name,a.admiss_times,a.inpatient_no,req_times from ysh_hz_record a with(nolock) " +
+            " inner join zy_actpatient b with(nolock) on " +
+            "    (b.inpatient_no = a.inpatient_no)" +
+            " ${ew.customSqlSegment} ")
     Page<JieShouHuiZhenPojo> getHuiZhenData(Page<JieShouHuiZhenPojo> page,
-                                            @Param("deptCode") String deptCode,
-                                            @Param("startTime") String startTime,
-                                            @Param("endTime") String endTime);
+                                            @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
 
     @Select("select a.inpatient_no, " +
             "       b.admiss_date, " +

+ 0 - 33
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/caoyaoyizhu/caoYaoChaXunTiaoJian.java

@@ -1,33 +0,0 @@
-package thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * <p>
- * 描述: 草药医嘱查询条件
- * </p>
- *
- * @author xc
- * @date 2022-02-26 11:09
- */
-@Data
-public class caoYaoChaXunTiaoJian {
-
-    @NotNull(message = "住院号不能为空")
-    @NotBlank(message = "住院号不能为空")
-    private String patNo;
-    @NotNull(message = "住院次数不能为空")
-    private Integer times;
-
-    private String startTime;
-    private String endTime;
-
-    @NotNull(message = "当前页不能为空")
-    private long currentPage;
-
-    @NotNull(message = "也打消")
-    private long pageSize;
-}

+ 19 - 6
src/main/java/thyyxxk/webserver/service/casefrontsheet/JieShouHuiZhenService.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.service.casefrontsheet;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -8,10 +9,10 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.casefrontsheet.JieShouHuiZhenDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.casefrontsheet.JieShouHuiZhenPojo;
-import thyyxxk.webserver.utils.DateUtil;
-import thyyxxk.webserver.utils.ResultVoUtil;
-import thyyxxk.webserver.utils.StringUtil;
-import thyyxxk.webserver.utils.TokenUtil;
+import thyyxxk.webserver.service.PublicServer;
+import thyyxxk.webserver.utils.*;
+
+import java.util.List;
 
 /**
  * <p>
@@ -26,10 +27,12 @@ import thyyxxk.webserver.utils.TokenUtil;
 public class JieShouHuiZhenService {
 
     private final JieShouHuiZhenDao dao;
+    private final PublicServer publicServer;
 
     @Autowired
-    public JieShouHuiZhenService(JieShouHuiZhenDao dao) {
+    public JieShouHuiZhenService(JieShouHuiZhenDao dao, PublicServer publicServer) {
         this.dao = dao;
+        this.publicServer = publicServer;
     }
 
     /**
@@ -41,9 +44,19 @@ public class JieShouHuiZhenService {
      * @return 返回没有会诊的信息
      */
     public ResultVo<Page<JieShouHuiZhenPojo>> getHuiZhenData(String deptCode, long currentPage, long pageSize, String startTime, String endTime) {
+        List<String> deptList = publicServer.getKeShiLieBiaoList(deptCode);
+
+        log.info("科室列表:{}", deptList);
+        QueryWrapper<?> qw = new QueryWrapper<>();
+        qw.eq("status_flag", "1")
+                .ge("req_date", startTime)
+                .le("req_date", endTime);
+        if (ListUtil.notBlank(deptList)) {
+            qw.and(QueryWrapper -> QueryWrapper.in("req_dept1", deptList).or().in("req_dept2", deptList));
+        }
         Page<JieShouHuiZhenPojo> page = new Page<>(currentPage, pageSize);
         log.info("会诊申请查看 开始时间:{},结束时间:{}", startTime, endTime);
-        dao.getHuiZhenData(page, deptCode, startTime, endTime);
+        dao.getHuiZhenData(page, qw);
         return ResultVoUtil.success(page);
     }