|
@@ -1,7 +1,6 @@
|
|
|
package thyyxxk.webserver.dao.his.yibao;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.apache.ibatis.annotations.*;
|
|
|
import thyyxxk.webserver.entity.datamodify.FeiYongLeiXin;
|
|
|
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
|
|
@@ -23,163 +22,204 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
|
|
|
|
|
|
|
|
|
@Select("<script>" +
|
|
|
- "SELECT a.admiss_times, " +
|
|
|
- " a.inpatient_no, " +
|
|
|
- " a.order_no," +
|
|
|
- " a.gen_time, " +
|
|
|
- " a.ledger_sn, " +
|
|
|
- " a.detail_sn, " +
|
|
|
- " a.charge_date, " +
|
|
|
- " a.op_id_code, " +
|
|
|
- " d.name op_name, " +
|
|
|
- " a.charge_code, " +
|
|
|
- " a.charge_fee, " +
|
|
|
- " a.charge_status , " +
|
|
|
- " bill_item_code= b.bill_item_zy, " +
|
|
|
- " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
|
|
|
- " charge_name=b.name, " +
|
|
|
- " spec=b.charge_unit, " +
|
|
|
- " a.charge_code_mx, " +
|
|
|
- " a.serial, " +
|
|
|
- " price=0.0000, " +
|
|
|
- " charge_amount=a.charge_amount, " +
|
|
|
- " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
- " dept_code = (select name from zd_unit_code where code = 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, " +
|
|
|
- " a.ori_detail_sn " +
|
|
|
- "FROM zy_detail_charge a ,zd_charge_item b,yp_zd_dict c , a_employee_mi d " +
|
|
|
- "where a.charge_code=b.code and a.serial=c.serial and a.charge_code like 'BILL%' and c.code= a.charge_code_mx and a.ledger_sn > 0 " +
|
|
|
- "and d.code = a.op_id_code and trans_flag_yb !=2 and a.order_no != 6 and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and a.infant_flag = #{infantFlag} " +
|
|
|
+ "select a.admiss_times, a.inpatient_no, a.order_no, a.gen_time, a.ledger_sn, a.detail_sn, " +
|
|
|
+ " a.charge_date, a.op_id_code, d.name op_name, a.charge_code, a.charge_fee, a.charge_status , " +
|
|
|
+ " bill_item_code= b.bill_item_zy, bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
|
|
|
+ " charge_name=b.name, spec=b.charge_unit, a.charge_code_mx, a.serial, price=0.0000, charge_amount=a.charge_amount, " +
|
|
|
+ " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
+ " dept_code = (select name from zd_unit_code where code = 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, isnull(a.ori_detail_sn,0) ori_detail_sn " +
|
|
|
+ " FROM (select top ${pageSize} * from (select ROW_NUMBER() OVER (order by charge_date ) as RowNumber,* from zy_detail_charge a " +
|
|
|
+ "where a.charge_code " +
|
|
|
+ "like 'BILL%' and a.ledger_sn = #{ledgerSn} and trans_flag_yb <> 2 and a.order_no <> 6 and inpatient_no = #{inpatientNo} " +
|
|
|
+ "and admiss_times = #{admissTimes} and a.infant_flag = #{infantFlag} " +
|
|
|
"<if test=\"chargeCode != null and chargeCode != '' \">" +
|
|
|
"and charge_code_mx = #{chargeCode} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"startTime != null and startTime!= '' \">" +
|
|
|
- "and a.charge_date >= #{startTime} and a.charge_date <= #{endTime} " +
|
|
|
+ "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"dept != null and dept != '' \"> " +
|
|
|
- "and a.exec_unit=#{dept} " +
|
|
|
+ "and exec_unit=#{dept} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"orderNo != 2 and orderNo != 1 \">" +
|
|
|
- "and a.order_no = #{orderNo} " +
|
|
|
+ "and order_no = #{orderNo} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"orderNo !=2 and orderNo == 1\">" +
|
|
|
- "and len(a.order_no) >2 " +
|
|
|
+ "and len(order_no) >2 " +
|
|
|
"</if>" +
|
|
|
- "order by a.charge_date ${riQiPaiXu}" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
|
|
|
+ "and ori_detail_sn is null " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
|
|
|
+ "and (ori_detail_sn is not null or charge_fee < 0 ) " +
|
|
|
+ "</if>" +
|
|
|
+ ") temp where RowNumber > ${pageSize} * (${currentPage} - 1 ) order by charge_date ${riQiPaiXu} ) a " +
|
|
|
+ " left join zd_charge_item b on (a.charge_code = b.code) " +
|
|
|
+ " left join yp_zd_dict c on (a.serial = c.serial and c.code= a.charge_code_mx) " +
|
|
|
+ " left join a_employee_mi d on (d.code = a.op_id_code) " +
|
|
|
"</script>")
|
|
|
- Page<ZyDetailCharge> huanZheYaoPinFeiYong(Page<ZyDetailCharge> page,
|
|
|
+ List<ZyDetailCharge> huanZheYaoPinFeiYong(@Param("currentPage") long currentPage,
|
|
|
+ @Param("pageSize") long pageSize,
|
|
|
@Param("inpatientNo") String inpatientNo,
|
|
|
@Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn,
|
|
|
@Param("chargeCode") String chargeCode,
|
|
|
@Param("infantFlag") int infantFlag,
|
|
|
@Param("startTime") String startTime,
|
|
|
@Param("endTime") String endTime,
|
|
|
@Param("orderNo") BigDecimal orderNo,
|
|
|
@Param("dept") String dept,
|
|
|
- @Param("riQiPaiXu") String riQiPaiXu);
|
|
|
+ @Param("riQiPaiXu") String riQiPaiXu,
|
|
|
+ @Param("tuiFeiFlag") Integer tuiFeiFlag);
|
|
|
|
|
|
+ @Select("<script>" +
|
|
|
+ "select count(*) total,sum(charge_fee) charge_fee" +
|
|
|
+ " FROM zy_detail_charge a " +
|
|
|
+ "where a.charge_code " +
|
|
|
+ "like 'BILL%' and a.ledger_sn = #{ledgerSn} and trans_flag_yb <> 2 and a.order_no <> 6 and inpatient_no = #{inpatientNo} " +
|
|
|
+ "and admiss_times = #{admissTimes} and a.infant_flag = #{infantFlag} " +
|
|
|
+ "<if test=\"chargeCode != null and chargeCode != '' \">" +
|
|
|
+ "and charge_code_mx = #{chargeCode} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"startTime != null and startTime!= '' \">" +
|
|
|
+ "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"dept != null and dept != '' \"> " +
|
|
|
+ "and exec_unit=#{dept} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"orderNo != 2 and orderNo != 1 \">" +
|
|
|
+ "and order_no = #{orderNo} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"orderNo !=2 and orderNo == 1\">" +
|
|
|
+ "and len(order_no) >2 " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
|
|
|
+ "and ori_detail_sn is null " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
|
|
|
+ "and (ori_detail_sn is not null or charge_fee < 0 ) " +
|
|
|
+ "</if>" +
|
|
|
+ "</script>")
|
|
|
+ long huanZheYaoPinFeiYongTotal(@Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn,
|
|
|
+ @Param("chargeCode") String chargeCode,
|
|
|
+ @Param("infantFlag") int infantFlag,
|
|
|
+ @Param("startTime") String startTime,
|
|
|
+ @Param("endTime") String endTime,
|
|
|
+ @Param("orderNo") BigDecimal orderNo,
|
|
|
+ @Param("dept") String dept,
|
|
|
+ @Param("tuiFeiFlag") Integer tuiFeiFlag);
|
|
|
|
|
|
@Select("<script>" +
|
|
|
- "SELECT a.admiss_times, " +
|
|
|
- " a.inpatient_no," +
|
|
|
- " a.order_no, " +
|
|
|
- " a.gen_time, " +
|
|
|
- " a.ledger_sn, " +
|
|
|
- " a.detail_sn, " +
|
|
|
- " a.charge_date, " +
|
|
|
- " a.op_id_code, " +
|
|
|
- " c.name op_name, " +
|
|
|
- " a.charge_code, " +
|
|
|
- " a.charge_fee, " +
|
|
|
- " a.charge_status , " +
|
|
|
- " bill_item_code = b.bill_item_zy, " +
|
|
|
- " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
|
|
|
- " charge_name=b.name, " +
|
|
|
- " spec=b.charge_unit, " +
|
|
|
- " a.charge_code_mx, " +
|
|
|
- " a.serial, " +
|
|
|
- " price=0.0000, " +
|
|
|
- " charge_amount=a.charge_amount, " +
|
|
|
- " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
- " dept_code = (select name from zd_unit_code where code = 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, " +
|
|
|
- " a.ori_detail_sn " +
|
|
|
- " FROM zy_detail_charge a ,zd_charge_item b , a_employee_mi c " +
|
|
|
- " where a.inpatient_no= #{inpatientNo} and " +
|
|
|
- " a.admiss_times= #{admissTimes} and " +
|
|
|
- " a.infant_flag = #{infantFlag} and c.code = a.op_id_code and trans_flag_yb !=2 " +
|
|
|
- " AND a.charge_code not like 'BILL%' and a.order_no != 6 and a.ledger_sn > 0 and a.charge_code=b.code " +
|
|
|
+ " SELECT a.admiss_times, " +
|
|
|
+ " a.inpatient_no, " +
|
|
|
+ " a.order_no, " +
|
|
|
+ " a.gen_time, " +
|
|
|
+ " a.ledger_sn, " +
|
|
|
+ " a.detail_sn, " +
|
|
|
+ " a.charge_date, " +
|
|
|
+ " a.op_id_code, " +
|
|
|
+ " c.name op_name, " +
|
|
|
+ " a.charge_code, " +
|
|
|
+ " a.charge_fee, " +
|
|
|
+ " a.charge_status , " +
|
|
|
+ " bill_item_code = b.bill_item_zy, " +
|
|
|
+ " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy), " +
|
|
|
+ " charge_name=b.name, " +
|
|
|
+ " spec=b.charge_unit, " +
|
|
|
+ " a.charge_code_mx, " +
|
|
|
+ " a.serial, " +
|
|
|
+ " price=0.0000, " +
|
|
|
+ " charge_amount=a.charge_amount, " +
|
|
|
+ " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
|
|
|
+ " dept_code = (select name from zd_unit_code where code = 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, " +
|
|
|
+ " isnull(a.ori_detail_sn,0) ori_detail_sn " +
|
|
|
+ " FROM (select top ${pageSize} * from (select ROW_NUMBER() OVER (order by charge_date ) as RowNumber,* from zy_detail_charge where inpatient_no= #{inpatientNo} and " +
|
|
|
+ "admiss_times= #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and trans_flag_yb <> 2 AND charge_code not like 'BILL%' and order_no <> 6" +
|
|
|
"<if test=\"chargeCode != null and chargeCode != '' \">" +
|
|
|
"and charge_code_mx = #{chargeCode} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"startTime != null and startTime!= '' \">" +
|
|
|
- "and a.charge_date >= #{startTime} and a.charge_date <= #{endTime} " +
|
|
|
+ "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"dept != null and dept != '' \"> " +
|
|
|
- "and a.exec_unit = #{dept} " +
|
|
|
+ "and exec_unit = #{dept} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"orderNo != 2 and orderNo != 1 \">" +
|
|
|
- "and a.order_no = #{orderNo} " +
|
|
|
+ "and order_no = #{orderNo} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"orderNo !=2 and orderNo == 1\">" +
|
|
|
- "and len(a.order_no) >2 " +
|
|
|
+ "and len(order_no) >2 " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
|
|
|
+ "and ori_detail_sn is null " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
|
|
|
+ "and (ori_detail_sn is not null or charge_fee < 0 )" +
|
|
|
"</if>" +
|
|
|
- "order by a.charge_date ${riQiPaiXu}" +
|
|
|
+ ") temp where RowNumber > ${pageSize} * (${currentPage}-1) order by charge_date ${riQiPaiXu}) a " +
|
|
|
+ " left join zd_charge_item b on (a.charge_code=b.code) " +
|
|
|
+ " left join a_employee_mi c on (c.code = a.op_id_code)" +
|
|
|
"</script>")
|
|
|
- Page<ZyDetailCharge> huanZheXiangMuFeiYong(Page<ZyDetailCharge> page,
|
|
|
+ List<ZyDetailCharge> huanZheXiangMuFeiYong(@Param("currentPage") long currentPage,
|
|
|
+ @Param("pageSize") long pageSize,
|
|
|
@Param("inpatientNo") String inpatientNo,
|
|
|
@Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn,
|
|
|
@Param("chargeCode") String chargeCode,
|
|
|
@Param("infantFlag") int infantFlag,
|
|
|
@Param("startTime") String startTime,
|
|
|
@Param("endTime") String endTime,
|
|
|
@Param("orderNo") BigDecimal orderNo,
|
|
|
@Param("dept") String dept,
|
|
|
- @Param("riQiPaiXu") String riQiPaiXu);
|
|
|
+ @Param("riQiPaiXu") String riQiPaiXu,
|
|
|
+ @Param("tuiFeiFlag") Integer tuiFeiFlag);
|
|
|
|
|
|
|
|
|
@Select("<script>" +
|
|
|
- "SELECT count(*) " +
|
|
|
- " FROM zy_detail_charge a " +
|
|
|
- " where a.inpatient_no= #{inpatientNo} and " +
|
|
|
- " a.admiss_times= #{admissTimes} and " +
|
|
|
- " a.infant_flag = #{infantFlag} and trans_flag_yb !=2 " +
|
|
|
- " AND a.charge_code ${isLike} 'BILL%' and a.order_no != 6 and a.ledger_sn >0 " +
|
|
|
+ " select count(*) total,sum(charge_fee) charge_fee from zy_detail_charge where inpatient_no= #{inpatientNo} and " +
|
|
|
+ "admiss_times= #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and trans_flag_yb <> 2 AND charge_code not like 'BILL%' and order_no <> 6" +
|
|
|
"<if test=\"chargeCode != null and chargeCode != '' \">" +
|
|
|
"and charge_code_mx = #{chargeCode} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"startTime != null and startTime!= '' \">" +
|
|
|
- "and a.charge_date >= #{startTime} and a.charge_date <= #{endTime} " +
|
|
|
+ "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"dept != null and dept != '' \"> " +
|
|
|
- "and a.exec_unit = #{dept} " +
|
|
|
+ "and exec_unit = #{dept} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"orderNo != 2 and orderNo != 1 \">" +
|
|
|
- "and a.order_no = #{orderNo} " +
|
|
|
+ "and order_no = #{orderNo} " +
|
|
|
"</if>" +
|
|
|
"<if test=\"orderNo !=2 and orderNo == 1\">" +
|
|
|
- "and len(a.order_no) >2 " +
|
|
|
+ "and len(order_no) >2 " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 0 \">" +
|
|
|
+ "and ori_detail_sn is null " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
|
|
|
+ "and (ori_detail_sn is not null or charge_fee < 0 )" +
|
|
|
"</if>" +
|
|
|
"</script>")
|
|
|
long huanZheFeiYongCount(@Param("inpatientNo") String inpatientNo,
|
|
|
@Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn,
|
|
|
@Param("chargeCode") String chargeCode,
|
|
|
@Param("infantFlag") int infantFlag,
|
|
|
@Param("startTime") String startTime,
|
|
|
@Param("endTime") String endTime,
|
|
|
@Param("orderNo") BigDecimal orderNo,
|
|
|
@Param("dept") String dept,
|
|
|
- @Param("isLike") String isLike);
|
|
|
+ @Param("tuiFeiFlag") Integer tuiFeiFlag);
|
|
|
|
|
|
|
|
|
@Select("select detail_sn,ori_detail_sn from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} " +
|
|
@@ -521,7 +561,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
|
|
|
" , zy_serial_no, charge_code_mx, serial,ss_code,yb_self_flag,refer_physician) " +
|
|
|
"VALUES " +
|
|
|
"<foreach collection='list' item='item' separator=','>" +
|
|
|
- "(#{zyDetailCharge.inpatientNo}, #{zyDetailCharge.admissTimes}, 1, #{item.detailSn}, getdate() " +
|
|
|
+ "(#{zyDetailCharge.inpatientNo}, #{zyDetailCharge.admissTimes}, #{ledgerSn}, #{item.detailSn}, getdate() " +
|
|
|
" , #{zyDetailCharge.opIdCode}, #{item.chargeCode}, #{infantFlag}, '2', cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) " +
|
|
|
" , '0', '0', NULL, #{zyDetailCharge.ward}, #{zyDetailCharge.dept} " +
|
|
|
" , #{item.orderNo}, '0', #{item.deptCode}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)), getdate() " +
|
|
@@ -538,7 +578,8 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
|
|
|
"</script>")
|
|
|
void chaRuFeiYong(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
|
|
|
@Param("list") List<ZyDetailCharge> list,
|
|
|
- @Param("infantFlag") int infantFlag);
|
|
|
+ @Param("infantFlag") int infantFlag,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
/**
|
|
|
* 需要更新患者的总费用
|