create or replace function SF_SF_GETQYPDXHBYJZDH ( ad_BRID00 number, ad_JZDH00 number ) -- MODIFICATION HISTORY -- Person Date Comments -- jlg 2019.09.12 created 获取门诊结算发票对应取药排队号信息 MZSF9-20190906-001 -- jlg 2021.04.19 c.PHBZ00 in ('0','2','3') -->c.PHBZ00 in ('0','2','3','5') MZSF9-20210418-003 -- linzetao 2021.04.22 处理不同的取药信息格式 MZSF9-20210421-001 -- linzetao 2021.04.22 同一窗口多个取药号时只显示一次窗口名称 MZSF9-20210422-001 return varchar2 is Vpdxh00 varchar2(800); Vdtpdxx varchar2(100); --单条排号信息 Vqyxxgs BM_TYZD00.MC0000%type; --发票显示取药排队号信息格式 /*cursor CUR_SF_CKPDXH is select c.CKMC00,c.PYDLMC,c.FYDLXH,count(1) as CFZS00 from SF_BRFY00 a,VW_YF_PDPRINT c where a.BRID00 = c.BRID00 and a.DJH000 = c.DJH000 and c.BRID00 = ad_BRID00 --这里要用c.BRID00才会快 and a.JZDH00 = ad_JZDH00 and c.PHBZ00 in ('0','2','3','5') --5自助机 and c.BCCFH0 is null and not exists(select 1 from YF_MZCF00 where BRID00 = c.BRID00 and BCCFH0 = c.CFLSH0) group by c.CKMC00,c.PYDLMC,c.FYDLXH order by c.CKMC00,c.PYDLMC,c.FYDLXH;*/ cursor CUR_SF_CKPDXH is select c.CKMC00,c.PYDLMC,wm_concat(c.FYDLXH) FYDLXH,count(1) as CFZS00 from SF_BRFY00 a,VW_YF_PDPRINT c where a.BRID00 = c.BRID00 and a.DJH000 = c.DJH000 and c.BRID00 = ad_BRID00 --这里要用c.BRID00才会快 and a.JZDH00 = ad_JZDH00 and c.PHBZ00 in ('0','2','3','5') --5自助机 and c.BCCFH0 is null and not exists(select 1 from YF_MZCF00 where BRID00 = c.BRID00 and BCCFH0 = c.CFLSH0) group by c.CKMC00,c.PYDLMC order by c.CKMC00,c.PYDLMC; begin Vpdxh00:= null; Vqyxxgs := nvl(SF_XT_TYZDMC('取药队列字典','FPXSQYPDHXXGS'),'0'); for pdxh in CUR_SF_CKPDXH loop if Vqyxxgs = '1' then Vdtpdxx:= pdxh.CKMC00||pdxh.FYDLXH; --2021.4.20 现场修改,不需要原来拼接的文字 elsif Vqyxxgs = '0' then Vdtpdxx:= '窗口:'||pdxh.CKMC00||' 取药号:'||pdxh.FYDLXH; --Vdtpdxx:=' 取药号:'||pdxh.FYDLXH; else Vdtpdxx:=' 取药号:'||pdxh.FYDLXH; end if; if Vpdxh00 is null then Vpdxh00:=Vdtpdxx; else Vpdxh00:=Vpdxh00||';'||Vdtpdxx; end if; end loop; return Vpdxh00; end; / ---修改通用字典 update bm_tyzd00 t set bz0000='发票显示取药排队号信息格式, 0-窗口:CKMC00 取药号:FYDLXH, 1-CKMC00 FYDLXH,2-取药号:FYDLXH 默认0' where zdmc00='取药队列字典' and bh0000='FPXSQYPDHXXGS'