SiSettleApplyDao.java 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package thyyxxk.webserver.dao.his.medicalinsurance;
  2. import org.apache.ibatis.annotations.*;
  3. import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiSettleApply;
  4. import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbSrgry;
  5. import java.util.Date;
  6. import java.util.List;
  7. /**
  8. * @author dj
  9. */
  10. @Mapper
  11. public interface SiSettleApplyDao {
  12. @Select("select mdtrt_id from t_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger}")
  13. String selectMdtrtId(@Param("patNo") String patNo,
  14. @Param("times") int times,
  15. @Param("ledger") int ledger);
  16. @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
  17. "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6' ")
  18. Date selectActOrderDisDate(@Param("table") String table, @Param("patNo") String patNo, @Param("times") Integer times);
  19. @Select("select status,handle_comment,type,settle_datetime,acct_used_flag,death_flag from t_si_settle_apply with(nolock) " +
  20. "where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger} and type=#{type}")
  21. SiSettleApply selectSettleApply(@Param("patNo") String patNo,
  22. @Param("times") int times,
  23. @Param("ledger") int ledger,
  24. @Param("type") int type);
  25. @Delete("delete from t_si_settle_apply where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledger} and type=#{type}")
  26. void deleteSettleApply(@Param("patNo") String patNo,
  27. @Param("times") int times,
  28. @Param("ledger") int ledger,
  29. @Param("type") int type);
  30. @Insert("insert into t_si_settle_apply (pat_no,times,ledger_sn,input_staff,input_comment,input_datetime,status,type," +
  31. "settle_datetime,settled,acct_used_flag,death_flag) values (#{patNo},#{times},#{ledgerSn},#{inputStaff}," +
  32. "#{inputComment},getdate(),0,#{type},#{settleDatetime},0,#{acctUsedFlag},#{deathFlag})")
  33. void insertSettleApply(SiSettleApply apply);
  34. @Select("select a.pat_no,a.times,a.ledger_sn,a.status,a.type,c.sex as gender,rtrim(c.name) as name,b.med_type, " +
  35. "wardName=(select rtrim(name) from zd_unit_code with(nolock) where code=c.ward),a.death_flag " +
  36. "from t_si_settle_apply a with(nolock), t_si_pat_info b with(nolock), zy_actpatient c with(nolock) " +
  37. "where a.settled=0 and a.pat_no=b.pat_no and a.times=b.times " +
  38. "and a.ledger_sn=b.ledger_sn and a.pat_no=c.inpatient_no")
  39. List<SiSettleApply> selectUnhandledApplies();
  40. @Select("select a.pat_no,a.times,a.ledger_sn,a.input_staff,a.input_comment,a.input_datetime,a.status,a.handle_staff,a.acct_used_flag, " +
  41. "a.handle_comment,a.handle_datetime,a.type,a.settle_datetime,b.med_type, b.insuplc_admdvs,b.insutype,b.mdtrt_id, " +
  42. "detailTotalCharge=(select isnull(sum(charge_fee),0) from zy_detail_charge c with(nolock) where c.inpatient_no=a.pat_no " +
  43. "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn), " +
  44. "ledgerTotalCharge=(select isnull(total_charge,0) from zy_ledger_file c with(nolock) where c.inpatient_no=a.pat_no " +
  45. "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn), " +
  46. "medinsTotalCharge=(select isnull(sum(charge_fee),0) from zy_detail_charge c with(nolock) where c.inpatient_no=a.pat_no " +
  47. "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn and trans_flag_yb=1), " +
  48. "fundpay=(select isnull(charge_yb,0) from zy_ledger_file c with(nolock) where c.inpatient_no=a.pat_no " +
  49. "and c.admiss_times=a.times and c.ledger_sn=a.ledger_sn),death_flag " +
  50. "from t_si_settle_apply a with(nolock), t_si_pat_info b with(nolock) where a.pat_no=#{patNo} and a.times=#{times} and " +
  51. "a.ledger_sn=#{ledgerSn} and a.type=#{type} and a.pat_no=b.pat_no and a.times=b.times and a.ledger_sn=b.ledger_sn")
  52. SiSettleApply selectCurrentApply(SiSettleApply apply);
  53. @Select("select detailTotalCharge=(select isnull(sum(charge_fee),0) from zy_detail_charge c with(nolock) where " +
  54. "c.inpatient_no=#{patNo} and c.admiss_times=#{times} and c.ledger_sn=#{ledgerSn}), " +
  55. "ledgerTotalCharge=(select isnull(total_charge,0) from zy_ledger_file c with(nolock) where " +
  56. "c.inpatient_no=#{patNo} and c.admiss_times=#{times} and c.ledger_sn=#{ledgerSn})")
  57. SiSettleApply selectTotalChargeAgain(SiSettleApply apply);
  58. @Select("select zyh,zycs,ssxh,ssbm,ssmc,ssrq,ssys,sszs1,sszs2,mzys from batj_ba4 where zyh=#{patNo} and zycs=#{times} order by ssxh")
  59. List<ZyDisYbSrgry> selectSurgeries(@Param("patNo") String patNo,
  60. @Param("times") int times);
  61. @Update("update t_si_settle_apply set status=#{status},handle_staff=#{handleStaff},handle_comment=#{handleComment}, " +
  62. "handle_datetime=getdate() where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and type=#{type}")
  63. void handleApply(SiSettleApply apply);
  64. }