CREATE OR REPLACE FUNCTION SF_YJ_ESBPACS_YLZCL(Pyjdjh0 varchar2,Pid0000 varchar2) --门诊PACS传的是医技单据号;住院PACS传的是EMR的申请单号和项目号,不过OBR-2申请单号,ORC-2项目号 正确 --门诊、住院 心电 传的是EMR申请单号和项目号,ORC-2申请单号,OBR-2项目号 正确 --门诊、住院 病理 传的是EMR申请单号和项目号,ORC-2申请单号,OBR-2项目号 正确 -- modification history -- Person Date Comments -- qks 2016.01.08 create by YJ9-20160122-001 -- daihq 2016.02.15 病人基本信息PID串格式修改 -- daihq 2016.02.17 修改检验申请单的处理PID、PV1、OBR格式不同 -- daihq 2016.02.19 增加项目状态的转换为接口文档对应状态的处理,YJ_YW0000改成使用视图VW_YJ_YW0000_JCPT -- yanghq 2020.03.24 长乐区医院专用 return varchar2 is Vresult varchar2(4000); Vitem VW_YJ_ESBPACS%rowtype; VMRN000 ZY_BRXXB0.MRN000%type; VGSDJH0 ZY_BRXXB0.GSDJH0%type; VRYLB00 ZY_BRXXB0.RYLB00%type; VRYSQK0 ZY_BRXXB0.RYSQK0%type; VBRRYCS ZY_BRXXB0.BRRYCS%type; VSJRYRQ ZY_BRXXB0.SJRYRQ%type; VRYFS00 ZY_BRXXB0.RYFS00%type; VZDM000 YS_BRZDXX.ICD900%type; VZDMC00 YS_BRZDXX.ZDMC00%type; VZDRQ00 YS_BRZDXX.ZDRQ00%type; VZDLB00 YS_BRZDXX.ZZDBZ0%type; VZDXXID YS_BRZDXX.ZDXXID%type; VSQDH00 varchar2(50); VYJLRBZ YJ_YW0000.YJLRBZ%type; VSFDJH0 YJ_YW0000.SFDJH0%type; VJCLBID BM_ZLZD00.JCLBID%type; VJCLBMC BM_JCLB00.JCLBMC%type; VYJKSBH YJ_YW0000.YJKSBH%type; VESBKS0 XT_XTCS00.VALUE0%type; VKMH000 IC_YHXX00.KMH000%type; VORC1 varchar2(20); VORC5 varchar2(20); VORC13 varchar2(100); VOBR2 varchar2(50); VPV2 varchar2(20); --2患者类别(默认I) VExamine varchar2(100); --场景 vcount0 number; VJSXT00 YJ_DFSSQD.JSXT00%type; VJSMK00 YJ_DFSSQD.JSMK00%type; VLBBH00 BM_ZLZD00.LBBH00%type; VCZRQ00 YJ_DFSSQD.CZRQ00%type; VCZSJ00 YJ_DFSSQD.CZSJ00%type; VMsgType varchar2(100); VOBRStr varchar2(1000); VPIDStr varchar2(1000); VPV1Str varchar2(1000); VXMZT00 YJ_DFSSQD.XMZT00%type; VPV2Str varchar2(1000); VSFYE00 varchar2(1); VYXJ000 varchar2(2); VYJKSMC BM_BMBM00.BMMC00%type; VTYDWMC BM_BRXXB0.TYDWMC%type; VICKH00 IC_YHXX00.ICKH00%type; VFJH000 BM_CWK000.FJH000%type; VDQBQ00 BM_BMBM00.BMBH00%type; VDQBQMC BM_BMBM00.BMMC00%type; VDQKS00 BM_BMBM00.BMBH00%type; VDQKSMC BM_BMBM00.BMMC00%type; VYYQC00 xt_yyxx00.YYQC00%type; VJZRQSJ varchar2(30); VYZCFID varchar2(30); VORCStr varchar2(1000); VDG1Str varchar2(1000); VKDBQMC BM_BMBM00.BMMC00%type; VKDKSMC BM_BMBM00.BMMC00%type; VBS0000 ys_mzblws.BS0000%type; VTZ0000 ys_mzblws.TZ0000%type; VZDYS00 YS_BRZDXX.JZYS00%type; VZDYSXM YS_BRZDXX.JZYSXM%type; VZLXMBW varchar2(200); --诊疗项目名称+(部位) VTEMP varchar2(100); begin VOBRStr:=''; VPIDStr:=''; VPV1Str:=''; select nvl(max(a.SFDJH0),0),nvl(max(b.JCLBID),'0'),nvl(max(a.YJKSBH),0),nvl(max(LBBH00),0) into VSFDJH0,VJCLBID,VYJKSBH,VLBBH00 from VW_YJ_YW0000_JCPT a,bm_zlzd00 b where a.YJDJH0=Pyjdjh0 and a.zlxmid=b.zlxmid; if (VJCLBID='0' or VSFDJH0=0) and VLBBH00 not in (3,4) and VYJLRBZ<>'T' then return ''; end if; select JSXT00,JSMK00,FSCJ00,CZRQ00,CZSJ00,XMZT00 into VJSXT00,VJSMK00,VExamine,VCZRQ00,VCZSJ00,VXMZT00 from YJ_DFSSQD where ID0000=Pid0000; select count(*) into vcount0 from YJ_DFSSQD where YJDJH0=Pyjdjh0 and ID00000 then return ''; end if; VESBKS0 := 'N'; select nvl(max(trim(VALUE0)),'N') into VESBKS0 from xt_xtcs00 where name00='YJ_ESBFWDZKS'; if VESBKS0<>'N' then VESBKS0 := trim(nvl(substr(VESBKS0,instrb(VESBKS0,'|')+1,length(VESBKS0)),'N')); end if; if instrb('|'||VESBKS0||'|','|'||VYJKSBH||'|')<=0 and VESBKS0<>'Y' then return ''; end if; begin select JCLBMC into VJCLBMC from BM_JCLB00 where JCLBID=VJCLBID; exception when others then VJCLBMC:='检验' ; end; select * into Vitem from VW_YJ_ESBPACS where YJDJH0 = Pyjdjh0; VYXJ000:='R'; if Vitem.JZBZ00='Y' then VYXJ000:='S'; end if; --select nvl(max(trim(KMH000)),'') into VKMH000 from ic_yhxx00 where brid00=Vitem.brid02 and ZT0000='1'; select nvl(max(trim(ICKH00)),'') into VKMH000 from ic_yhxx00 where brid00=Vitem.brid02 and ZT0000='1'; if Vitem.mzzybz = '1' then select MRN000,GSDJH0,RYLB00,RYSQK0,BRRYCS,SJRYRQ,RYFS00 into VMRN000,VGSDJH0,VRYLB00,VRYSQK0,VBRRYCS,VSJRYRQ,VRYFS00 from zy_brxxb0 where ZYID00=Vitem.ZYGHID; select max(ID0000) into VZDXXID from (select a.* From BQ_BRZDXX a where ZYID00=Vitem.ZYGHID order by decode(ZDLB00,'3','0','4','1','2','2','1','3',ZDLB00)) a where rownum=1; if VZDXXID is not null then select ZDM000,ZDMC00,ZDRQ00,ZDLB00 into VZDM000,VZDMC00,VZDRQ00,VZDLB00 from BQ_BRZDXX where ID0000=VZDXXID; end if; VPV2 := '3'; else select max(ZDXXID) into VZDXXID from (select a.* From YS_BRZDXX a where GHH000=Vitem.ZYHGHH order by decode(ZZDBZ0,'3','0','4','1','1','2','2','3',ZZDBZ0)) a where rownum=1; if VZDXXID is not null then select ICD900,ZDMC00,ZDRQ00,ZZDBZ0 into VZDM000,VZDMC00,VZDRQ00,VZDLB00 from YS_BRZDXX where ZDXXID=VZDXXID; end if; VPV2 := '1'; end if; if Vitem.SL0000 >0 then VORC1 := 'NW'; elsif Vitem.SL0000 <0 then VORC1 := 'CA'; end if; VSQDH00:=Pyjdjh0; ------------------------------------------------------------------------- --收费发 2 --退费发 3 --执行发15 if VXMZT00='2' then VORC5:= '2'; if VExamine='Examine_Form_Update_MUSE' then VORC1:='RG'; end if; elsif VXMZT00='3' then VORC5:= '15'; if VExamine='Examine_Form_Update_MUSE' then VORC1:='RG'; elsif VExamine like'%_PEIS%' then VORC5:= '2'; end if; end if; if (nvl(Vitem.SL0000,0)<0) and (nvl(Vitem.SFDJH0,0)>0) then--退费 VORC5:= '3'; if VExamine='Examine_Form_Update_MUSE' then VORC1:='CA'; end if; end if; /* --HIS:项目状态, '0'申请'1'计价'2'已收费'3'已执行'4'已报告'5'疑退'6'作废 --PACS用以下数据:0=预约 1=申请2=收费3=退费4=登记 5=检查 6=审核 7=打印 8=作废 --LIS用以下数据: 0=预约 1=申请2=收费3=退费4=备管 5=采集 6=签收7=退回8=排样9=审核 11=作废 12=打印 if (VXMZT00='0') or (VXMZT00='1') then VORC5 := '1'; --if VJSXT00='PIS' and VXMZT00='1' then--新加的 -- VORC5:= '2'; --end if; elsif (VXMZT00='2') then VORC5 := '2'; elsif (VXMZT00='3') then VORC5 := '4'; elsif (VXMZT00='4') then return ''; elsif (VXMZT00='5') or (VXMZT00='6') or (VXMZT00='9') then --中间表9表示删除 if VJSXT00='PACS' then VORC5 := '8'; elsif VJSXT00='LIS' then VORC5 := '11'; end if; elsif (VXMZT00='8') then --中间表8表示退费 VORC5 := '3'; elsif (VXMZT00='10') then --中间表10表示退费 申请 VORC5 := '3'; elsif (VXMZT00='11') then --中间表11表示撤销退费 申请 VORC5 := '14'; end if; if VExamine in('Test_Form_Update','Examine_Form_Update','Pathological_Form_Update','Examine_Form_Update_MUSE') then if VXMZT00='3' then VORC5:= '2'; end if; end if; */ ------------------------------------------------------------------------- VSFYE00:='N'; if Vitem.YEXM00 is null then VSFYE00:='Y'; end if; if (VJSXT00 in('LIS','PIS')) then VPV2Str:=chr(13)||'PV2||||||||||||||||||||||||||||||||||||'||VSFYE00; end if; begin if Vitem.mzzybz = '1' then if Vitem.SL0000 >0 then select WBZID0,WBYZID into VSQDH00,VOBR2 from SD_DZBLJK.BLJK_YZJKB0 where YZMXID=(select YZCFID from YJ_YW0000 where YJDJH0=Vitem.YJDJH0 and ZLXMID=Vitem.ZLXMID) and rownum=1; -- select WBYZID,WBZID0 into VSQDH00,VOBR2 from SD_DZBLJK.BLJK_YZJKB0 where YZMXID=(select YZCFID from YJ_YW0000 where YJDJH0=Vitem.YJDJH0 and ZLXMID=Vitem.ZLXMID) and rownum=1; --select WBZID0,WBYZID from SD_DZBLJK.BLJK_YZJKB0 where YZMXID=Vitem.YZCFID and rownum=1; elsif Vitem.SL0000 <0 then select WBZID0,WBYZID into VSQDH00,VOBR2 from SD_DZBLJK.BLJK_YZJKB0 where YZMXID=(select YZCFID from YJ_YW0000 where YJDJH0=Vitem.CXDJH0 and ZLXMID=Vitem.ZLXMID) and rownum=1; end if; else if Vitem.SL0000 >0 then -- select ORC_2,OBR_2 into VSQDH00,VOBR2 from bljk_yzblb0 where CFID00=Vitem.YJDJH0 and CFLSH0=Vitem.YJDJH0 and rownum=1; select WBZID0,WBYZID into VSQDH00,VOBR2 from SD_DZBLJK.BLJK_YW0000 where ZYHGHH=Vitem.ZYHGHH and YJDJH0=Vitem.YJDJH0 and ZLXMID=Vitem.ZLXMID and rownum=1; elsif Vitem.SL0000 <0 then --select ORC_2,OBR_2 into VSQDH00,VOBR2 from bljk_yzblb0 where CFID00=Vitem.CXDJH0 and CFLSH0=Vitem.CXDJH0 and rownum=1; select WBZID0,WBYZID into VSQDH00,VOBR2 from SD_DZBLJK.BLJK_YW0000 where ZYHGHH=Vitem.ZYHGHH and YJDJH0=Vitem.CXDJH0 and ZLXMID=Vitem.ZLXMID and rownum=1; end if; end if; if (VExamine='Examine_Form_Update') and (Vitem.mzzybz='0') then if (nvl(Vitem.SL0000,0)>0) then VSQDH00:=Pyjdjh0; else VSQDH00:=Vitem.CXDJH0; end if; end if; exception when others then VSQDH00:=Pyjdjh0; VOBR2:=Pyjdjh0; end; --体检比较特殊,冲销的单子传原单号 if (VExamine='Examine_Form_Update_PEIS_MUSE') or (VExamine='Examine_Form_Update_PEIS') then VSQDH00:=Vitem.CXDJH0; VOBR2:=Vitem.CXDJH0; end if; if (VExamine='Test_Form_Update') or (VExamine='Examine_Form_Update') or (VExamine='Pathological_Form_Update') then if VExamine='Examine_Form_Update' and vitem.mzzybz='1' then VTEMP:= VOBR2; VOBR2:= VSQDH00; VSQDH00:= VTEMP; end if; --门诊PACS传的是医技单据号;住院PACS传的是EMR的申请单号和项目号,不过OBR-2申请单号,ORC-2项目号 正确 --门诊、住院 心电 传的是EMR申请单号和项目号,ORC-2申请单号,OBR-2项目号 正确 --门诊、住院 病理 传的是EMR申请单号和项目号,ORC-2申请单号,OBR-2项目号 正确 VPIDStr := 'PID|||'||Vitem.BRID00||'^'||Vitem.BRZJLX||'^'||trim(Vitem.BRZJBH)||'||'||Vitem.BRXM00; VPV1Str := 'PV1|1|'||VPV2||'|||||||||||||||||' ||trim(Vitem.ZYGHID)|| '^^^^|||||||||||||||||||||||||||||||'||trim(Vitem.ZYHGHH)||'^^^^'; if VLBBH00=4 then VMsgType:='OML^O21^OML_O21'; VOBRStr:='OBR|1|'||VOBR2||'||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'||||||||||||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||||||'|| Vitem.ZJE000||'^|||||||||||'||Vitem.ZXR000||'&'||Vitem.ZXRXM0||'^^^^^^^'||Vitem.YJKSBM||'^|||'||Vitem.TXM000||'|||||||||'||Vitem.BBID00||'^'||Vitem.BBMC00; else VMsgType:='OMG^O19^OMG_O19'; VOBRStr:='OBR|1|'||VOBR2||'||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'^^'||Vitem.JCZLMC||'||||||||||||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||||||'|| Vitem.ZJE000||'^|||||||||||'||Vitem.ZXR000||'&'||Vitem.ZXRXM0||'^^^^^^^'||Vitem.YJKSBM||'^||'; end if; Vresult := 'MSH|^~'||'\'||'&|HIS|医技|'||VJSXT00||'|'||'接收模块'||'|'||to_char(systimestamp,'YYYYMMDDHH24MISS.FF3')||'|T|'||VMsgType||'|'||VExamine||'-'||to_char(systimestamp,'YYYYMMDDHH24MMSSFF3')||'|P|2.7'|| chr(13)||VPIDStr|| chr(13)||VPV1Str||VPV2Str|| chr(13)||'ORC|'||VORC1||'|'||VSQDH00||'|||'||VORC5||'||||'||Vitem.KDRQ00||replace(Vitem.KDSJ00,':','')||'|'||Vitem.KDYS00||'^'||Vitem.LRXM00||'|^|'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||||'||Vitem.KDKSBH||'^||||||||||||^^^'||VJCLBID||'^'||VJCLBMC||'^^^|||'|| chr(13)||'TQ1||'||Vitem.SL0000||'|||||||'||VYXJ000|| chr(13)||VOBRStr|| chr(13)||'DG1|1||'||VZDM000||'^'||VZDMC00||'^||'||VZDRQ00||'|'||VZDLB00||'||||||||||^'; elsif (VExamine='Examine_Form_Send_PEIS') or (VExamine='Examine_Form_Update_PEIS') then--体检 select BMMC00 into VYJKSMC from BM_BMBM00 where BMBH00=Vitem.YJKSBM and rownum=1; VPIDStr := 'PID|||'||Vitem.BRID00||'^^^^~'||VKMH000||'^^^^~'||Vitem.BRZJBH||'^^^^'||Vitem.BRZJLX||'~^^^^||'||Vitem.BRXM00||'||'||Vitem.BRCSRQ||'|'||Vitem.BRXB00||'|||||'||substrb(Vitem.BRDH00,1,18)||'^^PH'; VPV1Str := 'PV1|1|'||'4'||'|^^&^'||Vitem.YJKSBH||'||||^^^^^^^^^||||||||||||'|| trim(Vitem.ZYHGHH)||'^^^^PEID|||||||||||||||||||||||||||||||'||trim(Vitem.ZYHGHH)||'^^^^||'; VPV2Str := 'PV2|||||||||||||||||||||||^^^^^^^^^'; VMsgType:='OMG^O19^OMG_O19'; VOBRStr:='OBR|1|'||VOBR2||'||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'^^'||Vitem.JCZLMC||'||||||||||||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||||||'|| Vitem.ZJE000||'^|'||Vitem.YJKSBM||'^'||VYJKSMC||'||||||||||'||Vitem.ZXR000||'&'||Vitem.ZXRXM0||'^^^^^^^'||Vitem.YJKSBM||'^||'; Vresult := 'MSH|^~'||'\'||'&|HIS|医技|'||VJSXT00||'|'||'接收模块'||'|'||to_char(systimestamp,'YYYYMMDDHH24MISS.FF3')||'|T|'||VMsgType||'|'||VExamine||'-'||to_char(systimestamp,'YYYYMMDDHH24MMSSFF3')||'|P|2.7'|| chr(13)||VPIDStr|| chr(13)||VPV1Str|| chr(13)||VPV2Str|| chr(13)||'ORC|'||VORC1||'|'||VSQDH00||'|||'||VORC5||'||||'||substr(Vitem.KDRQ00,1,4)||substr(Vitem.KDRQ00,5,2)||substr(Vitem.KDRQ00,7,2)||replace(Vitem.KDSJ00,':','')||'|'||Vitem.KDYS00||'^'||Vitem.LRXM00||'||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|^^^^'||Vitem.KDKSBH||'^||||125^体检科||||||||^||||4^体检^^'||VJCLBID||'^'||VJCLBMC||'^^1^临嘱||||'|| chr(13)||'TQ1||'||Vitem.SL0000||'|||||||'||VYXJ000|| chr(13)||VOBRStr|| chr(13)||'DG1|1||'||VZDM000||'^'||VZDMC00||'^||'||VZDRQ00||'|'||VZDLB00||'||||||||||^'|| chr(13)||'OBX|||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'|||||||||||||||||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC; return Vresult; elsif VExamine='Examine_Critical_Confirm_PEIS' then Vresult:= SP_PEIS_ESB_TJWJZ1(Vitem.YJDJH0); return Vresult; elsif (VExamine='Examine_Form_Update_MUSE') or (VExamine='Examine_Form_Send_PEIS_MUSE') or (VExamine='Examine_Form_Update_PEIS_MUSE') then--省人民格式 --2019.02.14 select replace(nvl(max(trim(ICKH00)),''),max(b.KHQZBH),'') into VICKH00 from ic_yhxx00 a,ic_kldm00 b where a.brid00=Vitem.brid02 and a.ZT0000='1' and a.KLDH00=b.KLDH00; --2017.03.24 select max(YYQC00) into VYYQC00 from xt_yyxx00 where YYID00=(select YYID00 from BM_BMBM00 where BMBH00=VYJKSBH); if Vitem.mzzybz = '1' then select MRN000,GSDJH0,RYLB00,RYSQK0,BRRYCS,SJRYRQ,RYFS00, SXYS00,(select max(ZWXM00) from bm_ygbm00 where ygbh00=a.SXYS00),DQBQ00,DQKS00, (select BMMC00 from BM_BMBM00 where BMBH00=a.DQBQ00) DQBQMC, (select BMMC00 from BM_BMBM00 where BMBH00=a.DQKS00) DQKSMC into VMRN000,VGSDJH0,VRYLB00,VRYSQK0,VBRRYCS,VSJRYRQ,VRYFS00,VZDYS00,VZDYSXM,VDQBQ00,VDQKS00,VDQBQMC,VDQKSMC from zy_brxxb0 a where ZYID00=Vitem.ZYGHID; select max(ID0000) into VZDXXID from (select a.* From BQ_BRZDXX a where ZYID00=Vitem.ZYGHID order by decode(ZDLB00,'3','0','4','1','2','2','1','3',ZDLB00)) a where rownum=1; if VZDXXID is not null then select ZDM000,ZDMC00,ZDRQ00,ZDLB00 into VZDM000,VZDMC00,VZDRQ00,VZDLB00 from BQ_BRZDXX where ID0000=VZDXXID; end if; VPV2 := '3'; select max(FJH000) into VFJH000 from BM_CWK000 where ZYID00=Vitem.ZYGHID and CWZT00='1'; select max(BMMC00) into VKDBQMC from BM_BMBM00 where BMBH00=Vitem.KDBQ00; select max(BMMC00) into VKDKSMC from BM_BMBM00 where BMBH00=Vitem.KDKSBH; else select max(ZDXXID) into VZDXXID from (select a.* From YS_BRZDXX a where GHH000=Vitem.ZYHGHH order by decode(ZZDBZ0,'3','0','4','1','1','2','2','3',ZZDBZ0)) a where rownum=1; if VZDXXID is not null then select ICD900,ZDMC00,ZDRQ00,ZZDBZ0,JZYS00,JZYSXM into VZDM000,VZDMC00,VZDRQ00,VZDLB00,VZDYS00,VZDYSXM from YS_BRZDXX where ZDXXID=VZDXXID; end if; VPV2 := '1'; --判断是否属于急诊病人 --select count(1) into vcount0 from sf_brxxb0 a,bm_bmbm00 b where a.GHH000=Vitem.ZYHGHH and a.ghks00=b.bmbh00 and b.bmmc00 like '%急诊%' and rownum=1; --if vcount0=1 then -- VPV2 := '2'; --end if; select max(BMMC00) into VKDKSMC from BM_BMBM00 where BMBH00=Vitem.KDKSBH; select max(BS0000),max(TZ0000) into VBS0000,VTZ0000 from ys_mzblws where GHH000=Vitem.ZYHGHH; end if; if VExamine='Examine_Form_Send_PEIS_MUSE' then VPV2 := '4'; end if; if (VExamine='Examine_Form_Send_PEIS_MUSE') or (VExamine='Examine_Form_Update_PEIS_MUSE') then VPIDStr := 'PID|||'||trim(Vitem.ZYHGHH)||'^'||Vitem.BRZJLX||'^'||Vitem.BRZJBH||'||'||Vitem.BRXM00||'||'||Vitem.BRCSRQ||'|'||Vitem.BRXB00||'|||'||''||'^'||Vitem.BRYB00||'^'|| substrb(nvl(Vitem.BRLXDZ,VTYDWMC),1,200)||'^'||Vitem.BRXZSF||'^'||Vitem.BRXZS0||'^^'||Vitem.BRXZZ0||'^'||Vitem.BRXZC0||'^'||''||'||'|| substrb(Vitem.BRLXDH,1,18)||'|'||substrb(Vitem.BRDH00,1,18)||'||'||Vitem.BRHYZK||'||'||substrb(Vitem.FBMC00,1,8)||'^'||Vitem.YBMC00||'^'||Vitem.YBBRLB||'^'||Vitem.BRZTQK||'^'||VICKH00||'^^'|| Vitem.YBID00||'^'||Vitem.YBKH00||'||||||||'||Vitem.BRGJ00||'||||||||'||Vitem.BRXX00||'|'||VTYDWMC||'|'||Vitem.BRZY00; VPV1Str := 'PV1|1|'||VPV2||'^'||Vitem.ZYGHID||'^'||Vitem.ZYHGHH||'^'||VMRN000||'^'||VGSDJH0||'|^'||VFJH000||'^'||Vitem.CH0000||'^'||VDQBQ00||'&'||VDQBQMC||'^'||VDQKS00||'^'||VDQKSMC||'^'||VYYQC00||'|'|| VRYLB00||'^'||VRYSQK0||'^|||^^'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||'||''||'|||'||VBRRYCS||'|'||VRYFS00||'||||||||||||||||||||||||||||||'||VSJRYRQ||'|'||''||'|||'; elsif VExamine='Examine_Form_Update_MUSE' then VPIDStr := 'PID|||'||Vitem.BRID00||'^'||Vitem.BRZJLX||'^'||Vitem.BRZJBH||'||'||Vitem.BRXM00; VPV1Str := 'PV1|1|'||VPV2||'^'||Vitem.ZYGHID||'^'||Vitem.ZYHGHH; end if; select ZXRQ00||replace(ZXSJ00, ':', '') into VJZRQSJ from YJ_YW0000 where YJDJH0 = Vitem.YJDJH0; -- 2019.09.19 增加判断执行日期是否为空,为空取收费日期。 if VJZRQSJ is null then if Vitem.mzzybz = '1' then select max(CZRQ00||CZSJ00) into VJZRQSJ from ZY_FYMX00 where DJH000 = Vitem.SFDJH0; else select max(CZRQ00||CZSJ00) into VJZRQSJ from SF_FYMX00 where DJH000 = Vitem.SFDJH0; end if; end if; --2019.09.25 if VJZRQSJ is null then select KDRQ00||replace(KDSJ00, ':', '') into VJZRQSJ from YJ_YW0000 where YJDJH0 = Vitem.YJDJH0; end if; VMsgType:='OMG^O19^OMG_O19'; VYZCFID := trim(Vitem.YZCFID); if VYZCFID is not null then select nvl(max(WBZID0),VYZCFID) into VYZCFID from bljk_yzjkb0 where yzid00=VYZCFID and zlxmid>0; end if; --2017.04.06 Vitem.YZCFID->VYZCFID VORC13:= '|^^^'||Vitem.KDBQ00||'&'||VKDBQMC||'^'||Vitem.KDKSBH||'^'||VKDKSMC||'^'||VYYQC00; if VExamine='Examine_Form_Send_PEIS_MUSE' then VORC13:= '|^^^'||Vitem.KDBQ00||'^'||Vitem.KDKSBH||'^'||VKDKSMC||'^'||VYYQC00; elsif VExamine='Examine_Form_Update_MUSE' then VORC13:= '|^^^^'||Vitem.KDKSBH||'^'||VKDKSMC||'^'; end if; VORCStr:='ORC|'||VORC1||'|'||VSQDH00||'||'||VYZCFID||'|'||VORC5||'||||'||Vitem.KDRQ00||replace(Vitem.KDSJ00,':','')||'|'||Vitem.KDYS00||'^'||Vitem.LRXM00||'||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||VORC13||'|||'||Vitem.BZ0000||'|||||||||^||||^^^'||VJCLBMC||'|||'||VJZRQSJ||'|'; --增加:主诉^主诉内容~既往史^既往史内容~家族史^家族史内容~现病史^现病史内容 VOBRStr:='OBR|1|'||VOBR2||'||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'^^'||Vitem.JCZLMC||'|||||||||'||'主诉'||'^'||''||'~^~^~现病史^'||VBS0000||'|||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||||||'|| Vitem.ZJE000||'^|||||||||||'||Vitem.ZXR000||'&'||Vitem.ZXRXM0||'^^^^^^^'||Vitem.YJKSBM||'^||'||'||||||||||'||'体征^'||VTZ0000; if VExamine='Examine_Form_Update_MUSE' then VOBRStr:='OBR|1|'||VOBR2||'||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'^^'||Vitem.JCZLMC||'|||||||||'||'主诉'||'^'||''||'~^~^~现病史^'||VBS0000||'|||'||Vitem.KDYS00||'^'||Vitem.KDYSXM||'|||||||'|| Vitem.ZJE000||'^|||||||||||'||Vitem.ZXR000||'&'||Vitem.ZXRXM0||'^^^^^^^'||Vitem.YJKSBM||'^||'||'||'; end if; VDG1Str:='DG1|1||'||VZDM000||'^'||VZDMC00||'^||'||VZDRQ00||'|'||VZDLB00||'||||||||||'||VZDYS00||'^'||VZDYSXM; Vresult := 'MSH|^~'||'\'||'&|HIS|医技|'||VJSXT00||'|'||'接收模块'||'|'||to_char(systimestamp,'YYYYMMDDHH24MISS.FF3')||'|T|'||VMsgType||'|'||VExamine||'-'||to_char(systimestamp,'YYYYMMDDHH24MMSSFF3')||'|P|2.7'|| chr(13)||VPIDStr|| chr(13)||VPV1Str||VPV2Str|| chr(13)||VORCStr|| chr(13)||'TQ1||'||Vitem.SL0000||'|||||||'||VYXJ000|| chr(13)||VOBRStr|| chr(13)||VDG1Str; if trim(Vitem.BWMC00) is null then VZLXMBW := Vitem.ZLXMJC; else VZLXMBW := Vitem.ZLXMJC||'('||trim(Vitem.BWMC00)||')'; end if; Vresult := Vresult|| chr(13)||'OBX|1||'||Vitem.ZLXMID||'^'||Vitem.ZLXMJC||'^|||||||||||||||||'||''||'^'||VZLXMBW||'^'; end if; return Vresult; end;