create or replace function SF_ZY_GETFYMXYBXMFDBZ(
  PMXID00    number     --费用明细id
)
return varchar2  is
-- MODIFICATION HISTORY
-- Person      Date        Comments
-- liwm    2022.08.03  Create 移植泽涛实现获取费用明细医保项目标志ZYSF9EX-20220801-001
  ls_YBXMBZ    varchar2(10);    --医保项目标志, 0旧1新
  ls_CZRQ00    varchar2(8);     --操作日期
  ls_QYBZ00    BM_TYZD00.MC0000%type;
  ls_SFQY00    varchar2(10);
  ls_QYRQ00    varchar2(10);
begin
  
  ls_YBXMBZ := '1';    --默认新项目
  ls_CZRQ00 := null;
  
  ls_QYBZ00 := SF_XT_TYZD00('医保新接口参数设置','SFQYYBXMBMARQFDQYGN');
  ls_SFQY00 := SF_XT_RETURNINDEXEH(ls_QYBZ00,',',1);
  if ls_SFQY00 not in ('2','3') then
    return ls_YBXMBZ;
  end if;
  ls_QYRQ00 := SF_XT_RETURNINDEXEH(ls_QYBZ00,',',2);
  if ls_QYRQ00 is null then
    return ls_YBXMBZ;
  end if;
  
  begin
    select CZRQ00 into ls_CZRQ00 from ZY_FYMX00 where MXID00=PMXID00;
  exception
    when others then
      ls_CZRQ00 := null;
  end;
  
  if ls_CZRQ00 is null then
    ls_YBXMBZ := '1';
  else
    if ls_CZRQ00 < ls_QYRQ00 then
      ls_YBXMBZ := '0';
    else
      ls_YBXMBZ := '1';
    end if;
  end if;
  
  return ls_YBXMBZ;
  
end;
