123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- package thyyxxk.webserver.dao.his;
- import org.apache.ibatis.annotations.Mapper;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import org.apache.ibatis.annotations.Update;
- import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
- import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
- import thyyxxk.webserver.entity.login.UserInfo;
- import thyyxxk.webserver.entity.yibao.ZyActpatient;
- import java.math.BigDecimal;
- import java.util.List;
- import java.util.Set;
- /**
- * <p>
- * 描述: 公共接口
- * </p>
- *
- * @author xc
- * @date 2021-09-17 10:54
- */
- @Mapper
- public interface PublicDao {
- @Select("select role_id from dj_user_role where user_code = #{code}")
- List<Integer> huoQuJueSe(@Param("code") String code);
- /**
- * 把表锁住
- */
- @Update("update yz_sequence set act_order_no = act_order_no")
- void lockTable();
- /**
- * 查询医嘱
- *
- * @return 返回医嘱号
- */
- @Select("select act_order_no from yz_sequence")
- float getActOrderNo();
- /**
- * 插入新的医嘱
- *
- * @param actOrderNo 医嘱号
- */
- @Update("update yz_sequence set act_order_no = #{actOrderNo}")
- void updateActOrderNo(float actOrderNo);
- /**
- * 获取 这个科室 的子科室
- *
- * @param deptCode 科室编码
- * @return 返回自生和子科室
- */
- @Select("select code from zd_unit_code where (parent_code = #{deptCode} or code = #{deptCode}) and isnull(del_flag,0) = 0")
- List<String> getKeShiLieBiao(String deptCode);
- @Select("<script>" +
- "select code from zd_unit_code where (parent_code in " +
- "<foreach collection='deptCodeList' item='item' index='index' open='(' close=')' separator=','>" +
- " #{item,jdbcType = CHAR}" +
- "</foreach> " +
- "or code in " +
- "<foreach collection='deptCodeList' item='item' index='index' open='(' close=')' separator=','>" +
- "#{item,jdbcType = CHAR}" +
- "</foreach>" +
- ") and isnull(del_flag,0) = 0" +
- "</script>")
- List<String> getKeShiLieBiaoList(@Param("deptCodeList") List<String> deptCodeList);
- /**
- * 获取人员信息
- *
- * @param code 人员代码
- * @return 返回人员
- */
- @Select("select distinct rtrim(code) code,rtrim(name) name from a_employee_mi where (name like #{code} or code_rs like #{code} or py_code like #{code}) and isnull(del_flag,0) = 0")
- List<GetDropdownBox> getRenYuan(String code);
- /**
- * @param pyCode 拼音编码
- * @return 获取项目的名称和code
- */
- @Select("select distinct code,name from zd_charge_item where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})" +
- "union all " +
- "select distinct code,name from yp_zd_dict where (py_code like #{pyCode} or code like #{pyCode} or name like #{pyCode})")
- List<GetDropdownBox> getChargeCode(String pyCode);
- @Select("select rtrim(code) code,rtrim(name) name from zd_unit_code where isnull(del_flag,0) = 0")
- List<GetDropdownBox> getDept();
- @Select("select isnull(max(ledger_sn),1) from zy_ledger_file where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}")
- Integer getLedgerSn(@Param("inpatientNo") String inpatient,
- @Param("admissTimes") Integer admissTimes);
- @Select("select rtrim(inpatient_no) inpatient_no,admiss_times,admiss_date,dis_date,name, " +
- "responce_name = (select rtrim(name) name from zy_zd_responce_type where code = responce_type)," +
- "responce_type, " +
- "ward,ward_name = (select rtrim(name) name from zd_unit_code where code = ward), " +
- "ledger_sn = (select max(ledger_sn) from zy_ledger_file where a.inpatient_no = zy_ledger_file.inpatient_no and a.admiss_times = zy_ledger_file.admiss_times), " +
- "chu_yuan_yi_zhu = (case when (select count(1) from yz_act_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times " +
- "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0 " +
- "then 1 " +
- "when (select count(1) from yz_inact_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times " +
- "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0 " +
- "then 1 else 0 end ), " +
- "bed_no,total_charge,balance from zy_actpatient a where inpatient_no = #{inpatientNo} ")
- ZyActpatient getHuanZheJiBenXinXi(@Param("inpatientNo") String inpatientNo);
- @Update("update zy_detail_charge set ori_detail_sn = null where inpatient_no = #{inpatientNo} " +
- "and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and ori_detail_sn = -1 and charge_amount > 0")
- void chongZhiZhenLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Select("select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and ori_detail_sn is not null " +
- "and charge_amount < 0")
- List<Integer> huoQuTuiFeiYuanLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Update("<script>" +
- "update zy_detail_charge set ori_detail_sn = -1 where inpatient_no = '${inpatientNo}' and admiss_times = ${admissTimes} and ledger_sn = ${ledgerSn} " +
- "and charge_amount > 0 and detail_sn in " +
- "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
- "${item}" +
- "</foreach>" +
- "</script>")
- void genXingFuShuDuiYingZhenLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<Integer> detailSnList);
- @Select("select ori_detail_sn,sum(charge_fee) charge_fee,sum(charge_amount) charge_amount " +
- "from zy_detail_charge a " +
- "where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and order_no <> 6 and trans_flag_yb <> 2 " +
- " and ori_detail_sn is not null and charge_amount<0 " +
- "group by ori_detail_sn having count(1) > 1")
- List<ZyDetailCharge> chongFuTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Select("<script>" +
- "select detail_sn,charge_fee,charge_amount from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and detail_sn in " +
- "<foreach collection='oriSn' item='sn' open='(' close=')' separator=','>" +
- "#{sn}" +
- "</foreach>" +
- "</script>")
- List<ZyDetailCharge> getZhenShuLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("oriSn") Set<Integer> oriSn);
- @Update("<script>" +
- "<foreach collection='list' item='item' separator=';'>" +
- "update zy_detail_charge set ori_detail_sn = null where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and (detail_sn = #{item} or ori_detail_sn = #{item}) " +
- "</foreach>" +
- "</script>")
- void chongFuTuiFeiChongZhi(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<Integer> oriDetailSn);
- @Select("select isnull(sum(charge_fee),0) from zy_detail_charge " +
- "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and trans_flag_yb=2")
- BigDecimal zhenFuXingDiFeiYong(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Update("update zy_detail_charge set trans_flag_yb = 0 where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and " +
- "trans_flag_yb = 2")
- void chongXingZhengFuXiangDi(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Select("select detail_sn from zy_detail_charge where inpatient_no= #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and trans_flag_yb <> 2 and charge_amount > 0 and ori_detail_sn is not null")
- List<Integer> zhenShuLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Select("select ori_detail_sn from zy_detail_charge where inpatient_no= #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and trans_flag_yb <> 2 and charge_amount < 0 and ori_detail_sn is not null")
- List<Integer> fuShuLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn);
- @Update("<script>" +
- "<foreach collection='list' item='item' separator=';'>" +
- "update zy_detail_charge set ori_detail_sn = null where inpatient_no= #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " +
- "and charge_fee < 0 and ori_detail_sn = #{item}" +
- "</foreach>" +
- "</script> ")
- void chongZhiFuShuYuanLiuShui(@Param("inpatientNo") String inpatientNo,
- @Param("admissTimes") Integer admissTimes,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<Integer> oriDetailSn);
- @Select("select top(1) code,dept_code,name,code_rs from a_employee_mi where (code = #{code} or code_rs = #{code}) and isnull(del_flag,0) = 0 ")
- UserInfo huoQuYuanGongBianMa(String code);
- @Select("SELECT small_dept FROM zd_dept_all where dept = #{deptCode}")
- List<String> bingFangSuoSuKeShi(String deptCode);
- // 重置 流水号
- @Select("select detail_sn from zy_detail_charge where inpatient_no= #{patNo} and admiss_times = #{times} " +
- "group by detail_sn having count(1) > 1 ")
- List<Integer> huoQuZhongYeFeiYong(@Param("patNo") String patNo,
- @Param("times") Integer times);
- @Update("<script>" +
- "<foreach collection='list' item='item' separator=';' index='index' >" +
- "update zy_detail_charge set detail_sn = (select isnull(max(detail_sn),1) + 1 from zy_detail_charge where inpatient_no= '${patNo}' and admiss_times = ${times}) " +
- "where inpatient_no= '${patNo}' and admiss_times = ${times} and ledger_sn = ${ledgerSn} and detail_sn = ${item}" +
- "</foreach>" +
- "</script>")
- void chongZhiLiuShui(@Param("patNo") String patNo,
- @Param("times") Integer times,
- @Param("ledgerSn") Integer ledgerSn,
- @Param("list") List<Integer> list);
- }
|