package thyyxxk.webserver.dao.his.zhuyuanyisheng;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.*;
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
import thyyxxk.webserver.entity.datamodify.SelectV2;
import thyyxxk.webserver.entity.datamodify.YzActOrder;
import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
import thyyxxk.webserver.entity.exceedingDischargeDays.ExceedingDischargeDays;
import thyyxxk.webserver.entity.inpatient.patient.Overview;
import thyyxxk.webserver.entity.inpatient.patient.Patient;
import thyyxxk.webserver.entity.login.UserInfo;
import thyyxxk.webserver.entity.medicine.YpZdGroupName;
import thyyxxk.webserver.entity.yzcheck.ChargeLimitations;
import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
import thyyxxk.webserver.entity.zhuyuanyisheng.OneClickOrder;
import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
import thyyxxk.webserver.entity.zhuyuanyisheng.dto.doctorAuth.DoctorAuthParams;
import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshYjReq;
import thyyxxk.webserver.entity.zhuyuanyisheng.vo.doctorAuth.DoctorAuthRest;
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
import thyyxxk.webserver.utils.DateUtil;
import thyyxxk.webserver.utils.WrapperUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
*
* 描述: 医嘱录入dao
*
*
* @author xc
* @date 2022-01-04 17:00
*/
@Mapper
public interface YiZhuLuRuDao {
@Select("SELECT " +
"RTRIM(a.bed_no) bedNo, " +
"RTRIM(a.inpatient_no) inpatientNo, " +
"a.admiss_times, " +
"RTRIM(a.name) as name, " +
"sex=isnull(a.sex, 9), " +
"mdtrtId=(select b.mdtrt_id from t_si_pat_info b where b.pat_no=a.inpatient_no " +
"and b.times=a.admiss_times and b.ledger_sn=a.times_billed), " +
"injurySerialNo=(select serial_no from t_injury_si_pat_info where pat_no=a.inpatient_no " +
"and times=a.admiss_times and ledger_sn=a.times_billed), " +
"medType=a.med_type, " +
"dismissOrder=(select count(1) from yz_act_order b where b.inpatient_no=a.inpatient_no " +
"and b.admiss_times=a.admiss_times and status_flag > '1' and isnull(group_no,'00')='00' " +
"and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')))," +
"orderNoCount = (select count(1) " +
" from yz_act_order c " +
" where a.inpatient_no = c.inpatient_no " +
" and c.admiss_times = a.admiss_times " +
" and c.status_flag = '1' " +
" and c.enter_oper = #{userCode}), " +
" refer_physician, " +
" (select name from a_employee_mi where code = refer_physician) as refer_physician_name, " +
" consult_physician, " +
" (select name from a_employee_mi where code = refer_physician) as consult_physician_name, " +
" dept_director, " +
" (select name from a_employee_mi where code = refer_physician) as dept_director_name " +
"FROM zy_actpatient a with (NOLOCK) " +
"where refer_physician = #{code} " +
"ORDER BY cast(bed_no AS int) ")
List getMyPatient(String code);
@Select("select isnull(balance,0) balance, " +
" total_charge, " +
" charge1, " +
" charge2, " +
" charge3, " +
" charge4, " +
" charge5, " +
" charge6, " +
" charge7, " +
" charge8, " +
" charge9, " +
" charge10, " +
" charge11, " +
" charge12, " +
" charge13, " +
" charge14, " +
" charge15, " +
" charge16, " +
" charge17, " +
" charge18, " +
" charge19, " +
" charge20, " +
" charge21, " +
" charge22, " +
" charge23, " +
" charge24, " +
" charge25, " +
" charge26, " +
" charge27, " +
" charge28, " +
" charge29, " +
" charge30, " +
" yp = (isnull(charge1 + charge2 + charge28, 0))," +
" jyjc = (isnull(charge8 + charge9 + charge11 + charge18 + charge13, 0))," +
" isnull(charge_yb, 0) charge_yb " +
"from zy_ledger_file with (NOLOCK) " +
"where inpatient_no = #{inpatientNo} " +
" and admiss_times = #{admissTimes} " +
" and ledger_sn = #{ledgerSn} ")
HuanZheFeiYong feiYongXinXi(@Param("inpatientNo") String inpatientNo,
@Param("admissTimes") Integer admissTimes,
@Param("ledgerSn") Integer ledgerSn);
@Select("select * from yz_act_order with (NOLOCK) ${ew.customSqlSegment}")
List getYiZhuShuJuByOrderNo(@Param("ew") QueryWrapper actOrderNo);
@Select("select max(ledger_sn) from zy_ledger_file a left join zy_actpatient b on a.inpatient_no = b.inpatient_no and a.admiss_times = b.admiss_times"+
" where a.inpatient_no = #{inpatientNo} and a.admiss_times = #{admissTimes}")
Integer getledgerSnFromYiZhu(@Param("inpatientNo") String inpatientNo,
@Param("admissTimes") Integer admissTimes);
default List selectOrderNo(@Param(Constants.WRAPPER) QueryWrapper> wq) {
String fullSql = WrapperUtils.getFullSql(wq);
List xinZhenYzActOrders = this.selectOrderNoByOld(fullSql);
List xinZhenYzActOrders1 = this.selectOrderNoByNew(fullSql);
List result = new ArrayList<>();
result.addAll(xinZhenYzActOrders1);
result.addAll(xinZhenYzActOrders);
return result;
}
@Select("select cast(a.act_order_no as decimal) as act_order_no, " +
" cast(cast(a.act_order_no as decimal) as varchar) id, " +
" order_code, " +
" order_name, " +
" rtrim(frequ_code) frequ_code, " +
" frequ_code_name = (select rtrim(comm) " +
" from yz_order_frequency " +
" where code = frequ_code), " +
" instruction, " +
" discription, " +
" infant_flag, " +
" order_time, " +
" physician, " +
" start_time, " +
" drug_specification, " +
" drug_quan, " +
" mini_unit_name = (select name " +
" from yp_zd_unit with (NOLOCK) " +
" where code = mini_unit), " +
" rtrim(supply_code) supply_code, " +
" supply_code_name = (select rtrim(supply_name) " +
" from yz_supply_type with (NOLOCK) " +
" where yz_supply_type.supply_code = a.supply_code), " +
" a.inpatient_no, " +
" a.admiss_times, " +
" drug_flag, " +
" enter_oper, " +
" enter_oper_name = (select top (1) rtrim(name) " +
" from a_employee_mi with (NOLOCK) " +
" where code = enter_oper) /* 录入人 */, " +
" enter_time, " +
" mini_unit, " +
" drug_weight, " +
" drug_weight_unit, " +
" rtrim(status_flag) status_flag, " +
" status_time, " +
" cast(a.parent_no as decimal) as parent_no," +
" cast(cast(a.parent_no as decimal) as varchar) as parent_no_str, " +
" parent_no_name = (select kfc.order_name from yz_act_order kfc where kfc.act_order_no = a.parent_no), " +
" self_buy, " +
" dose, " +
" dose_unit, " +
" dose_unit_name = (select name " +
" from yp_zd_unit with (NOLOCK) " +
" where dose_unit = code), " +
" drug_occ, " +
" drug_volume, " +
" drug_vol_unit, " +
" exclu_back_time, " +
" exclu_act_order_no, " +
" pay_self, " +
" serial, " +
" group_no, " +
" signer, " +
" cl_code, " +
" doctor_flag, " +
" emergency_flag, " +
" exclu_type='', " +
" end_time_b=end_time, " +
" new_flag='0', " +
" order_no_pattern=0, " +
" suprice_flag='', " +
" self_flag ='', " +
" pack_size=0.0, " +
" parent_no_c= -1000, " +
" reg_flag, " +
" parent_flag='', " +
" rtrim(yb_self_flag) as yb_self_flag, " +
" kf_flag, " +
" refer_physician, " +
" consult_physician, " +
" physician_name = (select top (1) rtrim(name) " +
" from a_employee_mi with (NOLOCK) " +
" where code = physician) /* 开这个医嘱的医生 */, " +
" exec_unit, " +
" exec_unit_name = (select top (1) rtrim(name) " +
" from zd_unit_code with (NOLOCK) " +
" where code = exec_unit), " +
" a.dept_code, " +
" dept_name = (select top (1) rtrim(name) " +
" from zd_unit_code with (NOLOCK) " +
" where code = dept_code), " +
" a.ward_code, " +
" ward_name = (select top (1) rtrim(name) " +
" from zd_unit_code with (NOLOCK) " +
" where code = a.ward_code), " +
" /*管床医生*/ " +
" refer_physician_name = (select rtrim(name) " +
" from a_employee_mi with (NOLOCK) " +
" where code = refer_physician), " +
" group_no_name = (select rtrim(group_name) " +
" from yp_zd_group_name with (NOLOCK) " +
" where a.group_no = group_no), " +
" signer_name = (select top (1) rtrim(name) " +
" from a_employee_mi with (NOLOCK) " +
" where code = signer) /*确认人*/, " +
" confirm_time /*确认时间*/, " +
" modifier, " +
" modifier_name = (select top (1) rtrim(name) " +
" from a_employee_mi with (NOLOCK) " +
" where code = modifier) /*停止人*/, " +
" end_time /*停止时间*/, " +
" b.new_ward as zkWardCode, " +
" b.new_dept as zkDeptCode, " +
" kss.yyfs, " +
" kss.ssqk, " +
" kss.yysj, " +
" executer1 = (select name from a_employee_mi with (NOLOCK) where code = executer1), " +
" executer2= (select name from a_employee_mi with (NOLOCK) where code = executer2)," +
" superiorDoctor = (select rtrim(authorized_doctor) from new_act_order_recording na where na.act_order_no = a.act_order_no) " +
"from view_xc_all_yz a with (NOLOCK) left join " +
"zy_order_zk b with (NOLOCK) on (a.act_order_no = b.act_order_no) left join " +
"yz_act_record_kss kss on (a.act_order_no = kss.act_order_no) " +
"where status_flag = '1' and ${sql} ")
List selectOrderNoByNew(String sql);
@Select("select cast(a.act_order_no as decimal) as act_order_no,\n" +
" cast(cast(a.act_order_no as decimal) as varchar) id,\n" +
" order_code,\n" +
" order_name,\n" +
" rtrim(frequ_code) frequ_code,\n" +
" frequ_code_name = (select rtrim(comm)\n" +
" from yz_order_frequency\n" +
" where code = frequ_code),\n" +
" instruction,\n" +
" discription,\n" +
" infant_flag,\n" +
" order_time,\n" +
" physician,\n" +
" start_time,\n" +
" drug_specification,\n" +
" drug_quan,\n" +
" mini_unit_name = (select name\n" +
" from yp_zd_unit with (NOLOCK)\n" +
" where code = mini_unit),\n" +
" rtrim(supply_code) supply_code,\n" +
" supply_code_name = (select rtrim(supply_name)\n" +
" from yz_supply_type with (NOLOCK)\n" +
" where yz_supply_type.supply_code = a.supply_code),\n" +
" a.inpatient_no,\n" +
" a.admiss_times,\n" +
" drug_flag,\n" +
" enter_oper,\n" +
" enter_oper_name = (select top (1) rtrim(name)\n" +
" from a_employee_mi with (NOLOCK)\n" +
" where code = enter_oper) /* 录入人 */,\n" +
" enter_time,\n" +
" mini_unit,\n" +
" drug_weight,\n" +
" drug_weight_unit,\n" +
" rtrim(status_flag) status_flag,\n" +
" status_time,\n" +
" cast(a.parent_no as decimal) as parent_no,\n" +
" cast(cast(a.parent_no as decimal) as varchar) as parent_no_str,\n" +
" parent_no_name = (select kfc.order_name\n" +
" from yz_act_order kfc\n" +
" where kfc.act_order_no = a.parent_no),\n" +
" self_buy,\n" +
" dose,\n" +
" dose_unit,\n" +
" dose_unit_name = (select name\n" +
" from yp_zd_unit with (NOLOCK)\n" +
" where dose_unit = code),\n" +
" drug_occ,\n" +
" drug_volume,\n" +
" drug_vol_unit,\n" +
" exclu_back_time,\n" +
" exclu_act_order_no,\n" +
" pay_self,\n" +
" serial,\n" +
" group_no,\n" +
" signer,\n" +
" cl_code,\n" +
" doctor_flag,\n" +
" emergency_flag,\n" +
" exclu_type='',\n" +
" end_time_b=end_time,\n" +
" new_flag='0',\n" +
" order_no_pattern=0,\n" +
" suprice_flag='',\n" +
" self_flag ='',\n" +
" pack_size=0.0,\n" +
" parent_no_c= -1000,\n" +
" reg_flag,\n" +
" parent_flag='',\n" +
" rtrim(yb_self_flag) as yb_self_flag,\n" +
" kf_flag,\n" +
" refer_physician,\n" +
" consult_physician,\n" +
" physician_name = (select top (1) rtrim(name)\n" +
" from a_employee_mi with (NOLOCK)\n" +
" where code = physician) /* 开这个医嘱的医生 */,\n" +
" exec_unit,\n" +
" exec_unit_name = (select top (1) rtrim(name)\n" +
" from zd_unit_code with (NOLOCK)\n" +
" where code = exec_unit),\n" +
" a.dept_code,\n" +
" dept_name = (select top (1) rtrim(name)\n" +
" from zd_unit_code with (NOLOCK)\n" +
" where code = dept_code),\n" +
" a.ward_code,\n" +
" ward_name = (select top (1) rtrim(name)\n" +
" from zd_unit_code with (NOLOCK)\n" +
" where code = a.ward_code),\n" +
" /*管床医生*/\n" +
" refer_physician_name = (select rtrim(name)\n" +
" from a_employee_mi with (NOLOCK)\n" +
" where code = refer_physician),\n" +
" group_no_name = (select rtrim(group_name)\n" +
" from yp_zd_group_name with (NOLOCK)\n" +
" where a.group_no = group_no),\n" +
" signer_name = (select top (1) rtrim(name)\n" +
" from a_employee_mi with (NOLOCK)\n" +
" where code = signer) /*确认人*/,\n" +
" confirm_time /*确认时间*/,\n" +
" modifier,\n" +
" modifier_name = (select top (1) rtrim(name)\n" +
" from a_employee_mi with (NOLOCK)\n" +
" where code = modifier) /*停止人*/,\n" +
" end_time /*停止时间*/,\n" +
" executer1 = (select name\n" +
" from a_employee_mi with (NOLOCK) \n" +
" where code = executer1),\n" +
" executer2= (select name\n" +
" from a_employee_mi with (NOLOCK)\n" +
" where code = executer2)\n" +
"from view_xc_all_yz a with (NOLOCK)\n" +
"where status_flag <> '1' and ${sql} ;")
List selectOrderNoByOld(String sql);
@Select("select act_order_no, " +
"rtrim(status_flag) status_flag," +
"frequ_code," +
"enter_oper," +
"inpatient_no " +
"from yz_act_order with (NOLOCK) " +
"${ew.customSqlSegment}")
List getOrdersToDelete(@Param(Constants.WRAPPER) Wrapper> wq);
@Update("update yz_act_order " +
"set " +
" order_time = #{order.orderTime,jdbcType=TIMESTAMP}, " +
" start_time = #{order.startTime,jdbcType=TIMESTAMP}, " +
" end_time = #{order.endTime,jdbcType=TIMESTAMP}, " +
" supply_code = '044', " +
" frequ_code = #{order.frequCode}," +
" group_no = #{order.groupNo}," +
" exec_unit = #{order.execUnit}, " +
" modifier = #{order.modifier} " +
"where act_order_no = ${orderNo} ")
void updateSubOrderStatus(BigDecimal orderNo, XinZhenYzActOrder order);
@Delete("delete yz_act_order ${ew.customSqlSegment} ")
void deleteMultipleOrders(@Param(Constants.WRAPPER) Wrapper> wq);
@Update("")
void deleteParentChildRelationship(String patNo,
Integer times,
List list);
@Select("")
void setStopTime(List list,
String userCode,
String patNo,
Integer times);
@Select("SELECT rtrim(a.code) + rtrim(serial) as id, " +
" py_code=a.py_code, " +
" d_code =a.d_code, " +
" order_code =a.code, " +
" order_name =a.name, " +
" drug_specification=a.specification, " +
" drug_flag =case a.infusion_flag " +
" when '1' then 'i' " +
" else (case categories_flag " +
" when '0' " +
" then 'd' " +
" else 'z' " +
" end) " +
" end, " +
" parent_code=null, " +
" exclu_group_type=null, " +
" discription=case a.infusion_flag " +
" when '1' then '大输液' " +
" else (case " +
" when a.code >= '30000' and a.code < '50000' then '中药' " +
" else '西药 ' end) end + convert(char(10), a.pack_retprice) + '元' + '(医保类别:' + " +
" ltrim(rtrim(yb_flag_new)) + ';报销比例:' + ltrim(rtrim(yb_bl_new)) + ';医保说明:' + " +
" ltrim(rtrim(yb_comment_new)) + ')', " +
" serial=a.serial, " +
" group_no=a.group_no, " +
" infusion_flag=a.infusion_flag, " +
" group_name =a.group_name, " +
" pack_size=a.pack_size," +
" (select name " +
" from yp_zd_unit with (NOLOCK) " +
" where code = pack_unit) as pack_size_name, " +
" order_class='Y', " +
" spec_pack=a.spec_pack, " +
" jsy_flag =a.jsy_flag, " +
" xnh_flag, " +
" yb_comment, " +
" dosage = a.dosage, " +
" yb_type, " +
" yb_flag_new," +
" father_flag, " +
" manu_name=(select name from yp_zd_manufactory with (NOLOCK) where code = a.manu_code), " +
" stock_amount=a.stock_amount, " +
" national_code," +
" national_name,mini_unit_name = (select name from yp_zd_unit where code = mini_unit) " +
"FROM view_yp_zd_dict_base_yf a with (NOLOCK) " +
"WHERE isnull(a.visible_flag_zy, '') <> '1' " +
" and (a.py_code like #{code} or a.name like #{code} or code like #{code}) " +
" and group_no = '${groupNo}' ")
List yiZhuYaoPing(@Param("code") String code,
@Param("groupNo") String groupNo);
@Select("select act_order_no, " +
"rtrim(status_flag) as status_flag," +
"rtrim(frequ_code) as frequ_code," +
"rtrim(supply_code) as supply_code, " +
"inpatient_no," +
"admiss_times," +
"enter_oper," +
"rtrim(serial) as serial," +
"order_time," +
"start_time," +
"end_time," +
"group_no," +
"ward_code," +
"parent_no " +
"from yz_act_order with (NOLOCK) " +
"where act_order_no = #{orderNo} ")
XinZhenYzActOrder getActOrderNoOne(String orderNo);
@Select("select frequ_code from yz_act_order where act_order_no = ${orderNo} ")
String selectParentNo(String orderNo);
/**
* 获取,有未确认和未执行的医嘱
*
* @param patNo 住院号
* @param times 住院次数
* @param orderNo 医嘱号
* @return 数据
*/
@Select("select rtrim(status_flag) status_flag,order_name, act_order_no,frequ_code " +
"from yz_act_order with (NOLOCK) " +
"where inpatient_no = #{patNo} " +
" and admiss_times = #{times} " +
" and status_flag in ('1', '2')" +
" and act_order_no <> #{orderNo} " +
" and frequ_code = N'ONCE'" +
" union all " +
"select rtrim(status_flag) status_flag,order_name, act_order_no,frequ_code " +
"from yz_act_order with (NOLOCK) " +
"where inpatient_no = #{patNo} " +
" and admiss_times = #{times} " +
" and status_flag in ('1') " +
" and act_order_no <> #{orderNo} " +
" and frequ_code <> N'ONCE' ")
List thereAreUnexecutedOrders(String patNo, Integer times, BigDecimal orderNo);
@Select("select count(1) " +
"from yz_act_order " +
"where inpatient_no = #{yz.inpatientNo} " +
" and admiss_times = #{yz.admissTimes} " +
" and status_flag = 1 " +
" and isnull(self_buy, '0') <> '4' " +
" and enter_oper = #{userCode} " +
" and order_code in (select rtrim(order_code) " +
" from yz_zd_order_item_confirm " +
" where item_name = N'出院')")
int selectDischargeOrde(@Param("yz") XinZhenYiZhu yz,
@Param("userCode") String userCode);
@Update("update yz_act_order set frequ_code = 'ONCE' WHERE act_order_no = #{orderNo};" +
"update yz_act_order " +
"set modifier = #{userCode}, " +
" end_time = #{date}, " +
" exclu_act_order_no = #{orderNo}, " +
" status_flag = '5' " +
"where inpatient_no = #{patNo} " +
" and admiss_times = #{times} " +
" and status_flag in ('2','3','4') " +
" and frequ_code != 'ONCE' " +
" and act_order_no <> #{orderNo}" +
" and (end_time > #{date} or end_time is null )")
void stopOrder(String patNo, Integer times, Date date, String userCode, BigDecimal orderNo);
@Update("update yz_act_order " +
"set confirm_time = #{confirmDate}, " +
" signer = #{userCode}, " +
" status_time = #{confirmDate}, " +
" status_flag = '2'," +
" supply_code = case " +
" when parent_no is not null then (select isnull(nullif(supply_child, ''), '044') " +
" from yz_supply_type c " +
" where c.supply_code = (select supply_code " +
" from yz_act_order b " +
" where b.act_order_no = yz_act_order.parent_no)) " +
" else " +
" yz_act_order.supply_code end " +
" where act_order_no = #{decimal}")
void confirmOrders(BigDecimal decimal, String userCode, Date confirmDate);
@Update("update yz_act_order " +
"set confirm_time = #{confirmDate}, " +
" signer = #{userCode}, " +
" status_time = #{confirmDate}, " +
" status_flag = '2'," +
" supply_code = case " +
" when parent_no is not null then (select isnull(nullif(supply_child, ''), '044') " +
" from yz_supply_type c " +
" where c.supply_code = (select supply_code " +
" from yz_act_order b " +
" where b.act_order_no = yz_act_order.parent_no)) " +
" else " +
" yz_act_order.supply_code end," +
" enter_oper = #{userCode},physician = #{userCode} " +
" where act_order_no = #{decimal}")
void confirmOrdersSuperiorDoctor(BigDecimal decimal, String userCode, Date confirmDate);
@Update("update yz_act_order " +
"set confirm_time = #{confirmDate}, " +
" signer = #{userCode}, " +
" status_time = #{confirmDate}, " +
" status_flag = '2'," +
" modifier = #{userCode}," +
" end_time = #{confirmDate}, " +
" frequ_code = 'ONCE' " +
" where act_order_no = #{decimal} ")
void takeMedicineAfterDischargeStopOrder(BigDecimal decimal, String userCode, Date confirmDate);
@Update("update yz_act_order " +
"set confirm_time = #{confirmDate}, " +
" signer = #{userCode}, " +
" status_time = #{confirmDate}, " +
" status_flag = '2'," +
" modifier = #{userCode}," +
" end_time = #{confirmDate}, " +
" frequ_code = 'ONCE',enter_oper = #{userCode},physician = #{userCode} " +
" where act_order_no = #{decimal} ")
void takeMedicineAfterDischargeStopOrderAndSuperiorDoctor(BigDecimal decimal, String userCode, Date confirmDate);
@Delete("delete yz_act_record_kss where act_order_no =#{orderNo}; " +
"delete zy_order_zk where act_order_no =#{orderNo};" +
"delete op_record where inpatient_no = #{patNo} and act_order_no =#{orderNo};" +
"delete ysh_yj_req where inpatient_no =#{patNo} and act_order_no =#{orderNo};" +
"DELETE FROM yz_act_order WHERE act_order_no = #{orderNo}; ")
void toDeleteAnOrder(String orderNo, String patNo);
@Update("UPDATE yz_act_order SET parent_no = NULL WHERE parent_no = #{orderNo} ")
void deleteGroup(String orderNo);
@Delete("delete yz_act_order where " +
"act_order_no = #{orderNo} ")
void deleteOrderNo(String orderNo);
@Insert("INSERT INTO yz_act_order (order_code, order_name, frequ_code, instruction, discription, infant_flag, order_time, " +
" /*录入人*/physician, start_time, drug_specification, drug_quan, supply_code, act_order_no, inpatient_no, " +
" admiss_times, drug_flag/*药品中找这个是 药品的类型 a i d*/, enter_oper, /*录入时间*/ " +
" enter_time, " +
" mini_unit /*药品中找 最小包装规格*/, " +
" drug_weight/*药品的重量*/, drug_weight_unit/*药品重量单位*/, " +
" status_flag/*1*/, self_buy, dose, dose_unit, drug_occ, drug_volume/*药品中的 volum 找*/, " +
" drug_vol_unit/* 药品中的 vol_unit */, pay_self/*0*/, " +
" serial/*前端传*/, group_no/*药房 */, doctor_flag/*写死为 1*/, exec_unit, dept_code/* 在院病人表中的 dept */, " +
" ward_code /* 在院病人表中的 zk_ward*/, " +
" reg_flag/* 0 */, " +
" yb_self_flag/*医保自费标志*/, emergency_flag, " +
" kf_flag /*饭前饭后*/, parent_no, refer_physician/*患者的管床医生*/, end_time," +
" modifier) " +
"values (#{pa.orderCode}, #{pa.orderName}, #{pa.frequCode}, #{pa.instruction}, #{pa.discription}, #{patInfo.infantFlag}, " +
" #{pa.orderTime}, #{userCode}, " +
" #{pa.startTime}, cast(#{pa.drugSpecification} as varchar(16)), #{pa.drugQuan,jdbcType=REAL}, #{pa.supplyCode}, #{pa.actOrderNo,jdbcType=REAL}, #{patInfo.inpatientNo}, " +
" #{patInfo.admissTimes}, #{pa.drugFlag}, #{userCode}, getdate(), " +
" #{pa.miniUnit}, #{pa.drugWeight,jdbcType = REAL}, #{pa.drugWeightUnit,jdbcType=REAL}, '1', #{pa.selfBuy}, " +
" #{pa.dose ,jdbcType = REAL}, #{pa.doseUnit}, #{pa.drugOcc ,jdbcType = REAL}, " +
" #{pa.drugVolume,jdbcType=REAL}, #{pa.drugVolUnit}, '0', #{pa.serial}, #{pa.groupNo}, '1', #{pa.execUnit}, " +
" #{patInfo.deptCode}, #{patInfo.deptCode}, '0', #{pa.ybSelfFlag}, #{pa.emergencyFlag}, " +
" #{pa.kfFlag}, #{pa.parentNo,jdbcType=REAL}, #{patInfo.referPhysician}, #{pa.endTime}," +
" #{pa.modifier})")
void insertEntryOrder(XinZhenYiZhu patInfo, XinZhenYzActOrder pa, String userCode);
@Update("update yz_act_order set " +
"frequ_code = #{pa.frequCode}," +
"supply_code = #{supplyCode}," +
"exec_unit = #{pa.execUnit}," +
"order_time = #{pa.orderTime}," +
"start_time = #{pa.startTime,jdbcType=TIMESTAMP}," +
"end_time = #{pa.endTime,jdbcType=TIMESTAMP}," +
"group_no = #{pa.groupNo}," +
"modifier = #{pa.modifier} " +
"where inpatient_no = #{pa.inpatientNo} " +
" and admiss_times = #{pa.admissTimes} " +
" and parent_no = #{pa.actOrderNo,jdbcType=REAL} ")
void howOftenTheSubPhysicianOrderIsModified(@Param("pa") XinZhenYzActOrder pa,
@Param("supplyCode") String supplyCode);
@Select("select isnull(nullif(supply_child, ''), '044') " +
"from yz_supply_type " +
"where supply_code = '${code}'")
String selectSupplyCode(String code);
@Select("SELECT rtrim(a.order_code) + '00' as id," +
"a.py_code, " +
" a.d_code, " +
" a.order_code , " +
" rtrim(a.order_name) order_name, " +
" drug_specification='诊疗项目', " +
" drug_flag = isnull(operation,'o') , " +
" a.parent_code , " +
" a.exclu_group_type, " +
" discription=a.discription + ' ' + a.yb_comment, " +
" serial ='00', " +
" group_no='00', " +
" infusion_flag='', " +
" group_name ='', " +
" pack_size=1, " +
" order_class=a.order_class, " +
" spec_pack='', " +
" jsy_flag ='', " +
" xnh_flag='', " +
" yb_comment =null," +
" exec_dept," +
" exec_dept_name = (select rtrim(name) from zd_unit_code where code = exec_dept), " +
" dosage='', " +
" yb_type='', " +
" father_flag='0', " +
" manu_name='', " +
" stock_amount=0 ," +
" min_age_restriction ," +
" max_age_restriction ," +
" gender_restriction " +
"FROM yz_order_item a with (NOLOCK) " +
"WHERE isnull(a.del_flag, '') <> '1' " +
" and (py_code like #{code} or order_name like #{code} or order_code like #{code}) " +
" and order_code not in (select zy_order_code from jc_zd_item) " +
" and isnull(exec_dept, '') <> '2010000' " +
" and order_class not in ('B','C','D') ")
List yiZhuXiangMu(String code);
@Select("SELECT a.py_code, " +
" a.d_code, " +
" a.pattern_code as order_code, " +
" a.pattern_name as order_name, " +
" specification=' ', " +
" order_type ='t', " +
" parent_code=space(7), " +
" exclu_group_type=space(1), " +
" discription='成组医嘱', " +
" serial ='0000', " +
" group_no='0000', " +
" infusion_flag='', " +
" drug_flag ='', " +
" group_name ='', " +
" pack_size =1, " +
" order_class ='', " +
" spec_pack='', " +
" jsy_flag ='', " +
" exclu_group_type='', " +
" xnh_flag='', " +
" yb_comment =null, " +
" dosage = '', " +
" yb_type='', " +
" father_flag='0', " +
" manu_name='', " +
" stock_amount=0 " +
"FROM yz_OrderPattern a with (NOLOCK) " +
"where (py_code like #{code} or " +
"pattern_name like #{code} or " +
"d_code like #{code}) and dept_code = #{deptCode} ")
List composeOrders(String code, String deptCode);
@Select("SELECT cast(rtrim(isnull(nullif(del_flag, " +
" ''), " +
" 0)) as int) as del_flag, " +
" national_code as national_code, " +
" name as order_name " +
"FROM yz_order_occurence a with (NOLOCK), " +
" zd_charge_item b with (NOLOCK) " +
"where a.occ_code = b.code " +
" and a.order_code = #{code}")
List huoQuXiangMu(String code);
@Select("select CAST(isnull(exclu_group_type, 0) AS INT) " +
"from yz_order_item with (NOLOCK) where order_code = #{code}")
Integer shiFouPaiChiYiZhu(String code);
@Select("select drug_flag,\n" +
" categories_flag,\n" +
" a.serial,\n" +
" /* 医保自费 */\n" +
" cast(isnull(NULLIF(self_flag_yb,\n" +
" ''),\n" +
" 0) as int) as self_flag_yb,\n" +
" /* 重量 */\n" +
" weight,\n" +
" /* 重量单位 */\n" +
" weigh_unit,\n" +
" weigh_unit_name = (select name\n" +
" from yp_zd_unit with (NOLOCK)\n" +
" where code = weigh_unit),\n" +
" /*体积*/\n" +
" volum,\n" +
" /*体积单位*/\n" +
" vol_unit,\n" +
" vol_unit_name = (select name\n" +
" from yp_zd_unit with (NOLOCK)\n" +
" where code = vol_unit),\n" +
" /*包装体积*/\n" +
" pack_size,\n" +
" /*包装单位*/\n" +
" pack_unit,\n" +
" pack_unit_name = (select name\n" +
" from yp_zd_unit with (NOLOCK)\n" +
" where code = pack_unit),\n" +
" /*最小单位*/\n" +
" mini_unit,\n" +
" mini_unit_name = (select name\n" +
" from yp_zd_unit with (NOLOCK)\n" +
" where code = mini_unit),\n" +
" /* 需要判断医生的权限 在 select\n" +
" doctor_xz_yp\n" +
" from\n" +
" a_employee_mi */\n" +
" cast(isnull(NULLIF(yp_level,\n" +
" ''),\n" +
" 0) as int) as yp_level,\n" +
" /*需要皮试*/\n" +
" cast(isnull(NULLIF(a.ps_flag,\n" +
" ''),\n" +
" 0) as int) as ps_flag,\n" +
" cast(isnull(NULLIF(kss_flag,\n" +
" ''),\n" +
" 0) as int) as kss_flag,\n" +
" cast(isnull(NULLIF(kjyw_flag,\n" +
" ''),\n" +
" 0) as int) as kjyw_flag,\n" +
" code as order_code,\n" +
" name as order_name,\n" +
" frequency as frequCode,\n" +
" (select isnull(rtrim(comm),\n" +
" '')\n" +
" from yz_order_frequency\n" +
" where yz_order_frequency.code = frequency) as frequCodeName,\n" +
" supply_code as supply_code,\n" +
" supply_code_name =supply_name,\n" +
" national_code,\n" +
" rtrim(jb_flag) as jb_flag,\n" +
" high_warning_flag,\n" +
" winning_bidder_flag,\n" +
" focus_monitor_flag\n" +
"from yp_zd_dict a with (NOLOCK)\n" +
" left join yz_supply_type c on (a.supply_type = c.supply_code)\n" +
"where rtrim(code) + rtrim(a.serial) = '${code}'\n" +
" and cast(isnull(NULLIF(a.del_flag, ''), 0) as int) = 0;")
YaoPinXinXi huoQuYaoPin(@Param("code") String code);
@Select("select stock_amount, cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy " +
"from yp_base_yf " +
"where rtrim(charge_code) + rtrim(serial) = '${code}' " +
" and group_no = '${groupNo}'")
YaoPinXinXi huoQuJinYongXinXi(@Param("code") String code,
@Param("groupNo") String groupNo);
@Select("select count(1) " +
"from yp_zd_dept " +
"where charge_code = #{code} " +
" and dept_code = #{dept} ")
Integer restrictedUseInTheDepartment(@Param("code") String code,
@Param("dept") String dept);
@Select("select cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 from a_employee_mi with (NOLOCK) where code = #{code}")
Integer huoQuYiShenDengJi(String code);
@Select("select cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel," +
" doctor_zy as doctorZy, " +
" dept_code," +
" code " +
"from a_employee_mi with (NOLOCK) " +
"where code = #{code} ")
UserInfo selectedUserInfoByCode(String code);
@Select("select rtrim(supply_code) code,rtrim(supply_name) name " +
"from yz_supply_type with (NOLOCK) " +
"where ps_flag in ('1', '0')")
List piShiGeiYaoFangShi();
@Select("select rtrim(code) code, rtrim(comm) name " +
"from yz_order_frequency with (NOLOCK) " +
"where (code like #{code} or comm like #{code})")
List huoQuZhuYuanPinLv(String code);
@Select("select rtrim(code) as code, rtrim(code) name " +
"from yz_order_frequency")
List selectFrequency();
@Select("select rtrim(supply_code) code, " +
" rtrim(supply_name) name, " +
" py_code, " +
" d_code as w_code " +
"from yz_supply_type with (NOLOCK) where isnull(del_flag , '0') <> '1'")
List selectSupplyType();
@Select("select rtrim(supply_code) code, rtrim(supply_name) name " +
"from yz_supply_type with (NOLOCK) " +
"where (supply_code like #{code} or supply_name like #{code} or py_code like #{code} )")
List huoQuGeiYaoFangShi(String code);
@Select("SELECT a.code code, " +
" a.name name " +
"FROM zd_unit_code a with (NOLOCK), " +
" zd_dept_all b with (NOLOCK) " +
"where isnull(a.del_flag, '0') <> '1' " +
" and a.code = b.small_dept " +
" and (a.code like #{code} or a.name like #{code} or py_code like #{code}) " +
"group by code,name")
List huoQuZhiXinKeShi(String code);
@Select("")
List huoQuYaoPinXinXi(@Param("code") Set code,
@Param("dept") String dept);
@Select("")
List huoQuXiangMuXinXi(Set code);
@Select("select b.order_code, " +
" rtrim(c.name) order_name, " +
" national_code, " +
" kjyw_flag = 0, " +
" cast(rtrim(isnull(nullif(c.del_flag, " +
" ''), " +
" 0)) as int) as del_flag " +
"from yz_order_occurence b with (NOLOCK), " +
" zd_charge_item c with (NOLOCK) " +
"where b.order_code = #{code} " +
" and b.occ_code = c.code")
List itemDataOne(String code);
@Select("select order_code, order_name, cast(ISNULL(del_flag, 0) as int) as del_flag \n" +
"from yz_order_item\n" +
"where order_code = '${code}'")
XinZhenYzActOrder yzItem(String code);
@Select("select rtrim(code) order_code, " +
" rtrim(a.serial) as serial, " +
" rtrim(group_no) as group_no, " +
" rtrim(name) order_name, " +
" case infusion_flag " +
" when '1' then 'i' " +
" else " +
" (case " +
" when rtrim(code) >= '30000' and rtrim(code) < " +
" '50000' then 'z' " +
" else 'd' end) end as drug_flag, " +
" mini_unit, " +
" isnull(weight, 1) drug_weight, " +
" weigh_unit drug_weight_unit, " +
" isnull(volum, 1) drug_volume, " +
" vol_unit drug_vol_unit, " +
" isnull(pack_size, 1) as pack_size, " +
" pack_unit, " +
" a.pack_retprice, " +
" national_code, " +
" cast(isnull(NULLIF(kjyw_flag, ''), 0) as int) as kjyw_flag, " +
" cast(isnull(NULLIF(yp_level, ''), 0) as int) as yp_level, " +
" cast(isnull(NULLIF(del_flag, ''), 0) as int) as del_flag, " +
" CASE " +
" WHEN isnull(b.open_virtual2, '') = '1' then isnull(b.stock_amount_virtual2, 0) " +
" else isnull(stock_amount, 0) end as stock_amount, " +
" cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy," +
" cast(isnull(NULLIF(kss_flag, ''), 0) as int) as kss_flag, " +
" deptRestrictions = (select count(1) from yp_zd_dept where code = yp_zd_dept.charge_code and dept_code = '${dept}')," +
" supplyCode = ( select isnull(del_flag, 0) from yz_supply_type where supply_code = '${supplyCode}') " +
"from yp_zd_dict a " +
" with (NOLOCK) " +
" left join yp_base_yf b on (code = b.charge_code and a.serial = b.serial) " +
"where rtrim(code) + rtrim(a.serial) + rtrim(group_no) = #{code} ")
XinZhenYzActOrder drugDataOne(String code, String dept, String supplyCode);
default XinZhenYiZhu queryPatientInfo(String patNo,
Integer times) {
XinZhenYiZhu xinZhenYiZhu = this.sqlQueryPatientInfo(patNo, times);
if(xinZhenYiZhu != null) {
Date birthDate = xinZhenYiZhu.getBirthDate();
if (birthDate != null) {
try {
xinZhenYiZhu.setAge(DateUtil.calculateAge(birthDate, xinZhenYiZhu.getAdmissDate()));
} catch (Exception ignore) {
}
}
}
return xinZhenYiZhu;
}
@Select("select rtrim(a.inpatient_no) as inpatient_no,\n" +
" admiss_times,\n" +
" rtrim(a.name) as name,\n" +
" rtrim(dept) as dept_code,\n" +
" a.sex,\n" +
" birth_date,\n" +
" rtrim(zk_ward) as ward_code,\n" +
" refer_physician,\n" +
" dept_director,\n" +
" times_billed,\n" +
" admiss_date,\n" +
" admiss_diag,\n" +
" small_dept,\n" +
" bed_no,\n" +
" zk_ward,\n" +
" ledger_sn = (select max(ledger_sn)\n" +
" from zy_ledger_file with (NOLOCK)\n" +
" where a.inpatient_no = zy_ledger_file.inpatient_no\n" +
" and a.admiss_times = zy_ledger_file.admiss_times),\n" +
" consult_physician,\n" +
" zy_serial_no\n" +
"from zy_actpatient a with (NOLOCK),\n" +
" a_patient_mi b\n" +
"where a.inpatient_no = b.inpatient_no\n" +
" and a.inpatient_no = #{patNo}\n" +
" and admiss_times = #{times}")
XinZhenYiZhu sqlQueryPatientInfo(@Param("patNo") String patNo,
@Param("times") Integer times);
@Select("")
List huoQuMuBan(@Param("code") String code,
@Param("inputId") String inputId,
@Param("deptCode") String deptCode,
@Param("muBanLeiXing") Integer muBanLeiXing,
@Param("currentPage") long currentPage);
@Select("select max(sort_no + 1) " +
"from yz_OrderPattern " +
"where input_id = #{code}")
Integer getMyTemplateMaxSortNo(String code);
@Select("")
long huoQuMuBanTotal(@Param("code") String code,
@Param("inputId") String inputId,
@Param("deptCode") String deptCode,
@Param("muBanLeiXing") Integer muBanLeiXing);
@Select("SELECT cast(cast(act_order_no as decimal) as varchar) id, " +
" act_order_no, " +
" rtrim(a.order_name) order_name, " +
" rtrim(a.order_code) order_code, " +
" a.frequ_code, " +
" frequ_code_name = (select rtrim(comm) " +
" from yz_order_frequency with (NOLOCK) " +
" where yz_order_frequency.code = a.frequ_code), " +
" a.drug_specification, " +
" a.supply_code, " +
" supply_code_name = (select rtrim(supply_name) " +
" from yz_supply_type with (NOLOCK) " +
" where yz_supply_type.supply_code = a.supply_code), " +
" a.drug_quan, " +
" a.instruction, " +
" a.mini_unit, " +
" mini_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = mini_unit), " +
" a.drug_weight, " +
" a.drug_weight_unit, " +
" a.parent_no, " +
" a.drug_volume, " +
" a.drug_vol_unit, " +
" a.dose, " +
" a.dose_unit, " +
" dose_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = dose_unit), " +
" a.exclu_act_order_no, " +
" a.discription, " +
" a.pattern_code, " +
" a.order_type, " +
" a.serial, " +
" self_buy=isnull(a.self_buy, '0'), " +
" del_flag=isnull(b.del_flag, ''), " +
" a.drug_flag, " +
" suprice_flag='', " +
" self_flag ='', " +
" parent_flag='', " +
" a.exec_unit, " +
" exec_unit_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_unit)," +
" group_no = '00', " +
" group_no_name = N'项目' " +
"FROM yz_pattern_order a with (NOLOCK), " +
" yz_order_item b with (NOLOCK) " +
"WHERE a.pattern_code = #{code} " +
" and isnull(a.group_no, '00') = '00' " +
" and a.order_code = b.order_code " +
" and b.order_class not in ('B','C','D') " +
"UNION " +
"SELECT cast(cast(act_order_no as decimal) as varchar) id," +
" act_order_no, " +
" a.order_name, " +
" a.order_code, " +
" a.frequ_code, " +
" frequ_code_name = (select rtrim(comm) " +
" from yz_order_frequency with (NOLOCK) " +
" where yz_order_frequency.code = a.frequ_code), " +
" a.drug_specification, " +
" a.supply_code, " +
" supply_code_name = (select rtrim(supply_name) " +
" from yz_supply_type with (NOLOCK) " +
" where yz_supply_type.supply_code = a.supply_code), " +
" a.drug_quan, " +
" a.instruction, " +
" b.pack_unit as mini_unit, " +
" mini_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = b.pack_unit), " +
" a.drug_weight, " +
" a.drug_weight_unit, " +
" a.parent_no, " +
" a.drug_volume, " +
" a.drug_vol_unit, " +
" a.dose, " +
" a.dose_unit, " +
" dose_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = dose_unit), " +
" a.exclu_act_order_no, " +
" a.discription, " +
" a.pattern_code, " +
" a.order_type, " +
" a.serial, " +
" self_buy=isnull(a.self_buy, case when b.jsy_flag = '1' then '3' else '0' end), " +
" del_flag=isnull(b.visible_flag_zy, ''), " +
" a.drug_flag, " +
" suprice_flag=b.suprice_flag, " +
" self_flag =b.self_flag, " +
" parent_flag='', " +
" a.exec_unit, " +
" exec_unit_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_unit)," +
" a.group_no, " +
" (select yp_zd_group_name.group_name " +
" from yp_zd_group_name " +
" where yp_zd_group_name.group_no = a.group_no) " +
"FROM yz_pattern_order a with (NOLOCK), " +
" view_yp_zd_dict_base_yf b with (NOLOCK) " +
"WHERE a.pattern_code = #{code} " +
" and a.group_no = b.group_no " +
" and a.order_code = b.code " +
" and a.serial = b.serial " +
" and isnull(b.visible_flag_zy, '') <> '1'")
List huoQuMuBanShuJu(String code);
@Select("select pattern_code," +
" rtrim(input_type) as input_type," +
" input_id " +
"from yz_OrderPattern with (NOLOCK) " +
"where pattern_name = #{patternName} " +
" and input_id = #{inputId}" +
" and input_type <> 4 ")
YzOrderPattern yuanLaiDeMuBanBianMa(@Param("patternName") String patternName,
@Param("inputId") String inputId);
@Delete("")
void shanChuLaoMuBan(@Param("patternCode") String patternCode);
@Insert("insert yz_OrderPattern (pattern_code, pattern_name, py_code, d_code, dept_code, " +
" ward_code, input_id, " +
" input_type, input_date, sort_no) " +
"values (#{patternCode},#{patternName},#{pyCode},#{dCode},#{deptCode},#{deptCode}," +
"#{inputId},#{inputType}," +
"getdate(),#{sortNo})")
void chaRuMuBan(YzOrderPattern param);
@Select("select count(1) " +
"from yz_OrderPattern " +
"where pattern_name = #{name} and input_id = #{userCode} ")
Integer duplicateTemplateName(@Param("name") String name,
@Param("userCode") String userCode);
@Insert("")
void chaRuMuBanShuJu(List list, String patternCode);
@Select("select * " +
"from yz_OrderPattern with (NOLOCK) " +
"where pattern_code = #{code}")
YzOrderPattern huoQuMuBanXinXi(@Param("code") String code);
@Update("update yz_OrderPattern " +
"set pattern_name = #{patternName}, " +
" py_code = #{pyCode}, " +
" d_code = #{dCode}, " +
" input_date = getdate()," +
" sort_no = #{sortNo} " +
"where pattern_code = #{patternCode} ")
void genXingMuBan(@Param("patternName") String patternName,
@Param("pyCode") String pyCode,
@Param("dCode") String dCode,
@Param("patternCode") String patternCode,
@Param("sortNo") Integer sortNo);
@Select("select rtrim(dept_code) from a_employee_mi where code = '${code}'")
String userDeptCode(@Param("code") String code);
@Delete("/* 父模板 */ " +
"delete yz_OrderPattern " +
"where pattern_code = #{patternCode}; " +
"/* 模板下面的数据 */ " +
"delete yz_pattern_order " +
"where pattern_code = #{patternCode} ")
void shanChuMuBan(@Param("patternCode") String patternCode);
@Select("select pattern_code " +
"from yz_OrderPattern " +
"where collect_code = #{patternCode} and input_id = #{userId}")
String whetherToSaveTheDoctorSOrderTemplate(@Param("patternCode") String patternCode,
@Param("userId") String userId);
@Select("select collect_code " +
"from yz_OrderPattern with (NOLOCK) " +
"where input_id = #{inputId} " +
" and collect_code = #{collectCode} ")
String chongFuShouCang(@Param("inputId") String inputId,
@Param("collectCode") String collectCode);
@Insert("insert into yz_OrderPattern (pattern_code, pattern_name, py_code, d_code, dept_code, ward_code, " +
" input_id, input_type, input_date, sort_no, collect_code) " +
"values (#{patternCode},#{patternName},#{pyCode},#{dCode},#{deptCode},#{deptCode},#{inputId},'4',getdate(),0,#{collectCode});")
void chaRuShouCang(@Param("patternCode") String patternCode,
@Param("patternName") String patternName,
@Param("pyCode") String pyCode,
@Param("dCode") String dCode,
@Param("deptCode") String deptCode,
@Param("inputId") String inputId,
@Param("collectCode") String collectCode);
@Delete("delete yz_act_record_kss where act_order_no = #{orderNo}")
void deleteAntimicrobialInformation(String orderNo);
@Insert("insert into yz_act_record_kss " +
"(act_order_no, charge_code, input_id, inpatient_no, " +
"admiss_times, yyfs, ssqk, yysj)" +
"values " +
"(#{orderNo},#{kss.chargeCode},#{userCode},#{patNo}," +
"#{times},#{kss.yyfs},#{kss.ssqk},#{kss.yysj})")
void insertAntimicrobialInformation(String orderNo,
YzActRecordKss kss,
String userCode,
String patNo,
Integer times);
@Delete("delete zy_order_zk where act_order_no = #{orderNo}")
void deleteTransferOrder(String orderNo);
@Insert("insert into zy_order_zk (act_order_no, old_ward, " +
"old_dept, new_ward, new_dept) " +
"values (#{actOrderNo},#{oldWard},#{oldDept},#{newWard},#{newDept})")
void insertDoctorSOrder(ZyOrderZk zk);
@Select("execute dbo.xc_zy_order_fee;1 @in_no = #{patNo}, @in_times = #{times}")
List expensesForGettingADoctorSOrder(@Param("patNo") String patNo,
@Param("times") Integer times);
@Update("UPDATE zy_actpatient " +
"SET refer_physician = #{param.referPhysician}, " +
" consult_physician = #{param.consultPhysician}, " +
" dept_director = #{param.deptDirector} " +
"WHERE inpatient_no = #{param.inpatientNo} " +
" AND admiss_times = #{param.admissTimes} ")
void updateTheThirdLevelDoctor(@Param("param") Overview param);
@Update("update yz_act_order " +
" set " +
" parent_no = ${order.actOrderNo}," +
" order_time = #{order.orderTime,jdbcType=TIMESTAMP}, " +
" start_time = #{order.startTime,jdbcType=TIMESTAMP}, " +
" end_time = #{order.endTime,jdbcType=TIMESTAMP}, " +
" supply_code = dbo.get_child_supply(${order.actOrderNo}), " +
" frequ_code = #{order.frequCode}," +
" group_no = #{order.groupNo} " +
"where act_order_no = ${children} " +
" and status_flag = '1' ")
void associateOrders(BigDecimal children, XinZhenYzActOrder order);
@Select("SELECT a.gen_time, " +
" inpatient_no, " +
" admiss_times, " +
" ledger_sn, " +
" a.detail_sn, " +
" a.charge_date, " +
" a.charge_code_mx, " +
" charge_code_name = (case " +
" when serial = '99' or serial = '01' " +
" then (select top 1 rtrim(name) " +
" from yp_zd_dict " +
" where code = charge_code_mx " +
" and yp_zd_dict.serial = a.serial) " +
" else (select rtrim(name) from zd_charge_item where code = charge_code_mx) end), " +
" a.charge_fee, " +
" a.charge_status, " +
" a.serial, " +
" charge_amount=a.charge_amount, " +
" exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
" dept_code = (select name from zd_unit_code where code = a.ward_code), " +
" isnull(a.ori_detail_sn, 0) as ori_detail_sn " +
"FROM zy_detail_charge a " +
"where abs(order_no) = #{yz.actOrderNo} " +
" and inpatient_no = #{yz.inpatientNo} " +
" and admiss_times = #{yz.admissTimes} " +
"order by charge_date desc ")
List selectOrderFee(@Param("yz") XinZhenYzActOrder yz);
@Update("update yz_act_order " +
"set modifier = #{userCode}, " +
" end_time = #{param.date}, " +
" exclu_act_order_no = #{param.orderNo} " +
"where inpatient_no = #{param.patNo} " +
" and admiss_times = #{param.times} " +
" and status_flag in ('3', '4') " +
" and frequ_code <> 'ONCE' " +
" and end_time is null")
int oneClickStopOrder(@Param("param") OneClickOrder param,
@Param("userCode") String userCode);
@Insert("insert into yz_act_order (act_order_no, inpatient_no, admiss_times, order_code, order_time, frequ_code, enter_time, " +
" enter_oper, start_time, end_time, infant_flag, drug_flag, " +
" physician, confirm_time, signer, modifier, status_flag, status_time, " +
" instruction, order_name, pay_self, serial, group_no, ward_code, " +
" doctor_flag, dept_code, exec_unit, zy_serial_no, refer_physician, consult_physician) " +
"values (#{one.orderNo}, #{one.patNo}, #{one.times}, '10507', #{one.nowDate}, 'ONCE', #{one.nowDate}," +
" #{one.userCode},#{one.nowDate}, null, #{p.infantFlag}, 'o'," +
" #{one.userCode}, #{one.nowDate}, #{one.userCode}, #{one.userCode}, '5', #{one.nowDate}," +
" '一键停止医嘱' + N'${one.dateStr}' , #{one.name}, '0','00', '00', #{p.deptCode}, '1', #{p.deptCode}, #{p.zkWard}, '', #{p.referPhysician}, #{p.consultPhysician})")
void insertOneClickStopOrder(@Param("one") OneClickOrder one,
@Param("p") XinZhenYiZhu p);
@Select("select rtrim(a.name) as name, a.code, a.code_rs, cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel " +
"from dj_user_base dj, " +
" a_employee_mi a " +
"where dj.code = a.code " +
" and isnull(a.del_flag, '0') = '0' " +
" and a.code = #{us.code} " +
" and dj.password = #{us.password} ")
DoctorAuthRest doctorAuthorizationLogin(@Param("us") DoctorAuthParams us);
@Select("select code_rs, code, name, cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel\n" +
"from a_employee_mi\n" +
"where code = #{us.code}\n" +
" and emr_sign_pwd = #{us.signCode}")
DoctorAuthRest doctorAuthorizationLoginByEmrSignPwd(@Param("us") DoctorAuthParams us);
@Select("select isnull(yp_level, 0) " +
"from yp_zd_dict " +
"where code + '_' + serial = '${code}'")
Integer selectYpLevel(@Param("code") String code);
@Select("update new_act_order_recording " +
"set authorized_doctor = #{userCode} " +
"where act_order_no = #{orderNo}")
void updateAuthorizedDoctor(@Param("orderNo") BigDecimal orderNo,
@Param("userCode") String userCode);
@Update("update yz_act_order set instruction = cast('${str}' as char(100)) where act_order_no = #{order} ")
void updateOrderInstruction(@Param("order") BigDecimal order,
@Param("str") String str);
@Select("select count(1) from yz_order_frequency where code = #{code}")
int getTheFrequency(@Param("code") String code);
@Select("select item_name, order_code , count from yz_zd_order_item_confirm ")
List selectYzItemConfirm();
@Select("select count(1) from yz_act_order where inpatient_no = '${patNo}' and admiss_times = ${times} and " +
"order_code = '${orderCode}' and serial = '00'")
Integer selectCountByOrderCode(String patNo, Integer times, String orderCode);
@Select("SELECT 收费编码=a.occ_code , \n" +
" 项目名称=b.name , \n" +
"\t\t 数量=a.amount ,\n" +
" 单价=b.charge_amount ,\n" +
"\t\t 个人自付比例=cast(cast(selfpay_prop as decimal(10,2))*100 as varchar)+'%',\n" +
"\t\t 医保说明=isnull(b.connotation,'无')+'|'+isnull(b.descriptions,'无'),\n" +
"\t\t 医保编码=national_code \n" +
" FROM yz_order_occurence a ,zd_charge_item b\n" +
"where a.order_code='${code}' and \n" +
" a.occ_code=b.code ")
List getItemInstructions(String code);
@Select("select case when a.serial = '00' then c.occ_code else a.order_code end\n" +
"from yz_act_order a\n" +
" left join yz_order_occurence c on (a.serial = '00' and a.order_code = c.order_code)" +
" ${ew.customSqlSegment} ")
Set selectOrderCode(@Param(Constants.WRAPPER) Wrapper> qw);
@Select("select order_code\n" +
"from yz_zd_order_item_confirm\n" +
"where item_name = #{name}")
Set getOrderCodeByName(String name);
@Select("select count(1)\n" +
"from yz_act_order\n" +
"where inpatient_no = '0434706'\n" +
" and admiss_times = 1\n" +
" and start_time >= #{start}\n" +
" and act_order_no <> #{orderNo} ;")
Integer prescribeMedicalAdviceAfterDischarge(String patNo,
Integer times, Date start, BigDecimal orderNo);
@Select("select top 1 start_time, act_order_no\n" +
" from yz_act_order a\n" +
" where a.inpatient_no = #{patNo}\n" +
" and a.admiss_times = #{times}\n" +
" and a.order_code in (select order_code\n" +
" from yz_zd_order_item_confirm\n" +
" where item_name = N'出院')\n" +
" and serial = '00'\n" +
" order by start_time desc")
YzActOrder selectFinallyOutOrderInfo(String patNo,
Integer times);
@Select("select top 1 ward_code\n" +
"from op_record\n" +
"where inpatient_no = #{patNo}\n" +
" and admiss_times = #{times}\n" +
"order by op_times desc")
String getOpRecordWard(String patNo, Integer times);
@Update("update zy_detail_charge\n" +
"set ward_code = '${ward}'\n" +
"where inpatient_no = '${patNo}'\n" +
" and admiss_times = ${times}\n" +
" and ward_code = '${ssWard}'")
void updateChargeWard(String patNo, Integer times, String ward, String ssWard);
@Select("select *\n" +
"from zd_charge_limitations\n" +
"where charge_code = '${code}'")
ChargeLimitations hasCharge(String code);
@Select("select a.limit_day, limit_times, convert(varchar(10), charge_date, 21) as charge_date " +
"from zd_charge_limitations a,\n" +
" zy_detail_charge b\n" +
"where a.charge_code = '${chargeCode}'\n" +
" and b.inpatient_no = '${patNo}'\n" +
" and b.admiss_times = ${times} \n" +
" and a.charge_code = b.charge_code_mx\n" +
" and ledger_sn = ${ledgerSn}\n" +
" and ori_detail_sn is null\n" +
" and a.del_flag <> '1'\n" +
" and isnull(yb_self_flag, '0') != '1' " +
"group by charge_date, limit_day, limit_times")
List getChargeDay(String patNo, Integer times, Integer ledgerSn, String chargeCode);
@Select("select group_no, group_name,start_time, end_time " +
"from yp_zd_group_name\n" +
"where zy_flag = 1\n" +
" and del_flag = 0\n" +
" and xy_flag = 1")
List selectYpZdGroup();
@Select("select group_no, group_name,start_time, end_time " +
"from yp_zd_group_name\n" +
"where zy_flag = 1\n" +
" and del_flag = 0\n" +
" and zcy_flag = 1")
List selectYpCyGroup();
@Select("select id, code, discharge_days " +
"from exceeding_discharge_days\n" +
"where code = #{code}")
List selectExceedingDischargeDays(String code);
}