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.util.List; /** *

* 描述: 公共接口 *

* * @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 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 getKeShiLieBiao(String deptCode); @Select("") List getKeShiLieBiaoList(@Param("deptCodeList") List deptCodeList); /** * 获取人员信息 * * @param code 人员代码 * @return 返回人员 */ @Select("select 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 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 getChargeCode(String pyCode); @Select("select rtrim(code) code,rtrim(name) name from zd_unit_code where isnull(del_flag,0) = 0") List 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), " + "ward,ward_name = (select rtrim(name) name from zd_unit_code where code = ward), " + "ledger_sn = (select 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_patient a where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}") ZyActpatient getHuanZheJiBenXinXi(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes); @Select("select max(admiss_times) from zy_patient where inpatient_no = #{inpatientNo} ") Integer getAdmissTimes(@Param("inpatientNo") String inpatientNo); @Select("select ori_detail_sn from zy_detail_charge " + "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " + " and charge_fee < 0 " + "group by ori_detail_sn having count(1) > 1") List chongFuTuiFei(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn); @Select("select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,sum(charge_fee) yi_tui_fei from ( " + " select inpatient_no,admiss_times,ledger_sn,detail_sn,charge_code_mx,charge_fee " + " from zy_detail_charge where " + " inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " + " and trans_flag_yb <> 2 and order_no <> 6 and " + " detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " + " and charge_fee <0 and ori_detail_sn is not null) " + " union all " + " select inpatient_no,admiss_times,ledger_sn,ori_detail_sn,charge_code_mx,charge_fee " + " from zy_detail_charge where " + " inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " + " and trans_flag_yb <> 2 and order_no <> 6 and " + " ori_detail_sn in(select ori_detail_sn from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " + "and charge_fee <0 and ori_detail_sn is not null) " + " ) temp " + " group by inpatient_no, admiss_times, ledger_sn, detail_sn, charge_code_mx") List tuiFeiYuEr(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn); @Update("") void chongFuTuiFeiChongZhi(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn, @Param("list") List oriDetailSn); @Update("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 charge_amount > 0 and ori_detail_sn = -1 " + "and detail_sn not in (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 and charge_fee < 0)") void jiuZhengZhenShuLiuShui(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn); @Update("update zy_detail_charge set ori_detail_sn = -1 where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in ( " + " 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 ori_detail_sn <> -1 and charge_fee < 0 and charge_amount < 0 " + " ) and charge_amount > 0 and charge_fee > 0") void genXinYuanTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn); @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 huoQuYuanGongXinXi(String code); @Select("SELECT small_dept FROM zd_dept_all where dept = #{deptCode}") List huoQuBingFanhKeShi(String deptCode); }