SelfpayDao.java 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package thyyxxk.sizyfeeoprnsystm.dao;
  2. import org.apache.ibatis.annotations.Mapper;
  3. import org.apache.ibatis.annotations.Param;
  4. import org.apache.ibatis.annotations.Select;
  5. import org.apache.ibatis.annotations.Update;
  6. import thyyxxk.sizyfeeoprnsystm.pojo.FeeCounteract;
  7. import thyyxxk.sizyfeeoprnsystm.pojo.selfpay.BriefLedgerFile;
  8. import thyyxxk.sizyfeeoprnsystm.pojo.selfpay.FmiOwnpayPatnDise;
  9. import thyyxxk.sizyfeeoprnsystm.pojo.selfpay.FmiOwnpayPatnFee;
  10. import thyyxxk.sizyfeeoprnsystm.pojo.selfpay.FmiOwnpayPatnMdtrt;
  11. import java.math.BigDecimal;
  12. import java.util.LinkedList;
  13. import java.util.List;
  14. @Mapper
  15. public interface SelfpayDao {
  16. @Update("update zy_ledger_file set selfpay_uploaded=0 where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn};" +
  17. "update zy_detail_charge set trans_flag_yb=0 where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} " +
  18. "and trans_flag_yb!=2")
  19. void resetSelfUploadStatus(BriefLedgerFile ledgerFile);
  20. @Select("select psnCertType='01',certno=b.social_no,psnName=rtrim(a.name),begntime=a.admiss_date,endtime=a.dis_date, " +
  21. "medType=isnull(a.med_type,'2101'),iptOpNo=rtrim(b.inpatient_no),inhospStas='0',valiFlag='1' from ${table} a, " +
  22. "a_patient_mi b where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.inpatient_no=b.inpatient_no")
  23. FmiOwnpayPatnMdtrt selectPatnMdtrt(@Param("table") String table,
  24. @Param("patNo") String patNo,
  25. @Param("times") int times);
  26. @Select("select inoutDiagType='2',diagType='1',maindiagFlag='1',diagSrtNo=1, " +
  27. "diagCode=rtrim(dis_diag),diagName=rtrim(dis_diag_comment) " +
  28. "from ba_first_page1 where inpatient_no=#{patNo} and admiss_times=#{times} and dis_diag_no=1")
  29. FmiOwnpayPatnDise selectPatnDise(@Param("patNo") String patNo,
  30. @Param("times") int times);
  31. @Select("select bkkpSn=detail_sn,feeOcurTime=charge_date,valiFlag='1',fixmedinsName='长沙泰和医院', medinsListCodg=rtrim(charge_code_mx)," +
  32. "cnt=charge_amount,pric=charge_fee/charge_amount,detItemFeeSumamt=charge_fee, fixmedinsCode='H43010500370', " +
  33. "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
  34. "medinsListName=isnull((select top 1 name from yp_zd_dict where code=charge_code_mx),(select name from zd_charge_item where code=charge_code_mx)) " +
  35. "from zy_detail_charge where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0)=0")
  36. LinkedList<FmiOwnpayPatnFee> selectOwnpayFees(BriefLedgerFile ledgerFile);
  37. @Select("select sum(charge_fee) from zy_detail_charge where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  38. BigDecimal selectSumFee(BriefLedgerFile ledgerFile);
  39. @Select("select social_no from a_patient_mi where inpatient_no=#{patNo}")
  40. String selectSocialNo(@Param("patNo") String patNo);
  41. @Update("<script>" +
  42. "update zy_detail_charge set trans_flag_yb=1 where inpatient_no=#{patNo} and " +
  43. "admiss_times=#{times} and detail_sn in " +
  44. "<foreach collection='fees' item='fee' separator=',' open='(' close=')'>" +
  45. "#{fee.bkkpSn}</foreach>" +
  46. "</script>")
  47. void updateTransFlag(@Param("patNo") String patNo,
  48. @Param("times") int times,
  49. @Param("fees") List<FmiOwnpayPatnFee> fees);
  50. @Select("select charge_amount,charge_fee,detail_sn,ori_detail_sn from zy_detail_charge " +
  51. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} " +
  52. "and isnull(infant_flag,0)!=1 and isnull(trans_flag_yb,0) not in (1,2) " +
  53. "and isnull(ori_detail_sn,-1)!=-1")
  54. List<FeeCounteract> selectNegativeFeesWithOriDetlSn(BriefLedgerFile ledgerFile);
  55. @Select("<script>" +
  56. "select charge_amount,charge_fee,detail_sn from zy_detail_charge " +
  57. "where inpatient_no=#{ledger.patNo} and admiss_times=#{ledger.times} and ledger_sn=#{ledger.ledgerSn} " +
  58. "and isnull(trans_flag_yb,0) not in (1,2) and detail_sn in " +
  59. "<foreach collection='list' item='detailSn' open='(' separator=',' close=')'>" +
  60. "#{detailSn}" +
  61. "</foreach>" +
  62. "</script>")
  63. List<FeeCounteract> selectPositiveFeesByDetlSn(@Param("ledger") BriefLedgerFile ledgerFile,
  64. @Param("list") List<Integer> list);
  65. @Update("update zy_detail_charge set trans_flag_yb=2 where inpatient_no=#{patNo} and " +
  66. "admiss_times=#{times} and detail_sn in (#{sn1}, #{sn2})")
  67. void updateYbTransFlagInPair(@Param("patNo") String patNo, @Param("times") Integer times,
  68. @Param("sn1") Integer sn1, @Param("sn2") Integer sn2);
  69. @Select("select rtrim(inpatient_no) as patNo,admiss_times as times,ledger_sn " +
  70. "from zy_ledger_file where ledger_sn>0 and account_date is not null and selfpay_uploaded in (0,2) " +
  71. "and isnull(responce_type,'01')='01' and account_date>='2022-01-01 00:00:00.000'")
  72. List<BriefLedgerFile> selectBriefLedgerFile();
  73. @Update("update zy_ledger_file set selfpay_uploaded=#{selfpayUploaded} where inpatient_no=#{patNo} " +
  74. "and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  75. void updateLedgerFileUploaded(BriefLedgerFile ledgerFile);
  76. }