浏览代码

上传信息,增加去重,增加科室,结算单列表查询条件增加姓名查询

lihong 2 年之前
父节点
当前提交
b221d127fe

+ 23 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/AutoUploadBillDao.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.dao.his.medicalinsurance;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
@@ -40,4 +41,26 @@ public interface AutoUploadBillDao extends BaseMapper<AutoUploadBill> {
             " where  pat_no =#{patNo} and times =#{times} and ledger_sn =#{ledgerSn}"
             )
     Date getLastUpdateTime(@Param("patNo") String patNo, @Param("times")Integer times, @Param("ledgerSn")Integer ledgerSn);
+    @Select("select top ${pageSize} *  from ("+
+            " select     row_number() over (order by t1.created_date) as rowNumber,  " +
+            "  t1.*," +
+            "    out_dept_name=(select rtrim(name) from zd_unit_code where code = isnull(t2.zk_ward, t2.small_dept))," +
+            "                  rtrim(isnull(t2.zk_ward, t2.small_dept)) as out_dept " +
+            " from t_auto_upload_bill t1" +
+            "   ${condition} "+
+            "         left join zy_inactpatient t2 on t1.pat_no = t2.inpatient_no and t1.times = t2.admiss_times" +
+            " where  ${ew.sqlSegment}"+
+            " )temp where rowNumber > ${pageSize} * (${currentPage} - 1)  order by created_date desc"
+            )
+   List<AutoUploadBill> listPage(@Param("ew")QueryWrapper<AutoUploadBill> query,
+                                 @Param("currentPage") long currentPage,
+                                 @Param("pageSize") long pageSize,
+                                @Param("condition") String condition
+    );
+
+    @Select("select count(1)  from t_auto_upload_bill t1  " +
+            " ${condition} "+
+            "                 left join zy_inactpatient t2 on t1.pat_no = t2.inpatient_no and t1.times = t2.admiss_times " +
+            "   where  ${ew.sqlSegment}")
+    Integer pageTotal(@Param("ew")QueryWrapper<AutoUploadBill> query, @Param("condition") String condition);
 }

+ 13 - 1
src/main/java/thyyxxk/webserver/entity/querydata/AutoUploadBill.java

