123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236 |
- package thyyxxk.webserver.dao.his.inpatient;
- import com.baomidou.mybatisplus.core.conditions.Wrapper;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.mapper.BaseMapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.core.toolkit.Constants;
- 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;
- import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
- import thyyxxk.webserver.entity.inpatient.WeiGuiFeiYongFenXi;
- import java.math.BigDecimal;
- import java.util.List;
- /**
- * <p>
- * 描述: 项目录入
- * </p>
- *
- * @author xc
- * @date 2021-08-02 10:37
- */
- @Mapper
- 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.trans_flag_yb, " +
- " 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 ${riQiPaiXu} ) 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 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 and charge_fee > 0" +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
- "and (ori_detail_sn > 0 or charge_fee < 0) " +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
- "and (ori_detail_sn = -1 )" +
- "</if>" +
- "<if test=\"actOrderNo != null\">" +
- " and order_no = #{actOrderNo} " +
- "</if>" +
- ") temp where RowNumber > ${pageSize} * (${currentPage} - 1 )) 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>")
- 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("actOrderNo") BigDecimal actOrderNo,
- @Param("dept") String dept,
- @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 and charge_fee > 0" +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
- "and (ori_detail_sn > 0 or charge_fee < 0) " +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
- "and (ori_detail_sn = -1 )" +
- "</if>" +
- "<if test=\"actOrderNo != null\">" +
- " and order_no = #{actOrderNo} " +
- "</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("actOrderNo") BigDecimal actOrderNo,
- @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.trans_flag_yb, " +
- " 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," +
- " specification, " +
- " 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 ${riQiPaiXu} ) 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 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 and charge_fee > 0" +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
- "and (ori_detail_sn > 0 or charge_fee < 0) " +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
- "and (ori_detail_sn = -1 )" +
- "</if>" +
- "<if test=\"actOrderNo != null\">" +
- " and order_no = #{actOrderNo} " +
- "</if>" +
- ") temp where RowNumber > ${pageSize} * (${currentPage}-1) ) 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>")
- 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("actOrderNo") BigDecimal actOrderNo,
- @Param("dept") String dept,
- @Param("riQiPaiXu") String riQiPaiXu,
- @Param("tuiFeiFlag") Integer tuiFeiFlag);
- @Select("<script>" +
- " 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 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 and charge_fee > 0" +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 1 \">" +
- "and (ori_detail_sn > 0 or charge_fee < 0) " +
- "</if>" +
- "<if test=\"tuiFeiFlag != null and tuiFeiFlag == 2 \">" +
- "and (ori_detail_sn = -1 )" +
- "</if>" +
- "<if test=\"actOrderNo != null\">" +
- " and order_no = #{actOrderNo} " +
- "</if>" +
- "</script>")
- long huanZheFeiYongToatal(@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("actOrderNo") BigDecimal actOrderNo,
- @Param("dept") String dept,
- @Param("tuiFeiFlag") Integer tuiFeiFlag);
- @Select("select detail_sn,ori_detail_sn from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} " +
- "and charge_fee <= 0 and ori_detail_sn is not null and infant_flag = #{infantFlag}")
- List<ZyDetailCharge> tuiFeiList(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("infantFlag") int infantFlag);
- /**
- * @param pyCode 拼音编码
- * @return 获取项目的名称和code
- */
- @Select("select distinct code,name from zd_charge_item where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})" +
- "union all " +
- "select distinct code,name from yp_zd_dict where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})")
- List<GetDropdownBox> getChargeCode(String pyCode);
- /**
- * @param inpatientNo 住院次数
- * @param admissTimes 住院号
- * @param list 需要退费的流水号
- * @return 获取患者的全部详细信息 因为要生成一条一样的数据 只是 费用和数量不一致 以及录入人 和 录入时间
- */
- @Select("<script>" +
- "select " +
- "inpatient_no, " +
- " admiss_times, " +
- " ledger_sn, " +
- " detail_sn, " +
- " charge_date, " +
- " op_id_code, " +
- " charge_code, " +
- " bill_item_code = (select bill_item_zy from zd_charge_item where code = charge_code), " +
- " infant_flag, " +
- " charge_status, " +
- " retprice, " +
- " charge_amount, " +
- " charge_fee, " +
- " self_flag, " +
- " separate_flag, " +
- " suppress_flag, " +
- " ward_code, " +
- " dept_code, " +
- " order_no, " +
- " ope_flag, " +
- " exec_unit, " +
- " gen_time, " +
- " pay_percent, " +
- " zj_flag, " +
- " zfl, " +
- " rtrim(charge_code_mx) as charge_code_mx, " +
- " rtrim(serial) as serial, " +
- " zy_serial_no, " +
- " doctor_code, " +
- " yb_self_flag, " +
- " orig_charge_fee, " +
- " confirm_id, " +
- " trans_flag_yb, " +
- " ss_code, " +
- " gs_flag, " +
- " refer_physician, " +
- " consult_physician, " +
- " ori_detail_sn" +
- " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item.detailSn}" +
- "</foreach>" +
- "</script>")
- List<ZyDetailCharge> huoQuJuTiFeiYong(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<ZyDetailCharge> list);
- /**
- * 查询出 有哪些数据已经退过了 费用
- *
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- * @param list 流水号
- * @return 返回 已经退过费用的数据
- */
- @Select("<script>" +
- "select " +
- "inpatient_no, " +
- " admiss_times, " +
- " ledger_sn, " +
- " detail_sn, " +
- " charge_date, " +
- " op_id_code, " +
- " charge_code, " +
- " bill_item_code = (select bill_item_zy from zd_charge_item where code = charge_code), " +
- " infant_flag, " +
- " charge_status, " +
- " retprice, " +
- " charge_amount, " +
- " charge_fee, " +
- " self_flag, " +
- " separate_flag, " +
- " suppress_flag, " +
- " ward_code, " +
- " dept_code, " +
- " order_no, " +
- " ope_flag, " +
- " exec_unit, " +
- " gen_time, " +
- " pay_percent, " +
- " zj_flag, " +
- " zfl, " +
- " charge_code_mx, " +
- " serial, " +
- " zy_serial_no, " +
- " doctor_code, " +
- " yb_self_flag, " +
- " orig_charge_fee, " +
- " confirm_id, " +
- " trans_flag_yb, " +
- " ss_code, " +
- " gs_flag, " +
- " refer_physician, " +
- " consult_physician, " +
- " ori_detail_sn" +
- " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item.detailSn}" +
- "</foreach>" +
- "</script>")
- List<ZyDetailCharge> chaKanSFYiJingTuiFeiLe(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<ZyDetailCharge> list);
- /**
- * 插入数据
- *
- * @param list 插入退费的数据 生成一条一样的数据 只是 费用和数量不一致 以及录入人 和 录入时间 ori_detail_sn 保存退费的原流水号
- */
- @Insert("<script>" +
- "insert into zy_detail_charge(inpatient_no, admiss_times, ledger_sn, detail_sn, charge_date, op_id_code, charge_code, infant_flag, " +
- "charge_status, retprice, charge_amount, charge_fee, self_flag, separate_flag, suppress_flag, ward_code, dept_code, order_no, ope_flag, exec_unit, gen_time, " +
- "pay_percent, zj_flag, zfl, charge_code_mx, serial, zy_serial_no, doctor_code, yb_self_flag, orig_charge_fee, confirm_id, trans_flag_yb, ss_code, gs_flag, " +
- "refer_physician, consult_physician, ori_detail_sn) " +
- "values " +
- "<foreach collection='list' item='item' separator=','>" +
- "(#{item.inpatientNo},#{item.admissTimes},#{item.ledgerSn},#{item.detailSn},getdate(),#{item.opIdCode},#{item.chargeCode},#{item.infantFlag}," +
- "#{item.chargeStatus},#{item.retprice},cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)),cast(#{item.chargeFee,jdbcType=DECIMAL} as decimal(14,5))," +
- "#{item.selfFlag},#{item.separateFlag},#{item.suppressFlag},#{item.wardCode},#{item.deptCode},#{item.orderNo}," +
- "#{item.opeFlag},#{item.execUnit},#{item.oldGenTime}," +
- "#{item.payPercent},#{item.zjFlag},#{item.zfl},#{item.chargeCodeMx},#{item.serial},#{item.zySerialNo},#{item.doctorCode}," +
- "#{item.ybSelfFlag},cast(#{item.origChargeFee,jdbcType=DECIMAL} as decimal(14,5)),#{item.confirmId},0,#{item.ssCode},#{item.gsFlag}," +
- "#{item.referPhysician},#{item.consultPhysician},#{item.oriDetailSn})" +
- "</foreach>" +
- "</script>")
- void xiangMuTuiFei(@Param("list") List<ZyDetailCharge> list);
- /**
- * 更新对应 退费的正数 流水
- *
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- * @param ledgerSn 账页号
- * @param list 正流水
- */
- @Update("<script>" +
- "update zy_detail_charge set ori_detail_sn = #{flag} where " +
- "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
- "and ledger_sn = #{ledgerSn} " +
- "and charge_fee > 0 and charge_amount > 0 and detail_sn in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item}" +
- "</foreach>" +
- "</script>")
- void genXinZhenShuTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<Integer> list,
- @Param("flag") int flag);
- /**
- * 退药汇总单
- */
- @Insert("insert into yz_yp_page_no (page_no, dept_code, ward_code, submit_time, submit_name,\n" +
- " submit_flag, page_class, page_name, group_no)\n" +
- "values (#{pageNo}, #{wardCode}, #{wardCode}, getdate(), #{userCode}, 1, 'HT', '护士退药单', #{groupNo})")
- void drugReturnForm(@Param("pageNo") Integer pageNo,
- @Param("wardCode") String wardCode,
- @Param("userCode") String userCode,
- @Param("groupNo") String groupNo);
- @Insert("<script>" +
- "insert into yz_yp_zy_order (inpatient_no, admiss_times, name, bed_no, dept_code, ward_code, charge_code, amount,\n" +
- " retprice, charge_date, infant_flag, drawer, always_flag, status_flag, drug_class, serail,\n" +
- " occ_time, act_order_no, serial, group_no, doctor_name, page_no_ty, page_class,page_no)\n" +
- "values " +
- "<foreach collection='list' item='item' separator=','>" +
- "(#{patNo}, #{times}, #{name}, #{bedNo}, #{wardCode}, #{wardCode}, #{item.chargeCodeMx}, #{item.chargeAmount,jdbcType=REAL},\n" +
- " #{item.chargeFee,jdbcType=REAL}, getdate(), #{infantFlag}, #{userCode}, 'a', '1',\n" +
- " (select case infusion_flag\n" +
- " when '1' then 'i'\n" +
- " else\n" +
- " (case\n" +
- " when code >= '30000' and code < '50000' then 'd'\n" +
- " else 'j' end) end\n" +
- " from yp_zd_dict\n" +
- " where rtrim(code) + rtrim(serial) = '${item.chargeCodeMx}${item.serial}'), #{item.detailSn}, getdate(), 0, #{item.serial}, #{groupNo},\n" +
- " #{item.doctorCode}, #{pageNo}, null,#{ledgerSn})" +
- "</foreach>" +
- "</script>")
- void detailsOfDrugReturnForm(@Param("list") List<ZyDetailCharge> list,
- @Param("patNo") String patNo,
- @Param("times") Integer times,
- @Param("name") String name,
- @Param("bedNo") String bedNo,
- @Param("wardCode") String wardCode,
- @Param("infantFlag") Integer infantFlag,
- @Param("groupNo") String groupNo,
- @Param("userCode") String userCode,
- @Param("pageNo") Integer pageNo,
- @Param("ledgerSn") Integer ledgerSn);
- /**
- * 获取模板
- *
- * @param queryWrapper 根据科室来搜索
- * @return 返回模板信息
- */
- @Select("SELECT rtrim(pattern_name) as name, " +
- " max(group_no) as group_no, " +
- " max(op_id_code) as op_id_code, " +
- " op_dept " +
- "FROM zy_charge_pattern " +
- " ${ew.customSqlSegment} " +
- "group by pattern_name, op_dept ")
- Page<ZyDetailCharge> getMuBan(IPage<ZyDetailCharge> page,
- @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
- /**
- * 这个是获取模板下面的那些项目具体信息
- *
- * @param patternName 模板名称
- * @param opIdCode 录入人id
- * @return 返回模板 下面的详细信息
- */
- @Select("SELECT charge_name=RTRIM(b.name), " +
- " charge_code_mx=b.code, " +
- " amount=a.amount, " +
- " charge_amount=b.charge_amount, " +
- " op_id_code=a.op_id_code, " +
- " bill_item_code=b.bill_item_zy, " +
- " bill_item_name=(select name from zy_bill_item where code = b.bill_item_zy)," +
- " national_code," +
- " national_name," +
- " descriptions " +
- "FROM zy_charge_pattern a, " +
- " zd_charge_item b " +
- "WHERE (a.pattern_name = #{patternName}) " +
- " and a.op_id_code = #{opIdCode} " +
- " and a.charge_code = b.code " +
- " and isnull(a.serial, '01') = '00' " +
- " and (isnull(b.del_flag, '0') <> '1') " +
- "union all " +
- "SELECT charge_name=RTRIM(d.name), " +
- " charge_code_mx=b.charge_code, " +
- " amount=a.amount, " +
- " charge_amount=d.pack_retprice, " +
- " op_id_code=a.op_id_code, " +
- " bill_item_code=d.bill_item_zy, " +
- " bill_item_name=(select name from zy_bill_item where code = d.bill_item_zy)," +
- " national_code," +
- " national_name," +
- " specification as descriptions " +
- "FROM zy_charge_pattern a, " +
- " yp_base_yf b, " +
- " yp_zd_dict d " +
- "WHERE (a.pattern_name = #{patternName}) " +
- " and a.op_id_code = #{opIdCode} " +
- " and a.group_no = b.group_no " +
- " and a.charge_code = b.charge_code " +
- " and isnull(a.serial, '01') = b.serial " +
- " and b.charge_code = d.code " +
- " and b.serial = d.serial " +
- " and isnull(d.del_flag, '0') <> '1' " +
- " and isnull(b.visible_flag_zy, '0') <> '1'")
- List<ZyDetailCharge> getMuBanXinXi(@Param("patternName") String patternName, @Param("opIdCode") String opIdCode);
- /**
- * 搜索项目信息
- *
- * @param pyCode 拼音码
- * @return 返回模板信息
- */
- @Select("SELECT a.code charge_code," +
- " a.code charge_code_mx, " +
- " a.exec_unit dept_code," +
- " rtrim(a.yb_comment) yb_comment, " +
- " RTRIM(a.name) charge_name, " +
- " a.charge_amount," +
- " amount = 1, " +
- " bill_item_code=a.bill_item_zy, " +
- " bill_item_name=(select name from zy_bill_item where code = a.bill_item_zy)," +
- " a.py_code, " +
- " a.d_code, " +
- " a.suppress_flag, " +
- " a.bill_item_out, " +
- " a.n_code, " +
- " self_flag =isnull(a.self_flag,'0'), " +
- " a.separate_flag , " +
- " spec=charge_unit, " +
- " a.yb_comment, " +
- " exec_unit_name=b.name, " +
- " serial='00', " +
- " group_no='00'," +
- " national_code," +
- " national_name," +
- " descriptions " +
- "FROM zd_charge_item a left join zd_unit_code b on (a.exec_unit = b.code) " +
- "where isnull(a.del_flag,'') <> '1' and " +
- " isnull(a.in_out_flag,'') <> '1' and " +
- " (a.py_code like #{pyCode} or a.code like #{pyCode} or a.name like #{pyCode})")
- List<ZyDetailCharge> queryXiangMu(String pyCode);
- @Select("SELECT distinct a.code charge_code_mx, " +
- " charge_code = (select charge_code from zy_bill_item where a.bill_item_zy = zy_bill_item.code), " +
- " a.serial, " +
- " RTRIM(a.name) charge_name, " +
- " a.pack_size amount, " +
- " charge_amount=a.pack_retprice, " +
- " spec=a.specification, " +
- " a.drug_flag , " +
- " a.fix_price, " +
- " c.stock_amount, " +
- " self_flag=isnull(a.self_flag,'0'), " +
- " suppress_flag=a.suprice_flag, " +
- " group_no=c.group_no, " +
- " bill_item_code=a.bill_item_zy, " +
- " bill_item_name=(select name from zy_bill_item where code = a.bill_item_zy), " +
- " ybbz=a.yb_comment_new, " +
- " yblx=(select name from yp_zd_yb_type where code=a.yb_flag_new), " +
- " xnh=a.xnh_flag," +
- " national_code," +
- " national_name " +
- "FROM yp_zd_dict a ,yp_print_name b , " +
- " yp_base_yf c " +
- "where " +
- "(a.py_code like #{pyCode} or a.name like #{pyCode} or a.code like #{pyCode}) and" +
- " a.code=b.charge_code and " +
- " a.code=c.charge_code and " +
- " a.serial=c.serial and " +
- " c.visible_flag_mz <> '1' and " +
- " c.visible_flag_zy <> '1' and" +
- " isnull(a.del_flag,0) = 0 and " +
- " c.group_no='73'")
- List<ZyDetailCharge> queryYaoPin(String pyCode);
- /**
- * 插入项目录入费用
- *
- * @param zyDetailCharge 插入的信息
- * @param list 费用详情
- */
- @Insert("<script>" +
- "INSERT INTO zy_detail_charge (inpatient_no, admiss_times, ledger_sn, detail_sn, charge_date " +
- " , op_id_code, charge_code, infant_flag, charge_status, charge_fee " +
- " , self_flag, separate_flag, suppress_flag, ward_code, dept_code " +
- " , order_no, ope_flag, exec_unit, charge_amount, gen_time " +
- " , zy_serial_no, charge_code_mx, serial,ss_code,yb_self_flag,refer_physician,doctor_code) " +
- "VALUES " +
- "<foreach collection='list' item='item' separator=','>" +
- "(#{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() " +
- " , #{zyDetailCharge.zySerialNo}, #{item.chargeCodeMx}, #{item.serial},#{zyDetailCharge.ssCode}," +
- // 是否医保报销 标志 默认为空值
- "<if test=\"item.ybSelfFlag == null\">" +
- "0" +
- "</if>" +
- "<if test=\"item.ybSelfFlag != null\">" +
- "#{item.ybSelfFlag}" +
- "</if>" +
- ",#{zyDetailCharge.referPhysician}," +
- "null)" +
- "</foreach>" +
- "</script>")
- void chaRuFeiYong(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
- @Param("list") List<ZyDetailCharge> list,
- @Param("infantFlag") int infantFlag,
- @Param("ledgerSn") Integer ledgerSn);
- @Select("<script>" +
- "SELECT charge_code charge_code_mx,group_no,serial FROM yp_base_yf WHERE charge_code in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item.chargeCodeMx}" +
- "</foreach>" +
- "</script>")
- List<ZyDetailCharge> yaoFang(List<ZyDetailCharge> yaoPingCode);
- @Insert("<script>" +
- "insert into zy_drug ( inpatient_no , admiss_times , ledger_sn , detail_sn , charge_date , op_id_code , charge_code , infant_flag , " +
- "charge_fee , self_flag , separate_flag , supress_flag , ward_code , dept_code , ope_flag , exec_unit , retprice , amount , zy_serial_no , " +
- "serial , group_no , occ_cate ) values " +
- "<foreach collection='list' item='item' separator=','>" +
- "( #{zyDetailCharge.inpatientNo} , #{zyDetailCharge.admissTimes} , #{ledgerSn} , #{item.detailSn} , getdate() , #{opIdCode} , " +
- "#{item.chargeCodeMx} , #{infantFlag} , " +
- // 金额
- "cast(#{item.chargeFee,jdbcType=DECIMAL} as decimal(14,5))," +
- " '0' , '0' , null , #{zyDetailCharge.ward} , #{zyDetailCharge.dept} , '0' , #{item.deptCode} ," +
- // 单价
- " cast(#{item.chargeFee,jdbcType=DECIMAL} / #{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) , " +
- // 数量
- "cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) " +
- ", #{zyDetailCharge.zySerialNo} , #{item.serial} , 73 ,'1' )" +
- "</foreach>" +
- "</script>")
- void shenQingYaoPing(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
- @Param("list") List<ZyDetailCharge> list,
- @Param("infantFlag") int infantFlag,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("opIdCode") String opIdCode);
- /**
- * 需要更新患者的总费用
- *
- * @param fy 费用
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- */
- @Update("<script>" +
- "update ${tableName} " +
- "<trim prefix='set' suffixOverrides=','> " +
- "total_charge = total_charge + #{fy.totalCharge} , " +
- "balance = balance - #{fy.totalCharge}," +
- "<if test=\"fy.charge1 !=null \">" +
- "charge1 =charge1 + #{fy.charge1} ," +
- "</if>" +
- "<if test=\"fy.charge2 !=null \">" +
- "charge2 =charge2 + #{fy.charge2} ," +
- "</if>" +
- "<if test=\"fy.charge3 !=null \">" +
- "charge3 =charge3 + #{fy.charge3} ," +
- "</if>" +
- "<if test=\"fy.charge4 !=null \">" +
- "charge4 =charge4 + #{fy.charge4} ," +
- "</if>" +
- "<if test=\"fy.charge5 !=null \">" +
- "charge5 =charge5 + #{fy.charge5} ," +
- "</if>" +
- "<if test=\"fy.charge6 !=null \">" +
- "charge6 =charge6 + #{fy.charge6} ," +
- "</if>" +
- "<if test=\"fy.charge7 !=null \">" +
- "charge7 =charge7 + #{fy.charge7} ," +
- "</if>" +
- "<if test=\"fy.charge8 !=null \">" +
- "charge8 =charge8 + #{fy.charge8} ," +
- "</if>" +
- "<if test=\"fy.charge9 !=null \">" +
- "charge9 =charge9 + #{fy.charge9} ," +
- "</if>" +
- "<if test=\"fy.charge10 !=null \">" +
- "charge10 =charge10 + #{fy.charge10} ," +
- "</if>" +
- "<if test=\"fy.charge11 !=null \">" +
- "charge11 =charge11 + #{fy.charge11} ," +
- "</if>" +
- "<if test=\"fy.charge12 !=null \">" +
- "charge12 =charge12 + #{fy.charge12} ," +
- "</if>" +
- "<if test=\"fy.charge13 !=null \">" +
- "charge13 =charge13 + #{fy.charge13} ," +
- "</if>" +
- "<if test=\"fy.charge14 !=null \">" +
- "charge14 =charge14 + #{fy.charge14} ," +
- "</if>" +
- "<if test=\"fy.charge15 !=null \">" +
- "charge15 =charge15 + #{fy.charge15} ," +
- "</if>" +
- "<if test=\"fy.charge16 !=null \">" +
- "charge16 =charge16 + #{fy.charge16} ," +
- "</if>" +
- "<if test=\"fy.charge17 !=null \">" +
- "charge17 =charge17 + #{fy.charge17} ," +
- "</if>" +
- "<if test=\"fy.charge18 !=null \">" +
- "charge18 =charge18 + #{fy.charge18} ," +
- "</if>" +
- "<if test=\"fy.charge19 !=null \">" +
- "charge19 =charge19 + #{fy.charge19} ," +
- "</if>" +
- "<if test=\"fy.charge20 !=null \">" +
- "charge20 =charge20 + #{fy.charge20} ," +
- "</if>" +
- "<if test=\"fy.charge21 !=null \">" +
- "charge21 =charge21 + #{fy.charge21} ," +
- "</if>" +
- "<if test=\"fy.charge22 !=null \">" +
- "charge22 =charge22 + #{fy.charge22} ," +
- "</if>" +
- "<if test=\"fy.charge23 !=null \">" +
- "charge23 =charge23 + #{fy.charge23} ," +
- "</if>" +
- "<if test=\"fy.charge24 !=null \">" +
- "charge24 =charge24 + #{fy.charge24} ," +
- "</if>" +
- "<if test=\"fy.charge25 !=null \">" +
- "charge25 =charge25 + #{fy.charge25} ," +
- "</if>" +
- "<if test=\"fy.charge26 !=null \">" +
- "charge26 =charge26 + #{fy.charge26} ," +
- "</if>" +
- "<if test=\"fy.charge27 !=null \">" +
- "charge27 =charge27 + #{fy.charge27} ," +
- "</if>" +
- "<if test=\"fy.charge28 !=null \">" +
- "charge28 =charge28 + #{fy.charge28} ," +
- "</if>" +
- "<if test=\"fy.charge29 !=null \">" +
- "charge29 =charge29 + #{fy.charge29} ," +
- "</if>" +
- "<if test=\"fy.charge30 !=null \">" +
- "charge30 =charge30 + #{fy.charge30} ," +
- "</if>" +
- "</trim>" +
- "WHERE inpatient_no = #{inpatientNo} and admiss_times=#{admissTimes}" +
- "</script>")
- void huanZheZongFeiYong(@Param("fy") FeiYongLeiXin fy,
- @Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("tableName") String tableName);
- /**
- * 查看模板名称是否存在
- *
- * @param patternName 模板名字
- * @param opIdCode 创建模板的人 code
- * @return 返回条数
- */
- @Select("select count(*) from zy_charge_pattern where pattern_name = #{patternName} and op_id_code <> #{opIdCode} ")
- Integer chaKanMuBanMingChengSFcunZi(@Param("patternName") String patternName,
- @Param("opIdCode") String opIdCode);
- /**
- * 删除模板
- *
- * @param patternName 模板名字
- * @param opIdCode 创建模板的人 code
- */
- @Select("delete zy_charge_pattern where pattern_name = #{patternName} and op_id_code = #{opIdCode} ")
- Integer delMuBan(@Param("patternName") String patternName,
- @Param("opIdCode") String opIdCode);
- /**
- * 保存模板
- *
- * @param param 保存的数据
- */
- @Insert("<script>" +
- "INSERT INTO zy_charge_pattern ( charge_name, " +
- " pattern_name, " +
- " charge_code, " +
- " group_no," +
- " serial, " +
- " amount, " +
- " self, " +
- " separate," +
- " suppress, " +
- " infant, " +
- " per1," +
- " per2," +
- " per3," +
- " per4," +
- " per5," +
- " item_no, " +
- " op_id_code, " +
- " py_code, " +
- " d_code, " +
- " charge_fee, " +
- " op_dept, " +
- " default_no " +
- " )" +
- " VALUES " +
- "<foreach collection='param.list' item='item' index='index' separator=','>" +
- "( substring(#{item.chargeName},0,15) , #{param.name} , #{item.chargeCodeMx} , #{item.groupNo}, #{item.serial}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)) , " +
- "'0', '0', '0', '0', 1, 1, 1, 1, 1, #{index} + 1 , #{param.opIdCode} , #{param.pyCode} , #{param.dCode} , cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5)) ," +
- " #{param.deptCode} , " +
- "#{param.defaultNo} )" +
- "</foreach>" +
- "</script>")
- void baoCunMuBan(@Param("param") ZyDetailCharge param);
- /**
- * 获取医嘱的费用
- *
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- * @param ZF 正的费用还是负的费用
- * @return 返回list 费用集合
- */
- @Select("<script>" +
- "select charge_date,charge_fee,charge_amount,charge_code_mx,detail_sn,ori_detail_sn,ABS(order_no),order_no,ledger_sn,exec_unit " +
- "from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and ori_detail_sn is null and charge_amount ${ZF} 0 and charge_fee ${ZF} 0 and infant_flag = #{infantFlag} and trans_flag_yb <> 2 " +
- "<if test=\"list.size >0 \">" +
- "and exec_unit in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item}" +
- "</foreach>" +
- "</if>" +
- "</script>")
- List<ZyDetailCharge> getYiZhuFeiYong(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("ZF") String ZF,
- @Param("infantFlag") int infantFlag,
- @Param("list") List<String> list);
- /**
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- * @param yiZhuPiPei 需要匹配的流水信息
- */
- @Update("<script>" +
- "<foreach collection='list' item='item' index='index' open='' close='' separator=';'>" +
- "update zy_detail_charge set ori_detail_sn = #{item.oriDetailSn} where inpatient_no= #{inpatientNo} and admiss_times = #{admissTimes} " +
- "and detail_sn = #{item.detailSn} and infant_flag = #{infantFlag} and ledger_sn = #{item.ledgerSn} " +
- "</foreach>" +
- "</script>")
- void yiZhuTuiFeiPiPei(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("list") List<ZyDetailCharge> yiZhuPiPei,
- @Param("infantFlag") int infantFlag);
- @Select("SELECT small_dept FROM zd_dept_all where dept = #{dept}")
- List<String> chaXunZhiZXinKeShi(@Param("dept") String dept);
- @Select("select role_id from dj_user_role where user_code = #{code}")
- List<Integer> huoQuJueSe(@Param("code") String code);
- @Select("select code,rtrim(name) name from zd_unit_code where code not like '8%'")
- List<GetDropdownBox> getDpet();
- @Select("select code,rtrim(name) name from zd_unit_code where code like '8%'")
- List<GetDropdownBox> getWard();
- @Select("SELECT small_dept code,name=(select name from zd_unit_code where code = small_dept) FROM zd_dept_all where dept = #{dept}")
- List<GetDropdownBox> getBingQuDuiYingKeShi(@Param("dept") String dept);
- @Select("select count(*) from zy_actpatient where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}")
- Integer getHuanZheSFZaiYuan(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes);
- @Select("select case settle_type when '1' then '0' else settle_type end as settle_type from zy_ledger_file where " +
- "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
- "and ledger_sn = (select max(ledger_sn)ledger_sn from zy_ledger_file where zy_ledger_file.inpatient_no = #{inpatientNo} " +
- "and zy_ledger_file.admiss_times = #{admissTimes}) ")
- Integer getHuanZheSFJieSuan(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes);
- @Select("select detail_sn,ori_detail_sn,trans_flag_yb from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and detail_sn = #{detailSn} and order_no <> 6 and trans_flag_yb <> 2 ")
- ZyDetailCharge beiTuiFeiYongXinXi(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("detailSn") Integer detailSn);
- @Select("<script>" +
- "select code from yp_zd_dict where code in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- " #{item}" +
- "</foreach> " +
- " and serial = '01' and isnull(del_flag,0) = 1 " +
- "union all " +
- "select code from zd_charge_item where code in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- " #{item}" +
- "</foreach> " +
- " and isnull(del_flag,0) = 1" +
- "</script>")
- List<String> chaXunFeiYongShiFouTingYong(List<String> bianMa);
- @Select("<script>" +
- "select charge_code from yp_base_yf where stock_amount <= 0 and serial = '01' and charge_code in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- " #{item}" +
- "</foreach> " +
- "</script>")
- List<String> kuCun(List<String> bianMa);
- @Delete("delete zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and detail_sn = #{detailSn} and order_no <> 6 and trans_flag_yb <> 2")
- void cheXiaoFeiYong(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("detailSn") Integer detailSn);
- @Update("update zy_detail_charge set ori_detail_sn = null where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and detail_sn = #{detailSn} and order_no <> 6 and trans_flag_yb <> 2")
- void cheXiaoHouHuanYuanZhenShuJu(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("detailSn") Integer detailSn);
- @Select("select act_order_no as order_no,exec_unit from yz_erase_order where act_order_no in " +
- "(select order_no from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and exec_unit is null AND charge_fee < 0 and ori_detail_sn is null)")
- List<ZyDetailCharge> huoQuYaoPingZhongKeShiWeiKongDe(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger);
- @Update("<script>" +
- " <foreach collection='list' item='item' separator=';' >" +
- "update zy_detail_charge set exec_unit = #{item.execUnit} where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and order_no = #{item.orderNo} and exec_unit is null and charge_fee < 0" +
- "</foreach> " +
- "</script> ")
- void yiZhuTuiFeiGenXingZhiXingKeShi(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("list") List<ZyDetailCharge> genXingDeZhiXinKeShi);
- @Select("select b.code from zy_detail_charge a, yp_zd_dict b " +
- "where order_no <> 6 and trans_flag_yb not in (1,2) and charge_code like 'BILL%' " +
- " and isnull(b.national_code,'') = '' and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and a.infant_flag = #{infantFlag} " +
- " and a.charge_code_mx = b.code " +
- "group by b.code ")
- List<String> weiGuiYaoPinInt(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("infantFlag") Integer infantFlag);
- @Update("<script>" +
- "<foreach collection='list' item='item' separator=';'>" +
- "update yp_zd_dict set national_code = (select top(1) national_code from yp_zd_dict where code = #{item} and national_code is not null ) " +
- "where code = #{item} and national_code is null" +
- "</foreach>" +
- "</script>")
- void genXinYaoPingPiPeiXinXi(@Param("list") List<String> list);
- @Select("select a.charge_code_mx,case when (select top(1) rtrim(name) from zd_charge_item where code = a.charge_code_mx) != '' then " +
- "(select top(1) rtrim(name) from zd_charge_item where code = a.charge_code_mx) else " +
- "(select top(1) rtrim(name) from yp_zd_dict where code = a.charge_code_mx) end as name " +
- "from zy_detail_charge a left join zd_charge_item_hnsgs b " +
- "on (a.charge_code_mx = b.hosp_code) where " +
- "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} and infant_flag = #{infantFlag} and ori_detail_sn is null and isnull(b.hnsyb_item_code,'') = '' " +
- "group by a.charge_code_mx ")
- List<WeiGuiFeiYongFenXi> gongShangWeiPiPei(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("infantFlag") Integer infantFlag);
- /**
- * 违规药品 信息 没有匹配的
- *
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- * @param ledger 账页号
- * @return 返回违规药品 没有匹配的
- */
- @Select("select charge_code_mx,b.name from zy_detail_charge a, yp_zd_dict b " +
- "where trans_flag_yb not in (1,2) and charge_code like 'BILL%' " +
- " and isnull(b.national_code,'') = '' and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- "and a.infant_flag = #{infantFlag} " +
- " and a.charge_code_mx = b.code " +
- "group by charge_code_mx, b.name")
- List<WeiGuiFeiYongFenXi> weiGuiYaoPin(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("infantFlag") Integer infantFlag);
- @Select("select charge_code_mx,b.name from zy_detail_charge a, zd_charge_item b " +
- "where trans_flag_yb not in (1,2) and charge_code not like 'BILL%' " +
- " and isnull(b.national_code,'') = '' and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} " +
- " and a.infant_flag = #{infantFlag} " +
- " and a.charge_code_mx = b.code " +
- "group by charge_code_mx, b.name")
- List<WeiGuiFeiYongFenXi> weiGuiXiangMu(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("infantFlag") Integer infantFlag);
- @Select("<script>" +
- "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,ori_detail_sn,order_no,charge_fee,charge_amount, " +
- " exec_unit_name = (select rtrim(name) name from zd_unit_code where exec_unit = code),charge_date,trans_flag_yb, exec_unit, " +
- " op_id_code = (select rtrim(name) name from a_employee_mi where code = op_id_code)," +
- " charge_code_name = (select rtrim(name) name from zd_charge_item where code = charge_code_mx),charge_code = 'xm' from zy_detail_charge " +
- "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} and infant_flag = #{infantFlag} " +
- " and charge_fee < 0 and charge_code not like 'BILL%' " +
- " and trans_flag_yb not in (1,2) " +
- " and ori_detail_sn is null " +
- "<if test=\"chuYuanYiZhu == 0\">" +
- " and CONVERT(varchar(100), charge_date, 23) <= CONVERT(varchar(100), GETDATE(), 23)" +
- "</if>" +
- "<if test=\"list.size >0 \">" +
- " and exec_unit in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item}" +
- "</foreach>" +
- "</if>" +
- "</script>")
- List<ZyDetailCharge> weiXieDaiYuanLiuShuiXiangMu(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("infantFlag") Integer infantFlag,
- @Param("list") List<String> execUnit,
- @Param("chuYuanYiZhu") Integer chuYuanYiZhu);
- @Select("<script>" +
- "select rtrim(inpatient_no) inpatient_no,admiss_times,ledger_sn,charge_code_mx,detail_sn,order_no,ori_detail_sn,charge_fee,charge_amount, " +
- " exec_unit_name = (select rtrim(name) name from zd_unit_code where exec_unit = code),charge_date,trans_flag_yb,exec_unit, " +
- " op_id_code = (select rtrim(name) name from a_employee_mi where code = op_id_code)," +
- " charge_code_name = (select top(1) rtrim(name) name from yp_zd_dict where code = charge_code_mx),charge_code = 'yp' from zy_detail_charge " +
- "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledger} and infant_flag = #{infantFlag} " +
- " and charge_fee < 0 and charge_code like 'BILL%' " +
- " and trans_flag_yb not in (1,2) " +
- " and ori_detail_sn is null" +
- "<if test=\"chuYuanYiZhu == 0\">" +
- " and CONVERT(varchar(100), charge_date, 23) <= CONVERT(varchar(100), GETDATE(), 23)" +
- "</if>" +
- "<if test=\"list.size > 0 \">" +
- " and exec_unit in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item}" +
- "</foreach>" +
- "</if>" +
- "</script>")
- List<ZyDetailCharge> weiXieDaiYuanLiuShuiYaoPing(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledger") Integer ledger,
- @Param("infantFlag") Integer infantFlag,
- @Param("list") List<String> execUnit,
- @Param("chuYuanYiZhu") Integer chuYuanYiZhu);
- @Select("<script>" +
- "select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_amount,charge_fee,order_no,charge_code_mx,charge_date,ori_detail_sn " +
- "from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} " +
- "<choose>" +
- "<when test=\"execUnit != null and execUnit != ''\">" +
- "and exec_unit = #{execUnit} " +
- "</when>" +
- "<otherwise>" +
- "and order_no = #{orderNo}" +
- "</otherwise>" +
- "</choose>" +
- "and trans_flag_yb <> 2 and order_no <> 6 and charge_fee > 0 and charge_amount > 0 " +
- "and infant_flag = #{infantFlag} " +
- "<if test=\"startTime != null and startTime != '' \">" +
- "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
- "</if>" +
- " order by charge_date ${riQiPaiXu}" +
- "</script>")
- List<ZyDetailCharge> weiGuiZhenShuPiPei(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("infantFlag") Integer infantFlag,
- @Param("chargeCodeMx") String chargeCodeMx,
- @Param("execUnit") String execUnit,
- @Param("orderNo") String orderNo,
- @Param("startTime") String startTime,
- @Param("endTime") String endTime,
- @Param("riQiPaiXu") String riQiPaiXu);
- @Select("select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,sum(charge_fee) yi_tui_fei from ( " +
- "select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,charge_fee " +
- "from zy_detail_charge where " +
- "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} " +
- "and exec_unit = #{execUnit} and trans_flag_yb <> 2 and order_no <> 6 and" +
- " detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and " +
- "ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx}" +
- " and charge_fee <0 and ori_detail_sn is not null) " +
- "union all " +
- "select inpatient_no,admiss_times,ledger_sn,ori_detail_sn,charge_code_mx,charge_fee " +
- "from zy_detail_charge where " +
- "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} " +
- "and exec_unit = #{execUnit} and trans_flag_yb <> 2 and order_no <> 6 and " +
- "ori_detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
- "and ledger_sn = #{ledgerSn} and charge_code_mx = #{chargeCodeMx} and charge_fee <0 and ori_detail_sn is not null) " +
- ") temp " +
- "group by inpatient_no, admiss_times, ledger_sn, detail_sn, charge_code_mx")
- List<ZyDetailCharge> tuiFeiYuEr1(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("chargeCodeMx") String chargeCodeMx,
- @Param("execUnit") String execUnit);
- @Select("<script>" +
- "select detail_sn,ori_detail_sn,order_no,charge_fee,charge_amount,charge_code_mx,charge_date, " +
- " exec_unit_name = (select rtrim(name) from zd_unit_code where code =exec_unit), " +
- " ward_code = (select rtrim(name) from zd_unit_code where code = ward_code) " +
- " from zy_detail_charge where " +
- " inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and infant_flag = #{infantFlag} " +
- "and charge_code_mx = #{chargeCodeMx} and trans_flag_yb <> 2 and order_no <> 6 " +
- "and charge_amount > 0 " +
- "<if test=\"startTime != null and startTime != '' \">" +
- "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
- "</if>" +
- "order by charge_date ${riQiPaiXu}" +
- "</script>")
- List<ZyDetailCharge> genJuBianMaChaZhaoZhenShuFeiYong(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("infantFlag") Integer infantFlag,
- @Param("chargeCodeMx") String chargeCodeMx,
- @Param("startTime") String startTime,
- @Param("endTime") String endTime,
- @Param("riQiPaiXu") String riQiPaiXu);
- @Select("<script>" +
- "select * from zy_detail_charge " +
- "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and infant_flag = #{infantFlag} and detail_sn in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item}" +
- "</foreach>" +
- " and charge_fee > 0 and charge_amount > 0 " +
- "</script>")
- List<ZyDetailCharge> piPeiXinXi(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("infantFlag") Integer infantFlag,
- @Param("list") int[] detailSnList);
- @Select("<script>" +
- "select inpatient_no,admiss_times,ledger_sn,ori_detail_sn,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 ori_detail_sn in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item} " +
- "</foreach>" +
- "and charge_fee < 0 and charge_amount < 0 " +
- "group by inpatient_no, admiss_times, ledger_sn, ori_detail_sn " +
- "</script>")
- List<ZyDetailCharge> tuiFeiYuEr2(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("infantFlag") Integer infantFlag,
- @Param("list") int[] detailSnList);
- @Select("select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_fee,charge_amount,ori_detail_sn,trans_flag_yb,exec_unit from zy_detail_charge " +
- "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn = #{detailSn} " +
- "and infant_flag = #{infantFlag} and charge_fee < 0 and charge_amount < 0 ")
- ZyDetailCharge piPeiXinXiFuShu(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("infantFlag") Integer infantFlag,
- @Param("detailSn") Integer detailSn);
- @Update("update zy_detail_charge set ori_detail_sn = #{oriDetailSn} where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and detail_sn = #{detailSn} ")
- void zhiYouYiGeJiuGenXingFuShuLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("detailSn") Integer detailSn,
- @Param("oriDetailSn") Integer oriDetailSn);
- @Update("update zy_detail_charge set yb_self_flag = 0 ${ew.customSqlSegment}")
- void xiuGaiZiFeiZhiYiBaoBiaoZhi(@Param(Constants.WRAPPER) Wrapper<?> wq);
- }
|