Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VPREHL7

VPREHL7.m

Go to the documentation of this file.
  1. VPREHL7 ;ALB/MJK,MKB - VPR HL7 Message Processor ;10/25/18 15:29
  1. ;;1.0;VIRTUAL PATIENT RECORD;**8,14,30**;Sep 01, 2011;Build 9
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; External References DBIA#
  1. ; ------------------- -----
  1. ; RMIM DRIVER 6990
  1. ; VAFC ADT-A08 SERVER 4418
  1. ; DIQ 2056
  1. ; MPIF001 2701
  1. ; XLFDT 10103
  1. ;
  1. ; Note: These variables are provided by the VistA HL7 system when a
  1. ; subscriber protocol's ROUTING LOGIC is called:
  1. ; - HLNEXT
  1. ; - HLQUIT
  1. ; - HLNODE
  1. ; - HLFS
  1. ; - HLECH
  1. ;
  1. ADT ; -- main entry point for these VPR ADT client/router protocols:
  1. ; - VPR ADT-A08 CLIENT protocol
  1. ; o subscribes to VAFC ADT-A08 SERVER
  1. ;
  1. ; -- Posts A08 events for patient demographics changes
  1. ; Scans for PID segment and uses embedded DFN
  1. ; Sets ^VPR("AVPR"... freshness queue
  1. ;
  1. N DONE,VPRSEG,VPREVT,DFN
  1. S DONE=0
  1. F X HLNEXT Q:HLQUIT'>0 D Q:DONE
  1. . S VPRSEG=$E(HLNODE,1,3)
  1. . ;
  1. . I VPRSEG="EVN" D Q
  1. . . S VPREVT=$P(HLNODE,HLFS,2)
  1. . . ;I VPREVT="A04" Q ;no longer tracking registration events
  1. . . ; -- 97 reason = sensitive patient change occurred
  1. . . I VPREVT="A08" Q ;,$P(HLNODE,HLFS,5)=97 Q ;P14: all updates
  1. . . ; -- not an event VPR is interested in so done with message
  1. . . S DONE=1
  1. . ; -- PID segment always comes after EVN segment
  1. . I VPRSEG'="PID" Q
  1. . S DONE=1
  1. . ; -- VPREVT should always be defined at this point
  1. . I $G(VPREVT)="" Q
  1. . S DFN=+$P($P(HLNODE,HLFS,4),$E(HLECH))
  1. . I 'DFN Q
  1. . D QUE^VPRHS(DFN)
  1. Q
  1. ;
  1. FIM ; -- main entry point for these VPR RMIM client/router protocols:
  1. ; - VPR RMIM EVENTS protocol
  1. ; o subscribes to RMIM DRIVER
  1. ;
  1. N DONE,VPRSEG,DFN,CASE
  1. S DONE=0
  1. F X HLNEXT Q:HLQUIT'>0 D Q:DONE
  1. . S VPRSEG=$E(HLNODE,1,3)
  1. . ;
  1. . I VPRSEG'="PID" Q
  1. . S DONE=1
  1. . S DFN=+$P(HLNODE,HLFS,4) Q:DFN<1
  1. . S CASE=+$P($P(HLNODE,HLFS,5),$E(HLECH),2)
  1. . D POST^VPRHS(DFN,"Problem",CASE_";783")
  1. Q
  1. ;
  1. PRF ; -- main entry point for these VPR PRF client/router protocols:
  1. ; - VPR DGPF EVENTS protocol
  1. ; o subscribes to DGPF PRF ORU/R01 EVENT
  1. ;
  1. Q ;replaced by new DGPF PRF EVENT protocol
  1. N DONE,VPRSEG,ICN,DFN,ID,STS,ACT
  1. S DONE=0
  1. F X HLNEXT Q:HLQUIT'>0 D Q:DONE
  1. . S VPRSEG=$E(HLNODE,1,3)
  1. . ;
  1. . I VPRSEG="PID" D Q
  1. . . S ICN=$P($P(HLNODE,HLFS,4),$E(HLECH))
  1. . . S DFN=$$GETDFN^MPIF001(ICN)
  1. . . I DFN<1 S DONE=1
  1. . ;
  1. . I VPRSEG="OBR" D Q
  1. . . S ID=+$P($P(HLNODE,HLFS,5),$E(HLECH))
  1. . . I ID<1 S DONE=1
  1. . ;
  1. . I VPRSEG'="OBX" Q
  1. . I $P(HLNODE,HLFS,3)'="ST" Q
  1. . S DONE=1 Q:$G(DFN)<1 Q:$G(ID)<1
  1. . S STS=$P(HLNODE,HLFS,6),ACT=$S(STS["INACT":"@",STS["ERROR":"@",1:"")
  1. . ;I STS="@" D POST^VPRHS(DFN,"Alert") Q ;rebuild container
  1. . D POST^VPRHS(DFN,"Alert",ID_"~"_DFN_";26.13",ACT)
  1. Q
  1. ;
  1. PSO ; -- main entry point for these VPR PRF client/router protocols:
  1. ; - VPR PSO VDEF EVENTS protocol
  1. ; o subscribes to PSO VDEF RDS O13 OP PHARM PREF VS
  1. ; o subscribes to PSO VDEF RDS O13 OP PHARM PPAR VS
  1. ;
  1. N DONE,VPRSEG,ICN,DFN,ID,NOW,ORDER
  1. S DONE=0,NOW=$$NOW^XLFDT
  1. F X HLNEXT Q:HLQUIT'>0 D Q:DONE
  1. . S VPRSEG=$E(HLNODE,1,3)
  1. . ;
  1. . I VPRSEG="PID" D Q
  1. . . S ICN=$P(HLNODE,HLFS,3)
  1. . . S DFN=$$GETDFN^MPIF001(ICN)
  1. . . I DFN<1 S DONE=1
  1. . ;
  1. . I VPRSEG'="ORC" Q
  1. . S ID=+$P($P(HLNODE,HLFS,4),$E(HLECH))
  1. . S DONE=1 Q:$G(DFN)<1 Q:$G(ID)<1
  1. . S ORDER=$$GET1^DIQ(52,ID,39.3,"I")
  1. . D:ORDER POST^VPRHS(DFN,"Medication",ORDER_";100")
  1. Q