@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @Description:
@@ -64,12 +65,23 @@ public class AutoUploadBill implements Serializable {
     private String updateStartTime;
     @TableField(exist = false)
     private String updateEndTime;
+    /**查询条件 是否去重 0 否 1 是*/
+    @TableField(exist = false)
+    private String distinctFlag;
+    /**查询条件 住院类型 0 住院 1 门诊*/
+    @TableField(exist = false)
+    private String zhuYuanFlag;
 
     @TableField(exist = false)
     private String flagName;
     @TableField(exist = false)
     private String typeFlagName;
-
+    @TableField(exist = false)
+    private String outDept;
+    @TableField(exist = false)
+    private String outDeptName;
+    @TableField(exist = false)
+    private List<String> outDeptList;
     @TableField(exist = false)
     private long currentPage;
     /**

+ 4 - 0
src/main/java/thyyxxk/webserver/entity/querydata/JieSuanDanChaXun.java

@@ -24,6 +24,10 @@ public class JieSuanDanChaXun {
      * 住院号
      */
     private String patNo;
+    /**
+     * 姓名
+     */
+    private String name;
     private Integer times;
     /**
      * 险种类型

+ 20 - 11
src/main/java/thyyxxk/webserver/service/medicalinsurance/AutoUploadBillService.java

@@ -52,7 +52,14 @@ public class AutoUploadBillService extends ServiceImpl<AutoUploadBillDao,AutoUpl
     public IPage<AutoUploadBill> queryPage(AutoUploadBill autoUploadBill){
         IPage<AutoUploadBill> page = new Page(autoUploadBill.getCurrentPage(),autoUploadBill.getPageSize());
         QueryWrapper<AutoUploadBill> query = getAutoUploadBillQueryWrapper(autoUploadBill);
-        baseMapper.selectPage(page,query);
+        String condition = "";
+        if("1".equals(autoUploadBill.getDistinctFlag())){
+            condition =" join  (select pat_no,times,ledger_sn ,max(created_date) created_date from t_auto_upload_bill group by pat_no,times,ledger_sn)t3 on t1.pat_no=t3.pat_no and t1.times=t3.times and t1.ledger_sn=t3.ledger_sn and t1.created_date=t3.created_date ";
+        }
+        List<AutoUploadBill> records = baseMapper.listPage(query, autoUploadBill.getCurrentPage(), autoUploadBill.getPageSize(),condition);
+        page.setRecords(records);
+        Integer total = baseMapper.pageTotal(query,condition);
+        page.setTotal(total);
         if(ListUtil.notBlank(page.getRecords()) ){
             for(AutoUploadBill item:page.getRecords()){
                 item.setFlagName("上传成功".equals(item.getLogText())?AutoUploadBill.FLAG.UPLOAD_SUCCESS.getName():AutoUploadBill.FLAG.UPLOAD_FAIL.getName());
@@ -64,17 +71,19 @@ public class AutoUploadBillService extends ServiceImpl<AutoUploadBillDao,AutoUpl
 
     public QueryWrapper<AutoUploadBill> getAutoUploadBillQueryWrapper(AutoUploadBill autoUploadBill) {
         QueryWrapper<AutoUploadBill> query = new QueryWrapper<>();
-        query.eq(StringUtils.isNotBlank(autoUploadBill.getPatNo()), "pat_no", autoUploadBill.getPatNo());
+        query.eq(StringUtils.isNotBlank(autoUploadBill.getPatNo()), "t1.pat_no", autoUploadBill.getPatNo());
         //0 查询全部
-        query.eq(autoUploadBill.getTypeFlag() !=0, "type_flag", autoUploadBill.getTypeFlag());
-        query.eq(autoUploadBill.getTimes() !=null, "times", autoUploadBill.getTimes());
-        query.eq(autoUploadBill.getLedgerSn() !=null, "ledger_sn", autoUploadBill.getLedgerSn());
-        query.eq(autoUploadBill.getFlag() != 0, "flag", autoUploadBill.getFlag());
-        query.ge(StringUtils.isNotBlank(autoUploadBill.getUpdateStartTime()), "created_date", autoUploadBill.getUpdateStartTime());
-        query.le(StringUtils.isNotBlank(autoUploadBill.getUpdateEndTime()), "created_date", autoUploadBill.getUpdateEndTime());
-        query.ge(StringUtils.isNotBlank(autoUploadBill.getSetlStartTime()), "setl_time", autoUploadBill.getSetlStartTime());
-        query.le(StringUtils.isNotBlank(autoUploadBill.getSetlEndTime()), "setl_time", autoUploadBill.getSetlEndTime());
-        query.orderByDesc("created_date");
+        query.eq(autoUploadBill.getTypeFlag() !=0, "t1.type_flag", autoUploadBill.getTypeFlag());
+        query.eq(autoUploadBill.getTimes() !=null, "t1.times", autoUploadBill.getTimes());
+        query.eq(autoUploadBill.getLedgerSn() !=null, "t1.ledger_sn", autoUploadBill.getLedgerSn());
+        query.eq(autoUploadBill.getFlag() != 0, "t1.flag", autoUploadBill.getFlag());
+        query.ne("0".equals(autoUploadBill.getZhuYuanFlag()),"t1.ledger_sn","0");
+        query.eq("1".equals(autoUploadBill.getZhuYuanFlag()),"t1.ledger_sn","0");
+        query.ge(StringUtils.isNotBlank(autoUploadBill.getUpdateStartTime()), "t1.created_date", autoUploadBill.getUpdateStartTime());
+        query.le(StringUtils.isNotBlank(autoUploadBill.getUpdateEndTime()), "t1.created_date", autoUploadBill.getUpdateEndTime());
+        query.ge(StringUtils.isNotBlank(autoUploadBill.getSetlStartTime()), "t1.setl_time", autoUploadBill.getSetlStartTime());
+        query.le(StringUtils.isNotBlank(autoUploadBill.getSetlEndTime()), "t1.setl_time", autoUploadBill.getSetlEndTime());
+        query.in(CollUtil.isNotEmpty(autoUploadBill.getOutDeptList()), "isnull(t2.zk_ward, t2.small_dept)", autoUploadBill.getOutDeptList());
         return query;
     }
 

+ 15 - 17
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -33,6 +33,7 @@ import thyyxxk.webserver.dao.his.inpatient.DismissDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiLogDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.UpIdCollectionDao;
+import thyyxxk.webserver.entity.HeadInfo;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetMain;
 import thyyxxk.webserver.entity.casefrontsheet.SheetOverview;
@@ -969,7 +970,7 @@ public class SetlListUpldService {
      **/
     private boolean isDrghiPaymtd(List<Integer> hiPaymtds){
         if(ListUtil.notBlank(hiPaymtds)){
-           return hiPaymtds.stream().anyMatch(obj -> "4".equals(obj));
+           return hiPaymtds.stream().anyMatch(obj -> obj==4);
         }
         return false;
     }
@@ -1202,6 +1203,9 @@ public class SetlListUpldService {
         if (param.getTimes() != null) {
             qw.eq("a.times", param.getTimes());
         }
+        if (StringUtil.notBlank(param.getName())) {
+            qw.likeRight("a.psn_name", param.getName());
+        }
         if (ListUtil.notBlank(param.getInsutype())) {
             qw.in("insutype", param.getInsutype());
         }
@@ -1914,25 +1918,19 @@ public class SetlListUpldService {
     }
 
     public void exportAutoUploadInfo(HttpServletResponse response,AutoUploadBill  query) {
-        List<AutoUploadBill> list = autoUploadBillService.list(autoUploadBillService.getAutoUploadBillQueryWrapper(query));
+        query.setCurrentPage(1);
+        query.setPageSize(100000);
+        IPage<AutoUploadBill> autoUploadBillIPage = autoUploadBillService.queryPage(query);
+        List<AutoUploadBill>  list = autoUploadBillIPage.getRecords();
         if (ListUtil.isBlank(list)) {
             throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "没有查到数据");
         }
-        String[] title = {"住院号", "住院次数", "上传类型","上传人","上传结果标识","上传时间", "日志", "患者结算时间"};
-        String[][] content = new String[list.size()][];
-        for (int i = 0, len = list.size(); i < len; i++) {
-            content[i] = new String[title.length];
-            AutoUploadBill pojo = list.get(i);
-            content[i][0] = pojo.getPatNo();
-            content[i][1] = pojo.getTimes().toString();
-            content[i][2] = pojo.getTypeFlag()==AutoUploadBill.TypeFlag.AUTO_UPLOAD.getCode() ? AutoUploadBill.TypeFlag.AUTO_UPLOAD.getName():AutoUploadBill.TypeFlag.SD_UPLOAD.getName();
-            content[i][3] = StringUtil.isBlank(pojo.getUploadName())?"":pojo.getUploadName();
-            content[i][4] = pojo.getFlag()==AutoUploadBill.FLAG.UPLOAD_SUCCESS.getCode() ? AutoUploadBill.FLAG.UPLOAD_SUCCESS.getName():AutoUploadBill.FLAG.UPLOAD_FAIL.getName();
-            content[i][5] = DateUtil.formatDatetime(pojo.getCreatedDate());
-            content[i][6] = pojo.getLogText();
-            content[i][7] = DateUtil.formatDatetime(pojo.getSetlTime(), DateUtil.DEFAULT_PATTERN);
-        }
-        ExcelUtil.exportExcel(response, title, content);
+        List<Map<String, Object>> result = ExcelUtil.beanToMap(list,AutoUploadBill.class);
+        String[] display = {"住院号", "住院次数","账页号","出院科室", "上传类型","上传人","上传结果标识","上传时间", "患者结算时间", "日志"};
+        String[] names = {"patNo","times","ledgerSn","outDeptName","typeFlagName","uploadName","flagName","createdDate","setlTime","logText"};
+        List<HeadInfo> headList = ExcelUtil.createHeadInfos(display, names);
+        ExcelUtil.exportExcelReport(response,result,headList,"上传日志");
+
     }
 
     /**