123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- package thyyxxk.webserver.dao.his.yibao;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import org.apache.ibatis.annotations.*;
- import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
- import thyyxxk.webserver.entity.datamodify.MzChargeDetail;
- import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
- import thyyxxk.webserver.entity.yibao.ZyActpatient;
- import java.util.List;
- /**
- * <p>
- * 描述: 门急诊费用转入
- * </p>
- *
- * @author xc
- * @date 2021-05-25 17:35
- */
- @Mapper
- public interface TransferInOfExpensesDao {
- /**
- * 查询患者的基本信息
- *
- * @param inpatientNo 住院号
- * @return 返回一条信息
- */
- @Select("select rtrim(inpatient_no) inpatient_no,admiss_times,rtrim(zk_dept) zk_dept,ward,dept," +
- "rtrim(admiss_ward) wardCode," +
- "rtrim(small_dept) deptCode,zy_serial_no, " +
- "rtrim(isnull(operation, '')) as operation, " +
- "rtrim(refer_physician) refer_physician, " +
- "rtrim(consult_physician) consult_physician,zk_ward, " +
- "ledgerSn=(select max(ledger_sn) from zy_ledger_file " +
- "where inpatient_no=a.inpatient_no and admiss_times=a.admiss_times), " +
- "maxDetailSn=(select max(detail_sn) from zy_detail_charge " +
- "where inpatient_no=a.inpatient_no and admiss_times=a.admiss_times), " +
- "rtrim(a.name)name,sex,rtrim(bed_no)bed_no,(b.name) ward_name, " +
- "admiss_date,(c.name)responce_type_name,total_charge,balance " +
- "from zy_actpatient a left join zd_unit_code b on (a.ward = b.code) left join zy_zd_responce_type c on (a.responce_type = c.code) " +
- "where inpatient_no = #{inpatientNo}")
- ZyActpatient queryHuanZhe(String inpatientNo);
- /**
- * 根据机制号来查询门诊发票信息
- *
- * @param tableName 要查询的表格
- * @param serialNo 机制号
- * @return 返回多个
- */
- @Select("select " +
- " patient_name =rtrim(a.name), " +
- " item_name = c.name, " +
- " charge_amount = a.quantity, " +
- " self_flag=c.self_flag, " +
- " separate_flag = c.separate_flag, " +
- " suppress_flag = c.suppress_flag, " +
- " charge_code = a.charge_item_code, " +
- " charge_code_mx = a.charge_item_code, " +
- " serial = a.serial, " +
- " group_no = a.group_no, " +
- " price = a.unit_price, " +
- " charge_fee=a.unit_price * a.quantity * isnull(a.drug_win,1), " +
- " check_flag='0', " +
- " warn_dept =a.warn_dept, " +
- " doctor_code = a.doctor_code, " +
- " bill_item_code = rtrim(a.bill_item_code), " +
- " exec_dept = a.exec_dept " +
- "from ${tableName} a,mz_receipt_serial b,zd_charge_item c " +
- "where a.patient_id = b.patient_id and " +
- " a.times = b.times and " +
- " a.receipt_no = b.receipt_no and " +
- " a.serial_no= b.serial_no and " +
- " b.receipt_sn=#{serialNo} and " +
- " a.charge_item_code=c.code and " +
- " isnull(a.group_no,'00')='00' " +
- "union all " +
- "select patient_name =rtrim(a.name), " +
- " item_name = (select name from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial),/*c.drugname,*/ " +
- " charge_amount = a.quantity, " +
- " self_flag=a.self_flag, " +
- " separate_flag = (select separate_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
- " suppress_flag = (select suprice_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
- " charge_code = a.charge_item_code, " +
- " charge_code_mx = a.charge_item_code, " +
- " serial = a.serial, " +
- " group_no = a.group_no, " +
- " price = a.unit_price, " +
- " charge_fee=a.unit_price * a.quantity * isnull(a.drug_win,1), " +
- " check_flag='0', " +
- " warn_dept =a.warn_dept, " +
- " doctor_code = a.doctor_code, " +
- " bill_item_code = rtrim(a.bill_item_code), " +
- " exec_dept = a.exec_dept " +
- "from ${tableName} a,mz_receipt_serial b,yp_base_yf c " +
- "where a.patient_id = b.patient_id and " +
- " a.times = b.times and " +
- " a.receipt_no = b.receipt_no and " +
- " a.serial_no= b.serial_no and " +
- " b.receipt_sn=#{serialNo} and " +
- " a.charge_item_code=c.charge_code and " +
- " a.serial = c.serial and " +
- " a.group_no = c.group_no and " +
- " isnull(a.group_no,'00')<>'00'")
- List<MzChargeDetail> getSerialNo(@Param("tableName") String tableName,
- @Param("serialNo") Integer serialNo);
- /**
- * 分页获取这个病人是通过急门诊转入的费用 如果确实插入了数据但是没有看到 那就是他们没有维护好两个字典表
- *
- * @param page 分页对象
- * @param inpatientNo 住院号
- * @return 返回
- */
- @Select("<script>" +
- "select * from (" +
- "select rtrim(inpatient_no)inpatient_no,admiss_times,detail_sn,ledger_sn, " +
- "charge_date,charge_code,charge_fee,a.charge_amount,charge_code_mx,(b.name)charge_code_name,gen_time, " +
- "zy_serial_no " +
- "from zy_detail_charge a,zd_charge_item b where (code =charge_code) and order_no=6 and inpatient_no = #{inpatientNo} " +
- "and admiss_times = #{admissTimes} AND (a.charge_amount !< 0 or charge_code_mx = 'BILL99') " +
- "<if test=\"chargeCodeMX!=null and chargeCodeMX!=''\"> " +
- "and (charge_code_mx = #{chargeCodeMX} or charge_code = #{chargeCodeMX}) " +
- "</if> " +
- "union " +
- "select rtrim(inpatient_no)inpatient_no,admiss_times,detail_sn,ledger_sn, " +
- "charge_date,charge_code,charge_fee,a.charge_amount,charge_code_mx,(b.name)charge_code_name,gen_time, " +
- "zy_serial_no " +
- "from zy_detail_charge a,yp_zd_dict b where (code=charge_code) and order_no=6 and inpatient_no = #{inpatientNo} " +
- "and admiss_times = #{admissTimes} AND (a.charge_amount !< 0 or charge_code_mx = 'BILL99') " +
- "<if test=\"chargeCodeMX!=null and chargeCodeMX!=''\"> " +
- "and (charge_code_mx = #{chargeCodeMX} or charge_code = #{chargeCodeMX}) " +
- "</if>" +
- ") temp" +
- "</script> ")
- List<ZyDetailCharge> getZyJiMenZhenZhuangRuFeiYong(IPage<ZyDetailCharge> page,
- @Param("inpatientNo") String inpatientNo,
- @Param("chargeCodeMX") String chargeCodeMX,
- @Param("admissTimes") String admissTimes);
- /**
- * 获取费用总和
- *
- * @param inpatientNo 住院号
- * @param chargeCodeMX 项目编码
- * @return 返回费用
- */
- @Select("<script>" +
- "select charge_fee,charge_amount,charge_code " +
- "from zy_detail_charge a where order_no=6 and inpatient_no = #{inpatientNo} " +
- "and admiss_times = #{admissTimes} " +
- "<if test=\"chargeCodeMX!=null and chargeCodeMX!=''\"> " +
- "and (charge_code_mx = #{chargeCodeMX} or charge_code = #{chargeCodeMX}) " +
- "</if> " +
- "</script>")
- List<ZyDetailCharge> sumZyFee(@Param("inpatientNo") String inpatientNo,
- @Param("chargeCodeMX") String chargeCodeMX,
- @Param("admissTimes") String admissTimes);
- /**
- * 删除病人通过急门诊转入的费用 数据
- *
- * @param param 删除的条件
- */
- @Delete("delete from zy_detail_charge where inpatient_no=#{inpatientNo} and " +
- "admiss_times =#{admissTimes} and ledger_sn=#{ledgerSn} and detail_sn=#{detailSn}")
- void shanChuFeiYong(ZyDetailCharge param);
- /**
- * 插入数据 急门诊数据转入住院费用
- * 这上面的数据都是在前面查询找到的
- *
- * @param info 住院患者的信息
- * @param zyFees 费用 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_amount,charge_fee,ward_code,dept_code,order_no,ope_flag, " +
- "gen_time,charge_code_mx,serial,doctor_code,trans_flag_yb,refer_physician,consult_physician,exec_unit,zy_serial_no) VALUES " +
- "<foreach collection='list' item='fee' separator=',' open='' close=''>" +
- "(#{info.inpatientNo}, #{info.admissTimes}, #{info.ledgerSn}, #{fee.detailSn}, getDate(), #{info.staffId}, " +
- "#{fee.chargeCode}, 0, 2, #{fee.chargeAmount}, cast(#{fee.chargeFee,jdbcType=DECIMAL} as decimal(14,5)), #{info.ward}, #{info.dept}, 6, " +
- "'',getDate(), #{fee.chargeCodeMx},#{fee.serial},#{fee.doctorCode},0,#{info.referPhysician}," +
- "#{info.consultPhysician},#{info.reqExecUnit},#{info.zySerialNo})" +
- "</foreach>" +
- "</script>")
- void insertInfoZyDetailCharge(@Param("info") ZyActpatient info,
- @Param("list") List<MzChargeDetail> zyFees);
- /**
- * 查询出这个患者的最大流水号,在新增费用的时候要加一
- *
- * @param inpatientNo 住院号
- * @param admissTimes 住院次数
- * @return 返回最大的流水号
- */
- @Select("select isnull(max(detail_sn),0) from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
- Integer getMaxDetailSn(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes);
- /**
- * 远程搜索 项目名称
- *
- * @param pyCode 拼音码 大写的
- * @return 返回多个项目的名称
- */
- @Select("select * from (" +
- "select code,rtrim(name)name from zd_charge_item where py_code like #{pyCode} " +
- "union " +
- "select code,rtrim(name)name from yp_zd_dict where py_code like #{pyCode}" +
- ") temp")
- List<GetDropdownBox> queryEntryName(@Param("pyCode") String pyCode);
- // 9498.58,-7498.58,420.00
- }
|