|
@@ -1,5 +1,6 @@
|
|
|
package thyyxxk.webserver.dao.his.yibao;
|
|
|
|
|
|
+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;
|
|
@@ -7,7 +8,6 @@ import org.apache.ibatis.annotations.Update;
|
|
|
import thyyxxk.webserver.pojo.yibao.patient.FeePojo;
|
|
|
|
|
|
import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
|
|
|
@Mapper
|
|
|
public interface Routines {
|
|
@@ -19,23 +19,218 @@ public interface Routines {
|
|
|
@Update("EXEC zy_calc_balance #{zyh}, #{times}, #{ledgerSn}")
|
|
|
void hisRecount(@Param("zyh") String zyh, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
- @Select("exec p_syb_xmlist #{inpatientNo}, #{admissTimes}")
|
|
|
- List<FeePojo> getSybProjectFee(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
|
|
|
+ @Select("select * from (" +
|
|
|
+ "select a.detail_sn,a.charge_date,a.charge_code_mx as his_item_code, " +
|
|
|
+ "d.hnsyb_item_code as yb_code,a.charge_fee,price=b.charge_amount,a.charge_amount, " +
|
|
|
+ "b.name as his_item_name,c.hnsyb_stat_type, " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0) " +
|
|
|
+ "from zd_charge_item b,zy_bill_item c,zy_detail_charge a with (nolock) " +
|
|
|
+ "left join (select distinct * from zd_charge_item_hnsyb) d on a.charge_code_mx=d.hosp_code " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_code_mx=b.code and a.charge_status>1 and a.infant_flag=0 and b.bill_item_zy=c.code and " +
|
|
|
+ "(a.charge_code<>'BILL01' and a.charge_code<>'BILL05') and isnull(a.trans_flag_yb,'0')='0' " +
|
|
|
+ "union " +
|
|
|
+ "select a.detail_sn,a.charge_date,a.charge_code_mx as his_item_code, " +
|
|
|
+ "d.hnsyb_item_code as yb_code,a.charge_fee,price=b.charge_amount,a.charge_amount, " +
|
|
|
+ "b.name as his_item_name,c.hnsyb_stat_type, " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0) " +
|
|
|
+ "from zd_charge_item b,zy_bill_item c,zy_detail_charge a with (nolock) " +
|
|
|
+ "left join (select distinct * from zd_charge_item_hnsyb) d on a.charge_code_mx=d.hosp_code " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_code_mx=b.code and a.charge_status>1 and a.infant_flag=0 and isnull(a.serial,'00')='00' and " +
|
|
|
+ "b.bill_item_zy=c.code and (a.charge_code='BILL01' or a.charge_code='BILL05') and a.order_no<5 and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0'" +
|
|
|
+ ") temp")
|
|
|
+ IPage<FeePojo> selectHnsybGsProjectFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
- @Select("exec p_hnsyb_xmlist #{inpatientNo}, #{admissTimes}")
|
|
|
- List<FeePojo> getHnsybProjectFee(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
|
|
|
+ @Select("select * from (" +
|
|
|
+ "select a.detail_sn,a.charge_date,a.charge_code_mx as his_item_code, " +
|
|
|
+ "d.hnsyb_item_code as yb_code,a.charge_fee,price=b.charge_amount,a.charge_amount, " +
|
|
|
+ "b.name as his_item_name,c.hnsyb_stat_type,yb_self_flag=isnull(a.yb_self_flag,0) " +
|
|
|
+ "from zy_detail_charge a with (nolock),zd_charge_item b,zy_bill_item c,(select distinct * from zd_charge_item_hnsyb) d " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_code_mx=b.code and a.charge_status>1 and a.infant_flag=0 and b.bill_item_zy=c.code and " +
|
|
|
+ "a.charge_code_mx*=d.hosp_code and (a.charge_code<>'BILL01' and a.charge_code<>'BILL05') and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0' " +
|
|
|
+ "union " +
|
|
|
+ "select a.detail_sn,a.charge_date,a.charge_code_mx as his_item_code, " +
|
|
|
+ "d.hnsyb_item_code as yb_code,a.charge_fee,price=b.charge_amount,a.charge_amount, " +
|
|
|
+ "b.name as his_item_name,c.hnsyb_stat_type,yb_self_flag=isnull(a.yb_self_flag,0) " +
|
|
|
+ "from zy_detail_charge a with (nolock),zd_charge_item b,zy_bill_item c,(select distinct * from zd_charge_item_hnsyb) d " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_code_mx=b.code and a.charge_status>1 and a.infant_flag=0 and isnull(a.serial,'00')='00' and " +
|
|
|
+ "b.bill_item_zy=c.code and a.charge_code_mx*=d.hosp_code and " +
|
|
|
+ "(a.charge_code='BILL01' or a.charge_code='BILL05') and a.order_no<5 and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0'" +
|
|
|
+ ") temp")
|
|
|
+ IPage<FeePojo> selectHnsybProjectFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
- @Select("exec p_xnh_xmlist #{inpatientNo}, #{admissTimes}")
|
|
|
- List<FeePojo> getXnhProjectFee(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
|
|
|
+ @Select("select a.detail_sn,a.charge_date,a.charge_code_mx as his_item_code, " +
|
|
|
+ "g.hnsyb_item_code as yb_code, " +
|
|
|
+ "medi_item_type=(select yp_type from yp_zd_drug_kind where code=b.drug_kind), " +
|
|
|
+ "b.name as his_item_name,b.retprice as price, " +
|
|
|
+ "a.charge_amount,a.charge_fee,f.hnsyb_stat_type, " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0) " +
|
|
|
+ "from yp_zd_dict b left join yp_zd_dosage c on b.dosage=c.code " +
|
|
|
+ "left join yp_zd_manufactory d on b.manu_code=d.code, " +
|
|
|
+ "zy_bill_item f,zy_detail_charge a with (nolock) " +
|
|
|
+ "left join (select distinct * from zd_charge_item_hnsyb) g " +
|
|
|
+ "on a.charge_code_mx=g.hosp_code " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and " +
|
|
|
+ "a.ledger_sn=#{ledgerSn} and a.charge_status>1 and " +
|
|
|
+ "isnull(a.serial,'00')<>'00' and a.charge_code_mx=b.code and " +
|
|
|
+ "a.serial=b.serial and a.infant_flag=0 and " +
|
|
|
+ "b.bill_item_zy=f.code and isnull(a.trans_flag_yb,'0')='0'")
|
|
|
+ IPage<FeePojo> selectHnsybGsMedicineFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
- @Select("exec p_syb_yplist #{inpatientNo}, #{admissTimes}")
|
|
|
- List<FeePojo> getSybMedicineFee(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
|
|
|
+ @Select("select a.detail_sn,a.charge_date,a.charge_code_mx as his_item_code, " +
|
|
|
+ "g.hnsyb_item_code as yb_code, " +
|
|
|
+ "medi_item_type=(select yp_type from yp_zd_drug_kind where code=b.drug_kind), " +
|
|
|
+ "b.name as his_item_name,b.retprice as price, " +
|
|
|
+ "a.charge_amount,a.charge_fee,f.hnsyb_stat_type,yb_self_flag=isnull(a.yb_self_flag,0) " +
|
|
|
+ "from yp_zd_dict b left join yp_zd_dosage c on b.dosage=c.code " +
|
|
|
+ "left join yp_zd_manufactory d on b.manu_code=d.code, " +
|
|
|
+ "zy_bill_item f,zy_detail_charge a with (nolock) " +
|
|
|
+ "left join (select distinct * from zd_charge_item_hnsyb) g on a.charge_code_mx=g.hosp_code " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_status>1 and isnull(a.serial,'00')<>'00' and a.charge_code_mx=b.code and " +
|
|
|
+ "a.serial=b.serial and a.infant_flag=0 and b.bill_item_zy=f.code and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0'")
|
|
|
+ IPage<FeePojo> selectHnsybMedicineFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
- @Select("exec p_hnsyb_yplist #{inpatientNo}, #{admissTimes}")
|
|
|
- List<FeePojo> getHnsybMedicineFee(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
|
|
|
+ @Select("select * from (" +
|
|
|
+ "select a.detail_sn,charge_date,his_item_code=b.code,charge_fee=sum(a.charge_fee), " +
|
|
|
+ "his_item_name=max(c.his_name),price=max(b.charge_amount), " +
|
|
|
+ "yb_bill_code=isnull(max(c.yb_bill_code),''),yb_code=isnull(max(c.yb_code),''), " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0),yb_class=isnull(max(c.yb_class),''), " +
|
|
|
+ "charge_amount=cast(sum(isnull(a.charge_amount,1)) as real ) " +
|
|
|
+ "from zy_detail_charge a,zd_charge_item b, " +
|
|
|
+ "(select charge_code=his_code,max(his_name) his_name, " +
|
|
|
+ "yb_code=max(yb_code),yb_bill_code=max(charge_type),yb_class=max(charge_category),max(audit_date) sh_date " +
|
|
|
+ "from zd_cssyb_xmdz group by his_code) c " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_code=b.code and a.charge_status>1 and " +
|
|
|
+ "(case when isnull(a.serial,'')='' or isnull(a.serial,'')='00' then '00' else a.serial end)='00' and " +
|
|
|
+ "b.code*=c.charge_code and isnull(a.trans_flag_yb,'0')='0' and isnull(a.infant_flag,'0')='0' and " +
|
|
|
+ "charge_date<'2018-09-01' " +
|
|
|
+ "group by a.inpatient_no,a.admiss_times,a.ledger_sn,detail_sn,a.charge_date, " +
|
|
|
+ "b.code,isnull(trans_flag_yb,''),yb_self_flag " +
|
|
|
+ "union all " +
|
|
|
+ "select detail_sn=a.detail_sn,charge_date,his_item_code=b.code,charge_fee=sum(a.charge_fee), " +
|
|
|
+ "his_item_name=max(c.his_name),price=max(b.charge_amount), " +
|
|
|
+ "yb_bill_code=isnull(max(c.yb_bill_code),''),yb_code=isnull(max(c.yb_code),''), " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0),yb_class=isnull(max(c.yb_class),''), " +
|
|
|
+ "charge_amount=cast(sum(isnull(a.charge_amount,1)) as real ) " +
|
|
|
+ "from zy_detail_charge a,zd_charge_item b, " +
|
|
|
+ "(select charge_code=his_code,max(his_name) his_name, " +
|
|
|
+ "yb_code=max(yb_code),yb_bill_code=max(charge_type),yb_class=max(charge_category),max(audit_date) sh_date " +
|
|
|
+ "from zd_cssyb_xmdz group by his_code) c " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and a.ledger_sn=#{ledgerSn} and " +
|
|
|
+ "a.charge_code=b.code and a.charge_status>1 and " +
|
|
|
+ "(case when isnull(a.serial,'')='' or isnull(a.serial,'')='00' then '00' else a.serial end)='00' and " +
|
|
|
+ "b.code*=c.charge_code and isnull(a.trans_flag_yb,'0')='0' and isnull(a.infant_flag,'0')='0' and " +
|
|
|
+ "charge_date>='2018-09-01' " +
|
|
|
+ "group by a.inpatient_no,a.admiss_times,a.ledger_sn,detail_sn,a.charge_date, " +
|
|
|
+ "b.code,isnull(trans_flag_yb,''),yb_self_flag" +
|
|
|
+ ") temp")
|
|
|
+ IPage<FeePojo> selectCssybProjectFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
- @Select("exec p_xnh_yplist #{inpatientNo}, #{admissTimes}")
|
|
|
- List<FeePojo> getXnhMedicineFee(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
|
|
|
+ @Select("select * from (" +
|
|
|
+ "select detail_sn=a.detail_sn,charge_date, " +
|
|
|
+ "his_item_code=case b.code when '00983' then '30033' else b.code end, " +
|
|
|
+ "price=max(b.pack_retprice),charge_fee=sum(a.charge_fee), " +
|
|
|
+ "charge_amount=cast (sum(a.charge_amount) as real),his_item_name=max(b.name ) , " +
|
|
|
+ "yb_bill_code=isnull(max(c.yb_bill_code),''),yb_code=isnull(max(c.yb_code),''), " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0),yb_class=isnull(max(c.yb_class),'') " +
|
|
|
+ "from zy_detail_charge a,yp_zd_dict b, " +
|
|
|
+ "(select charge_code=his_code,yb_name=max(his_name), " +
|
|
|
+ "yb_code=max(yb_code),yb_bill_code=max(charge_type), " +
|
|
|
+ "yb_class=max(charge_category),max(audit_date) sh_date " +
|
|
|
+ "from zd_cssyb_xmdz group by his_code) c " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and " +
|
|
|
+ "a.ledger_sn=#{ledgerSn} and a.charge_status>'1' and " +
|
|
|
+ "a.charge_code_mx=b.code and a.serial=b.serial and " +
|
|
|
+ "a.charge_code_mx *=c.charge_code and isnull(a.serial,'')<>'00' and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0' and isnull(c.yb_code,'')<>'' " +
|
|
|
+ "and isnull(a.infant_flag,'0')='0' and charge_date<'2018-09-01' " +
|
|
|
+ "group by a.inpatient_no,a.admiss_times,a.ledger_sn,detail_sn,charge_date, " +
|
|
|
+ "b.code,b.specification,trans_flag_yb,yb_self_flag " +
|
|
|
+ "union all " +
|
|
|
+ "select detail_sn=a.detail_sn,charge_date, " +
|
|
|
+ "his_item_code=case b.code when '00983' then '30033' else b.code end, " +
|
|
|
+ "price=max(b.pack_retprice),charge_fee=sum(a.charge_fee), " +
|
|
|
+ "charge_amount=cast (sum(a.charge_amount) as real),his_item_name=max(b.name ) , " +
|
|
|
+ "yb_bill_code=isnull(max(c.yb_bill_code),''),yb_code=isnull(max(c.yb_code),''), " +
|
|
|
+ "yb_self_flag=isnull(a.yb_self_flag,0),yb_class=isnull(max(c.yb_class),'') " +
|
|
|
+ "from zy_detail_charge a,yp_zd_dict b, " +
|
|
|
+ "(select charge_code=his_code,max(his_name) yb_name, " +
|
|
|
+ "yb_code=max(yb_code),yb_bill_code=max(charge_type),yb_class=max(charge_category),max(audit_date) sh_date " +
|
|
|
+ "from zd_cssyb_xmdz group by his_code) c " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and " +
|
|
|
+ "a.ledger_sn=#{ledgerSn} and a.charge_status>'1' and " +
|
|
|
+ "a.charge_code_mx=b.code and a.serial=b.serial and " +
|
|
|
+ "a.charge_code_mx *=c.charge_code and isnull(a.serial,'')<>'00' and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0' and isnull(c.yb_code,'')<>'' " +
|
|
|
+ "and isnull(a.infant_flag,'0')='0' and charge_date>='2018-09-01' " +
|
|
|
+ "group by a.inpatient_no,a.admiss_times,a.ledger_sn,detail_sn,charge_date, " +
|
|
|
+ "b.code,b.specification,trans_flag_yb,yb_self_flag" +
|
|
|
+ ") temp")
|
|
|
+ IPage<FeePojo> selectCssybMedicineFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
+
|
|
|
+ @Select("select a.detail_sn,charge_date,his_item_code=b.code, " +
|
|
|
+ "charge_fee=sum(a.charge_fee),his_item_name=max(b.name), " +
|
|
|
+ "yb_name=isnull(max(c.hnsyb_item_name ),b.xnh_name), " +
|
|
|
+ "price=max(b.charge_amount), " +
|
|
|
+ "yb_code=isnull(max(c.hnsyb_item_code),b.xnh_code), " +
|
|
|
+ "charge_amount=sum(isnull(a.charge_amount,1)) " +
|
|
|
+ "from zy_detail_charge a left join zd_charge_item_hnsyb c on a.charge_code=c.hosp_code,zd_charge_item b " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and " +
|
|
|
+ "a.ledger_sn=#{ledgerSn} and a.charge_code=b.code and " +
|
|
|
+ "a.charge_status>1 and " +
|
|
|
+ "(case when isnull(a.serial,'')='' then '00' else a.serial end)='00' and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0' " +
|
|
|
+ "group by a.inpatient_no,a.admiss_times,a.ledger_sn,detail_sn,charge_date,b.code, " +
|
|
|
+ "isnull(trans_flag_yb,''),c.hnsyb_item_name,c.hosp_code,b.xnh_name,b.xnh_code")
|
|
|
+ IPage<FeePojo> selectXnhybProjectFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
+
|
|
|
+ @Select("select a.detail_sn,charge_date,his_item_code=b.code, " +
|
|
|
+ "charge_fee=sum(a.charge_fee),his_item_name=max(b.name ), " +
|
|
|
+ "yb_name=isnull(max(c.hnsyb_item_name ),b.xnh_name), " +
|
|
|
+ "price=max(b.pack_retprice), " +
|
|
|
+ "yb_code=isnull(max(c.hnsyb_item_code),b.xnh_code), " +
|
|
|
+ "charge_amount=sum(a.charge_amount) " +
|
|
|
+ "from zy_detail_charge a left join zd_charge_item_hnsyb c on a.charge_code_mx=c.hosp_code,yp_zd_dict b " +
|
|
|
+ "where a.inpatient_no=#{inpatientNo} and a.admiss_times=#{admissTimes} and " +
|
|
|
+ "a.ledger_sn=#{ledgerSn} and a.charge_status>'1' and " +
|
|
|
+ "a.charge_code_mx=b.code and a.serial=b.serial and " +
|
|
|
+ "isnull(a.trans_flag_yb,'0')='0' " +
|
|
|
+ "group by a.inpatient_no,a.admiss_times,a.ledger_sn,detail_sn,charge_date,b.code, " +
|
|
|
+ "b.specification,trans_flag_yb,c.hnsyb_item_code,c.hnsyb_item_name,b.xnh_name,b.xnh_code")
|
|
|
+ IPage<FeePojo> selectXnhybMedicineFee(IPage<FeePojo> iPage,
|
|
|
+ @Param("inpatientNo") String inpatientNo,
|
|
|
+ @Param("admissTimes") Integer admissTimes,
|
|
|
+ @Param("ledgerSn") Integer ledgerSn);
|
|
|
|
|
|
@Update("update zy_actpatient set yb_register_date=#{date} where inpatient_no=#{inpatientNo}")
|
|
|
void updateYbRegisterDate(@Param("inpatientNo") String inpatientNo, @Param("date") Date date);
|