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

ORWPFSS4.m

Go to the documentation of this file.
  1. ORWPFSS4 ;SLC-GDU CPRS HL7 PROCESSING FOR RAD PRE-CERT;[08/29/05];
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**228**;Dec 17, 1997
  1. ;Determine if the order is to have an PFSS Account Reference
  1. ;associated with it. This is for orders that are not event delayed
  1. ;
  1. ;DBIA References for external calls
  1. ; $$GETS^DIQ - DBIA 2056
  1. ; $$GETS1^DIQ - DBIA 2056
  1. ; $$PKGTYP^ORWPFSS - Internal to CPRS PFSS
  1. ; PFSSACTV^ORWPFSS - Internal to CPRS PFSS
  1. ; $$ACCTREF^ORWPFSS1 - Internal to CPRS PFSS
  1. ; $$GETARN^SDPFSS2 - DBIA 4668
  1. ; INP^VADPT - DBIA 10061
  1. ; ^VSIT - DBIA 1900-A
  1. ;
  1. EN(ORIEN) ;Primary entry point of this routine
  1. ;Input Variable
  1. ; ORIEN The Order Internal Entry Number
  1. ;Local Variables
  1. ; ORAR Order Account Reference (PFSS AR)
  1. ; ORDFN Order Patient's DFN (IEN)
  1. ; ORPFSS Order PFSS Active Indicator
  1. ; ORUPDT Order Update Indicator from record update
  1. ; ORVS Order Visit String
  1. ;
  1. N ORAR,ORDFN,ORPFSS,ORUPDT,ORVS,X,Y
  1. S (ORAR,ORPFSS)=""
  1. ;If PFSS is inactive goto exit
  1. D PFSSACTV^ORWPFSS(.ORPFSS) I ORPFSS=0 G EXIT
  1. ;If Order already has PFSS Account Reference goto exit
  1. S ORAR=$$GET1^DIQ(100,ORIEN,97) I ORAR'="" G EXIT
  1. ;If Order package is not one of the currently supported goto exit
  1. I $$PKGTYP^ORWPFSS(ORIEN)=0 G EXIT
  1. ;If Visit String not found goto EXIT.
  1. S ORVS=$$GETVS(ORIEN) I ORVS="" G EXIT
  1. ;Get Patient's DFN from the Order
  1. S ORDFN=+$$GET1^DIQ(100,ORIEN,.02,"I")
  1. ;If Historical set PFSS Account Reference to null and goto Save
  1. I $P(ORVS,";",3)="E" S ORAR="" G SAVE
  1. ;If Scheduled Appointment get PFSS Account Reference and goto Save
  1. I $P(ORVS,";",3)="A" S ORAR=$$SAAR(ORVS,ORDFN) I ORAR'="" G SAVE
  1. ;If Hospital Admission get PFSS Account Reference and goto Save
  1. I $P(ORVS,";",3)="H" S ORAR=$$HAAR(ORDFN) I ORAR'="" G SAVE
  1. ;Check PCE for PFSS Account Reference
  1. S ORAR=$$PCEAR(ORVS,ORDFN)
  1. SAVE ;Save PFSS Account Reference or null value to the Order record
  1. S ORUPDT=$$ACCTREF^ORWPFSS1(ORIEN,ORAR)
  1. EXIT ;Exit point for this routine
  1. Q
  1. GETVS(X1) ;Get Order Visit String
  1. ;Get the data from the Order's Responses multi-valued field.
  1. ;Look for Prompt text of OR GTX VISITSTR
  1. ;If Prompt text found get the Visit String
  1. ;If Prompt text not found return a null value
  1. ;Input variable required, if missing this will return a null value
  1. ;Input Variable for this function
  1. ; X1 The Order IEN
  1. ;Return Variable for this function
  1. ; VS The Order Visit String
  1. ;Local Variable for this function
  1. ; IENS Index variable for REC array
  1. ; PT Prompt Text being searched for
  1. ; REC Output variable for GETS^DIQ that will contain the Order
  1. ; Responses data.
  1. N IENS,PT,REC,VS
  1. I X1="" S VS="" Q VS
  1. S (IENS,VS)=""
  1. S PT=$P($T(VSPT),";",3)
  1. D GETS^DIQ(100,X1,"4.5*","E","REC")
  1. F S IENS=$O(REC(100.045,IENS)) Q:IENS="" D
  1. . I $G(REC(100.045,IENS,.02,"E"))=PT S VS=$G(REC(100.045,IENS,1,"E"))
  1. Q VS
  1. VSPT ;Visit String Prompt Text;OR GTX VISITSTR
  1. ;
  1. SAAR(X1,X2) ;Scheduled Appointment Account Reference for PFSS
  1. ;Get the PFSS Account Reference for scheduled appointments
  1. ;All inputs required, any missing this will return a null value
  1. ;Input Variables
  1. ; X1 The Visit String from the Order
  1. ; X2 The Patient's IEN
  1. ;Output Variable
  1. ; AR PFSS Account Reference returned by $$GETARN^SDPFSS2
  1. ; Set to null in any input is missing
  1. ;
  1. N AR
  1. I X1=""!(X2="") S AR="" Q AR
  1. ;Get the PFSS Account Reference from Scheduling
  1. S AR=+$$GETARN^SDPFSS2($P(X1,";",2),X2,$P(X1,";"))
  1. I AR>0 Q AR ;If found return Account Reference
  1. S AR="" Q AR ;If not found return null for Account Reference
  1. ;
  1. HAAR(X1) ;Hospital Admission Account Reference for PFSS
  1. ;Returns the PFSS Account Reference for the Hospital Admission
  1. ;Input is required. If missing null value returned.
  1. ;Returns PFSS Account Reference returned if found.
  1. ;Returns null if PFSS Account Reference not found null.
  1. ;Input Variable for this function
  1. ; X1 The Patient's DFN
  1. ;Output Variables for this function
  1. ; ER Set to null and returned if missing input
  1. ; VAIN("NR") The node of VAIN that contains the PFSS Account Reference
  1. ;Internal Variables for this function
  1. ; DFN VADPT input variable, Patient's record number
  1. ; VAHOW VADPT input variable, sends output to array variable VAIN
  1. ; VAIN Output array variable with results of INP^VAIN
  1. ;
  1. N ER,DFN,VAHOW,VAIN
  1. I X1="" S ER="" Q ER
  1. S DFN=X1
  1. S VAHOW=1
  1. D INP^VADPT
  1. Q $G(VAIN("NR"))
  1. ;
  1. PCEAR(X1,X2) ;PCE Account Reference for PFSS
  1. ;Returns the PFSS Account Reference from PCE
  1. ;All input required, if any missing this will a null.
  1. ;Returns PFSS Account Reference returned if found.
  1. ;Returns null if PFSS Account Reference not found null.
  1. ;Input Variable for this function
  1. ; X1 The Visit String from the Order
  1. ; X2 The Patient's IEN
  1. ; VSIT The input and output array variable for ^VSIT
  1. ;Output Variables for this function
  1. ; ER Set to null and returned if missing input
  1. ; VSIT("ACT") The node of array variable VSIT that contains
  1. ; the PFSS Account Reference returned by ^VSIT
  1. ;Local Variable for this function
  1. ; VSIT The input and output array variable for ^VSIT
  1. ;
  1. N ER,VSIT
  1. I X1=""!(X2="") S ER="" Q ER
  1. S VSIT(0)="D0EM"
  1. S VSIT("VDT")=$P(X1,";",2)
  1. S VSIT("LOC")=$P(X1,";")
  1. S VSIT("PKG")="OR"
  1. S VSIT("PAT")=X2
  1. D ^VSIT
  1. I $G(VSIT("IEN"))<0 S ER="" Q ER
  1. Q $G(VSIT("ACT"))