Browse Source

新增耗材使用统计,收费项目,查询药品,放在一起,并增加查看详情

xiaochan 4 years ago
parent
commit
6c563ee240

BIN
712328583168722944.txt.zip


BIN
712328658355816448.txt.zip


BIN
712328863056726016.txt.zip


BIN
712329503940085760.txt.zip


BIN
712329778442602496.txt.zip


BIN
712329817493669888.txt.zip


BIN
712329918626727936.txt.zip


+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>9.8.4</version>
+    <version>9.8.5</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

+ 7 - 0
src/main/java/thyyxxk/webserver/controller/querydata/ConsumablesStatisticsController.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.controller.querydata;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -7,6 +8,7 @@ import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.ConsumablesStatistics;
+import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
 import thyyxxk.webserver.service.querydata.ConsumablesStatisticsService;
 
 import javax.servlet.http.HttpServletResponse;
@@ -46,4 +48,9 @@ public class ConsumablesStatisticsController {
     public ResultVo<List<GetDropdownBox>> getDropdownBox() {
         return service.getDropdownBox();
     }
+
+    @PostMapping("/chaKanXiangMuHuoYaoPin")
+    public ResultVo<IPage<QueryDrugsAndProjects>> chaKanXiangMuHuoYaoPin(@RequestBody QueryDrugsAndProjects param) {
+        return service.chaKanXiangMuHuoYaoPin(param);
+    }
 }

+ 25 - 0
src/main/java/thyyxxk/webserver/controller/querydata/QueryDrugsAndProjectsController.java

@@ -1,12 +1,15 @@
 package thyyxxk.webserver.controller.querydata;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
 import thyyxxk.webserver.service.querydata.QueryDrugsAndProjectsService;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
 
@@ -43,4 +46,26 @@ public class QueryDrugsAndProjectsController {
     public ResultVo<List<QueryDrugsAndProjects>> queryDrugs(@RequestBody QueryDrugsAndProjects param) {
         return service.queryDrugs(param);
     }
+
+    @PostMapping("/chaKanXiangQing")
+    public ResultVo<List<QueryDrugsAndProjects>> chaKanXiangQing(@RequestBody QueryDrugsAndProjects param) {
+        return service.chaKanXiangQing(param);
+    }
+
+    @RequestMapping("/xiangMuExcel")
+    public void xiangMuExcel(HttpServletResponse response, @RequestBody @Validated QueryDrugsAndProjects param) {
+        service.xiangMuExcel(response, param);
+    }
+
+    @PostMapping("/chaKanYaoPing")
+    public ResultVo<IPage<QueryDrugsAndProjects>> chaKanYaoPing(@RequestBody QueryDrugsAndProjects param) {
+        return service.chaKanYaoPing(param);
+    }
+
+    @PostMapping("/yaoPinHuoXiangMuCode")
+    public ResultVo<List<GetDropdownBox>> yaoPinHuoXiangMuCode(@RequestParam("pyCode") String pyCode,
+                                                               @RequestParam("flag") Integer flag) {
+        return service.yaoPinHuoXiangMuCode(pyCode, flag);
+    }
+
 }

+ 4 - 0
src/main/java/thyyxxk/webserver/dao/his/querydata/ConsumablesStatisticsDao.java

@@ -1,6 +1,7 @@
 package thyyxxk.webserver.dao.his.querydata;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.ConsumablesStatistics;
@@ -71,5 +72,8 @@ public interface ConsumablesStatisticsDao {
     @Select("select code,name from zd_charge_class")
     List<GetDropdownBox> chargeClassName();
 
+    @Select("select code from ${tableName} where code = #{code}")
+    String getXiangMuHuoYaoPin(@Param("tableName") String tableName,
+                               @Param("code") String code);
 
 }

+ 52 - 13
src/main/java/thyyxxk/webserver/dao/his/querydata/QueryDrugsAndProjectsDao.java

@@ -1,6 +1,8 @@
 package thyyxxk.webserver.dao.his.querydata;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
