package thyyxxk.webserver.dao.his.executeItem;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import thyyxxk.webserver.entity.executeItem.YzActOcc;

/**
 * (YzActOcc)表数据库访问层
 *
 * @author lihong
 * @since 2024-01-08 16:13:37
 */
@Mapper
public interface YzActOccDao extends BaseMapper<YzActOcc> {
    /**
     * @description: status_flag 改为删除状态  生成药品或生成诊疗后最后执行的更新状态
     * @author: lihong
     * @date: 2024/1/8 17:32
     * @param: wardCode
     * @return: int
     **/
    @Update(" update yz_act_occ " +
            " set status_flag ='d' " +
            " from yz_act_order " +
            " where yz_act_occ.dept_code = '8000002' " +
            "  and yz_act_occ.ward_code = '8000002' " +
            "  and yz_act_occ.occ_time > yz_act_order.end_time " +
            "  and (yz_act_occ.status_flag <> 'd' or yz_act_occ.status_flag is null) " +
            "  and yz_act_order.frequ_code <> 'ONCE' " +
            "  and (yz_act_occ.act_order_no = yz_act_order.act_order_no or - yz_act_occ.act_order_no = yz_act_order.act_order_no)")
    int updateStatusFlag(String wardCode);

}

