소스 검색

项目录入添加导出的功能。

xiaochan 3 년 전
부모
커밋
19de4439b0

+ 10 - 0
src/main/java/thyyxxk/webserver/controller/yibao/XiangMuLuRuController.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.controller.yibao;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
@@ -10,6 +11,7 @@ import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
 import thyyxxk.webserver.entity.yibao.ZyActpatient;
 import thyyxxk.webserver.service.yibao.XiangMuLuRuService;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -138,4 +140,12 @@ public class XiangMuLuRuController {
     public ResultVo<String> caiFenPiPei(@RequestBody ZyDetailCharge zyDetailCharge) {
         return service.caiFenPiPei(zyDetailCharge);
     }
+
+    @PostMapping("/exportExcel")
+    public void exportExcel(HttpServletResponse response,
+                            @RequestBody @Validated ZyDetailCharge param) {
+        service.exportExcel(response, param);
+    }
 }
+
+// 000107

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

@@ -77,7 +77,7 @@ public interface PublicDao {
      * @param code 人员代码
      * @return 返回人员
      */
-    @Select("select rtrim(code) code,rtrim(name) name from a_employee_mi where (name like #{code} or code_rs like #{code} or py_code like #{code}) and isnull(del_flag,0) = 0")
+    @Select("select distinct rtrim(code) code,rtrim(name) name from a_employee_mi where (name like #{code} or code_rs like #{code} or py_code like #{code}) and isnull(del_flag,0) = 0")
     List<GetDropdownBox> getRenYuan(String code);
 
     /**

+ 2 - 91
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyiji/YiJiFeiYongLuRuDao.java

@@ -3,11 +3,8 @@ package thyyxxk.webserver.dao.his.zhuyuanyiji;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
-import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
 import thyyxxk.webserver.entity.yibao.ZyActpatient;
 
-import java.util.List;
-
 /**
  * <p>
  * 描述:住院以及费用录入
@@ -55,94 +52,8 @@ public interface YiJiFeiYongLuRuDao {
                                  @Param("tableName") String tableName,
                                  @Param("admissTimes") Integer admissTimes);
 
-
-    @Select("<script>" +
-            "SELECT a.admiss_times, " +
-            "       a.inpatient_no, " +
-            "       a.ledger_sn, " +
-            "       a.detail_sn, " +
-            "       a.charge_date, " +
-            "       a.op_id_code, " +
-            "       a.charge_code, " +
-            "       a.charge_fee, " +
-            "       a.charge_status  , " +
-            "       bill_item_code=b.bill_item_zy, " +
-            "       charge_name=b.name, " +
-            "       spec=c.specification, " +
-            "       a.charge_code_mx, " +
-            "       a.serial, " +
-            "       price=0.0000, " +
-            "       amount=a.charge_amount, " +
-            "       a.exec_unit, " +
-            "       a.ward_code, " +
-            "       self_flag=isnull(a.self_flag,0), " +
-            "       suppress_flag=a.suppress_flag, " +
-            "       group_no='00', " +
-            "       separate_flag=a.separate_flag, " +
-            "       ope_flag=a.ope_flag, " +
-            "       drugname=c.name, " +
-            "       ybcomment=c.yb_comment, " +
-            "       a.yb_self_flag, " +
-            "       doctor_code " +
-            "FROM zy_detail_charge a  ,zd_charge_item b,yp_zd_dict c " +
-            "where    a.inpatient_no=#{inpatientNo} and " +
-            "        a.admiss_times=#{admissTimes} and " +
-            "        a.charge_code=b.code and " +
-            "<if test=\"chargeCode != null and chargeCode != '' \">" +
-            "        a.charge_code = #{chargeCode} and " +
-            "</if>" +
-            "        a.order_no =  0    and " +
-            "        c.code= a.charge_code_mx and " +
-            "        a.serial=c.serial and a.charge_code like 'BILL%' " +
-            "<if test=\"dept != 3100000\"> " +
-            " and  a.exec_unit=#{dept} " +
-            "</if>" +
-            "union " +
-            "SELECT a.admiss_times, " +
-            "       a.inpatient_no, " +
-            "       a.ledger_sn, " +
-            "       a.detail_sn, " +
-            "       a.charge_date, " +
-            "       a.op_id_code, " +
-            "       a.charge_code, " +
-            "       a.charge_fee, " +
-            "       a.charge_status  , " +
-            "       bill_item_code=b.bill_item_zy, " +
-            "       charge_name=b.name, " +
-            "       spec=b.charge_unit, " +
-            "       a.charge_code_mx, " +
-            "       a.serial, " +
-            "       price=0.0000, " +
-            "       amount=a.charge_amount, " +
-            "       a.exec_unit, " +
-            "       a.ward_code, " +
-            "       self_flag=a.self_flag, " +
-            "       suppress_flag=a.suppress_flag, " +
-            "       group_no='00', " +
-            "       separate_flag=a.separate_flag, " +
-            "       ope_flag=a.ope_flag, " +
-            "       drugname=b.name, " +
-            "       ybcomment='', " +
-            "       ybzf=a.yb_self_flag, " +
-            "       doctor_code " +
-            "FROM zy_detail_charge a  ,zd_charge_item b " +
-            "where    a.inpatient_no=#{inpatientNo} and " +
-            "        a.admiss_times=#{admissTimes} and " +
-            "        a.charge_code=b.code and " +
-            "        a.order_no =  0    and " +
-            "<if test=\"chargeCode != null and chargeCode != '' \">" +
-            "        a.charge_code = #{chargeCode} and " +
-            "</if>" +
-            "        a.charge_code not like 'BILL%' " +
-            "<if test=\"dept != 3100000\"> " +
-            " and  a.exec_unit=#{dept} " +
-            "</if>" +
-            "</script>")
-    List<ZyDetailCharge> getHuanZheFeiYong(@Param("inpatientNo") String inpatientNo,
-                                           @Param("admissTimes") Integer admissTimes,
-                                           @Param("dept") String dept,
-                                           @Param("chargeCode") String chargeCode);
-
+    @Select("select max(admiss_times) from zy_inactpatient where inpatient_no = #{inpatientNo} ")
+    Integer maxAdmissTimes(@Param("inpatientNo") String inpatientNo);
 
     @Select("select settle_type from zy_ledger_file where " +
             "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +

+ 31 - 0
src/main/java/thyyxxk/webserver/service/yibao/XiangMuLuRuService.java

@@ -1,6 +1,7 @@
 package thyyxxk.webserver.service.yibao;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.ListUtils;
@@ -17,6 +18,7 @@ import thyyxxk.webserver.entity.yibao.ZyActpatient;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.utils.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -724,5 +726,34 @@ public class XiangMuLuRuService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "每次只能匹配一条。");
         }
     }
+
+
+    public void exportExcel(HttpServletResponse response, ZyDetailCharge param) {
+        log.info("导出患者费用数据:{}", JSONObject.toJSONStringWithDateFormat(param, DateUtil.DEFAULT_PATTERN));
+        param.setPageSize(param.getTotal());
+        param.setCurrentPage(1);
+        List<ZyDetailCharge> list = getHuanZheFeiYong(param).getData().getRecords();
+        String[] title = {"流水号", "医嘱号", "录入日期", "项目编码", "项目名称", "药品名称", "执行时间", "执行科室", "申请科室", "金额", "数量", "状态", "录入人", "账单码"};
+        String[][] content = new String[list.size()][];
+        for (int i = 0; i < list.size(); i++) {
+            content[i] = new String[title.length];
+            ZyDetailCharge pojo = list.get(i);
+            content[i][0] = String.valueOf(pojo.getDetailSn());
+            content[i][1] = String.valueOf(pojo.getOrderNo());
+            content[i][2] = DateUtil.formatDatetime(pojo.getChargeDate());
+            content[i][3] = pojo.getChargeCodeMx();
+            content[i][4] = pojo.getChargeName();
+            content[i][5] = pojo.getDrugname();
+            content[i][6] = DateUtil.formatDatetime(pojo.getGenTime());
+            content[i][7] = pojo.getExecDept();
+            content[i][8] = pojo.getDeptCode();
+            content[i][9] = pojo.getChargeFee().toString();
+            content[i][10] = pojo.getChargeAmount().toString();
+            content[i][11] = pojo.getChargeStatus().equals("1") ? "录入" : pojo.getChargeStatus().equals("2") ? "上账" : "结算";
+            content[i][12] = pojo.getOpName();
+            content[i][13] = pojo.getBillItemName();
+        }
+        ExcelUtil.exportExcel(response, title, content);
+    }
 }
 

+ 1 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyiji/YiJiFeiYongLuRuServer.java

@@ -47,7 +47,7 @@ public class YiJiFeiYongLuRuServer {
             tableName = "zy_actpatient";
         } else {
             if (admissTimes == 0) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "出院病人的住院次数不能为0");
+                admissTimes = dao.maxAdmissTimes(inpatientNo);
             }
             tableName = "zy_inactpatient";
         }