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; /** *

* 描述: 门急诊费用转入 *

* * @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 getSerialNo(@Param("tableName") String tableName, @Param("serialNo") Integer serialNo); /** * 分页获取这个病人是通过急门诊转入的费用 如果确实插入了数据但是没有看到 那就是他们没有维护好两个字典表 * * @param page 分页对象 * @param inpatientNo 住院号 * @return 返回 */ @Select(" ") List getZyJiMenZhenZhuangRuFeiYong(IPage page, @Param("inpatientNo") String inpatientNo, @Param("chargeCodeMX") String chargeCodeMX, @Param("admissTimes") String admissTimes); /** * 获取费用总和 * * @param inpatientNo 住院号 * @param chargeCodeMX 项目编码 * @return 返回费用 */ @Select("") List 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("") void insertInfoZyDetailCharge(@Param("info") ZyActpatient info, @Param("list") List 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 queryEntryName(@Param("pyCode") String pyCode); // 9498.58,-7498.58,420.00 }