@@ -41,12 +43,10 @@ public interface QueryDrugsAndProjectsDao {
      * @return 返回
      */
     @Select("<script>" +
-            "select a.charge_code_mx chargeCode,b.name name,sum(a.charge_amount) number,sum(charge_fee) amountOfMoney,classCode=c.name,source='住院' " +
-            "from zy_detail_charge a " +
-            "left join zd_charge_item b on a.charge_code_mx=b.code " +
-            "left join zd_charge_class c on b.class_code=c.code " +
-            "where " +
-            "1=1 " +
+            "select a.charge_code_mx chargeCode,b.name name,sum(a.charge_amount) number,sum(charge_fee) amount_of_money, " +
+            "       classCode=c.name,source='住院' " +
+            "from zy_detail_charge a , zd_charge_item b ,  zd_charge_class c " +
+            "where  a.charge_code_mx=b.code and b.class_code=c.code " +
             "<if test=\"startTime!=null and startTime!=''\">" +
             "and charge_date&gt;=#{startTime} and charge_date&lt;#{endTime} " +
             "</if>" +
@@ -61,12 +61,10 @@ public interface QueryDrugsAndProjectsDao {
             "</if>" +
             "GROUP BY a.charge_code_mx,b.name,c.name " +
             "union all " +
-            "select a.charge_item_code chargeCode,b.name name,sum(a.quantity*drug_win) amountOfMoney,sum(a.quantity*drug_win*unit_price) amountOfMoney, " +
-            "classCode=c.name,source='住院' " +
-            "from mz_charge_detail_b a left join zd_charge_item b on a.charge_item_code=b.code " +
-            "left join zd_charge_class c on b.class_code=c.code " +
-            "where " +
-            "1=1 " +
+            "select a.charge_item_code chargeCode,b.name name,sum(a.quantity*drug_win) amount_of_money, " +
+            "       sum(a.quantity*drug_win*unit_price) amountOfMoney, classCode=c.name,source='门诊' " +
+            "from mz_charge_detail_b a , zd_charge_item b , zd_charge_class c " +
+            "where a.charge_item_code=b.code and b.class_code=c.code " +
             "<if test=\"startTime!=null and startTime!=''\">" +
             "and a.charge_date&gt;=#{startTime} and a.charge_date&lt;#{endTime} " +
             "</if>" +
@@ -79,12 +77,28 @@ public interface QueryDrugsAndProjectsDao {
             "<if test=\"chargeCode!=null and chargeCode!=''\">" +
             "and a.charge_item_code=#{chargeCode} " +
             "</if>" +
-            "and a.pay_mark='0' " +
+            "  and a.pay_mark='0' " +
             "group by a.charge_item_code,a.serial,b.name,c.name" +
             "</script>")
     List<QueryDrugsAndProjects> queryProjects(QueryDrugsAndProjects param);
 
 
+    @Select("select * from (" +
+            "select a.inpatient_no code,a.admiss_times times,rtrim(b.name) name,source='住院',rtrim(c.name) xm_name,charge_date charge_date,a.charge_amount number," +
+            "a.charge_fee amount_of_money,charge_code_mx charge_code " +
+            "from zy_detail_charge a,a_patient_mi b,zd_charge_item c " +
+            "where a.inpatient_no = b.inpatient_no and a.charge_code_mx = c.code and  charge_code_mx = #{chargeCode} and charge_date >= #{startTime} and charge_date  <= #{endTime} " +
+            "union all " +
+            "select a.patient_id code,a.times times,rtrim(b.name) name,source='门诊',rtrim(c.name) xm_name,a.charge_date charge_date,a.quantity * a.drug_win number," +
+            "a.quantity*drug_win*unit_price amount_of_money,charge_item_code charge_code " +
+            "from mz_charge_detail a,mz_patient_mi b,zd_charge_item c " +
+            "where a.patient_id = b.patient_id and  a.charge_item_code = c.code and  charge_item_code = #{chargeCode} and  charge_date >= #{startTime}  and charge_date  <= #{endTime}) temp")
+    List<QueryDrugsAndProjects> queryXiangMuShiYongHuanZhe(IPage<QueryDrugsAndProjects> page,
+                                                           @Param("startTime") String startTime,
+                                                           @Param("endTime") String endTime,
+                                                           @Param("chargeCode") String chargeCode);
+
+
     /**
      * 查询药品
      *
@@ -139,4 +153,29 @@ public interface QueryDrugsAndProjectsDao {
             "group by a.charge_item_code,a.serial,b.name,c.name" +
             "</script>")
     List<QueryDrugsAndProjects> queryDrugs(QueryDrugsAndProjects param);
+
+
+    @Select("select * from (" +
+            "select a.inpatient_no code,admiss_times times,rtrim(b.name) name,source='住院',rtrim(c.name) xm_name,charge_date charge_date,a.charge_amount number," +
+            "a.charge_fee amount_of_money,charge_code_mx charge_code " +
+            "from zy_detail_charge a,a_patient_mi b ,yp_zd_dict c " +
+            "where a.charge_code_mx = c.code and a.inpatient_no = b.inpatient_no and charge_date >= #{startTime} and charge_date <= #{endTime} and a.charge_code_mx = #{chargeCode} " +
+            "union all " +
+            "select a.patient_id code,a.times times,rtrim(b.name) name,source='门诊',rtrim(c.name) xm_name,charge_date charge_date," +
+            "a.quantity * a.drug_win number,a.quantity*drug_win*unit_price amount_of_money, " +
+            "charge_item_code  charge_code " +
+            "from mz_charge_detail_b a,mz_patient_mi b ,yp_zd_dict c " +
+            "where a.patient_id = b.patient_id and a.charge_item_code = c.code and  charge_date >= #{startTime} and charge_date <= #{endTime} and a.charge_item_code = #{chargeCode}) temp ")
+    IPage<QueryDrugsAndProjects> chaKanYaoPinShiYong(IPage<QueryDrugsAndProjects> page,
+                                                     @Param("startTime") String startTime,
+                                                     @Param("endTime") String endTime,
+                                                     @Param("chargeCode") String chargeCode);
+
+    @Select("select rtrim(code) code,rtrim(name) name from ${tableName} where py_code like #{pyCode}")
+    List<GetDropdownBox> chaXunXiangMuhuoYaoPinCode(@Param("tableName") String tableName,
+                                                    @Param("pyCode") String pyCode);
+
+
 }
+
+

+ 44 - 16
src/main/java/thyyxxk/webserver/entity/querydata/QueryDrugsAndProjects.java

@@ -1,7 +1,8 @@
 package thyyxxk.webserver.entity.querydata;
 
 import lombok.Data;
-import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
 
 /**
  * <p>
@@ -15,60 +16,87 @@ import org.apache.ibatis.annotations.Param;
 public class QueryDrugsAndProjects {
     /**
      * 项目的名字
-     * */
+     */
     private String name;
 
     /**
-     *数量
-     * */
+     * 数量
+     */
     private float number;
 
 
     /**
-     *金额
-     * */
+     * 金额
+     */
     private float amountOfMoney;
 
     /**
-     *来源
-     * */
+     * 来源
+     */
     private String source;
 
 
     /**
      * 搜索的条件 下面都是
-     * */
+     */
     private String startTime;
     private String endTime;
     private String ward;
     /**
      * 院内编码
-     * */
+     */
     private String chargeCode;
     /**
      * 费用类别
-     * */
+     */
     private String classCode;
 
     /**
      * 是否为抗生素
-     * */
+     */
     private Integer kssFlag;
 
     /**
-     *药品大类 0 口服 1 大输液 2 针剂 3 草药饮片
-     * */
+     * 药品大类 0 口服 1 大输液 2 针剂 3 草药饮片
+     */
     private Integer categoriesFlag;
 
     /**
      * 药要品编码
-     * */
+     */
     private String drugCode;
 
     /**
      * 包装规格
-     * */
+     */
     private String packageSpecification;
 
+    // 一下是 查询 项目 具体使用人 的详细信息
+    /**
+     * 患者 编码
+     */
+    private String code;
+
+    /**
+     * 项目 名字
+     */
+    private String xmName;
+
+    /**
+     * 次数
+     */
+    private String times;
+
+    /**
+     * 录入时间
+     */
+    private Date chargeDate;
+
+    /**
+     * 导出哪一个
+     * 1:项目
+     * 2:药品
+     */
+    private Integer excelFlag;
 
 }

+ 17 - 0
src/main/java/thyyxxk/webserver/service/querydata/ConsumablesStatisticsService.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.service.querydata;
 
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -10,6 +11,7 @@ import thyyxxk.webserver.dao.his.querydata.ConsumablesStatisticsDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.ConsumablesStatistics;
+import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
 import thyyxxk.webserver.utils.ExcelUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
 
@@ -79,4 +81,19 @@ public class ConsumablesStatisticsService {
     public ResultVo<List<GetDropdownBox>> getDropdownBox() {
         return ResultVoUtil.success(dao.chargeClassName());
     }
+
+    /**
+     * 查询药品或者项目信息
+     *
+     * @param param 查询字段
+     * @return 返回信息
+     */
+    public ResultVo<IPage<QueryDrugsAndProjects>> chaKanXiangMuHuoYaoPin(QueryDrugsAndProjects param) {
+        if (dao.getXiangMuHuoYaoPin("zd_charge_item", param.getChargeCode()).equals(param.getChargeCode())) {
+            log.info("项目");
+        } else if (dao.getXiangMuHuoYaoPin("yp_zd_dict", param.getChargeCode()).equals(param.getChargeCode())) {
+            log.info("药品");
+        }
+        return ResultVoUtil.success();
+    }
 }

+ 73 - 0
src/main/java/thyyxxk/webserver/service/querydata/QueryDrugsAndProjectsService.java

@@ -1,17 +1,23 @@
 package thyyxxk.webserver.service.querydata;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
+import thyyxxk.webserver.constants.GetDateFormat;
 import thyyxxk.webserver.dao.his.querydata.QueryDrugsAndProjectsDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
+import thyyxxk.webserver.utils.DateUtil;
+import thyyxxk.webserver.utils.ExcelUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -60,6 +66,52 @@ public class QueryDrugsAndProjectsService {
         return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
     }
 
+    /**
+     * 查看项目详情
+     *
+     * @param param 查询数据条件
+     * @return 返回分页 对象
+     */
+    public ResultVo<List<QueryDrugsAndProjects>> chaKanXiangQing(QueryDrugsAndProjects param) {
+        IPage<QueryDrugsAndProjects> page = new Page<>(1, 50);
+        log.info("查看项目详情:{}", JSON.toJSONStringWithDateFormat(param, GetDateFormat.DATE_TIME));
+        return ResultVoUtil.successTable(dao.queryXiangMuShiYongHuanZhe(page, param.getStartTime(), param.getEndTime(), param.getChargeCode()), page.getTotal());
+    }
+
+    /**
+     * 导出 使用这个项目的 excel 表
+     *
+     * @param response 返回
+     * @param param    查询条件
+     */
+    public void xiangMuExcel(HttpServletResponse response, QueryDrugsAndProjects param) {
+        IPage<QueryDrugsAndProjects> page = new Page<>(1, -1);
+        List<QueryDrugsAndProjects> list;
+        if (param.getExcelFlag() == 1) {
+            list = dao.queryXiangMuShiYongHuanZhe(page, param.getStartTime(), param.getEndTime(), param.getChargeCode());
+        } else {
+            list = dao.chaKanYaoPinShiYong(page, param.getStartTime(), param.getEndTime(), param.getChargeCode()).getRecords();
+        }
+        log.info("导出项目或者药品:{}", JSON.toJSONStringWithDateFormat(param, GetDateFormat.DATE_TIME));
+        String[] title = {"患者姓名", "住院号", "住院/门诊次数", "收费日期", "数量", "金额", "项目编码", "项目名称", "来源"};
+        String[][] content = new String[list.size()][];
+        for (int i = 0; i < list.size(); i++) {
+            content[i] = new String[title.length];
+            QueryDrugsAndProjects pojo = list.get(i);
+            content[i][0] = pojo.getName();
+            content[i][1] = pojo.getCode();
+            content[i][2] = pojo.getTimes();
+            content[i][3] = DateUtil.formatDatetime(pojo.getChargeDate());
+            content[i][4] = String.valueOf(pojo.getNumber());
+            content[i][5] = String.valueOf(pojo.getAmountOfMoney());
+            content[i][6] = pojo.getChargeCode();
+            content[i][7] = pojo.getXmName();
+            content[i][8] = pojo.getSource();
+        }
+        //传三个参数 一个是 固定的 response ,excel的头部信息,excel的内容
+        ExcelUtil.exportExcel(response, title, content);
+    }
+
     /**
      * 查询药品
      *
@@ -74,4 +126,25 @@ public class QueryDrugsAndProjectsService {
         }
         return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
     }
+
+    /**
+     * 查询使用该药品 的 患者信息
+     *
+     * @param param 查询数据
+     * @return 返回信息
+     */
+    public ResultVo<IPage<QueryDrugsAndProjects>> chaKanYaoPing(QueryDrugsAndProjects param) {
+        IPage<QueryDrugsAndProjects> page = new Page<>(1, 50);
+        return ResultVoUtil.success(dao.chaKanYaoPinShiYong(page, param.getStartTime(), param.getEndTime(), param.getChargeCode()));
+    }
+
+    public ResultVo<List<GetDropdownBox>> yaoPinHuoXiangMuCode(String pyCode, Integer flag) {
+        if (flag == 1) {
+            return ResultVoUtil.success(dao.chaXunXiangMuhuoYaoPinCode("zd_charge_item", "%" + pyCode.toUpperCase() + "%"));
+        } else if (flag == 2) {
+            return ResultVoUtil.success(dao.chaXunXiangMuhuoYaoPinCode("yp_zd_dict", "%" + pyCode.toUpperCase() + "%"));
+        } else {
+            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER);
+        }
+    }
 }