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

RGRSENS.m

Go to the documentation of this file.
RGRSENS ;ALB/RJS,CML-PT SENSITIVITY PARSER/FILER ;06/25/98
 ;;1.0; CLINICAL INFO RESOURCE NETWORK ;;30 Apr 99
 ;
 ;Parse Incoming Message, and file.
 ;
 ;
 N RGRSDFN,VAFCA,RGRS,VAFCA08,ARRAY,BOGUS,RGDC,RGRSDATA
 N NAME,LASTNAME,SSN,ICN,CMOR,OTHSITE,SENSTVTY,CMORIEN,CMORDISP,BULSUB
 S ARRAY="RGRS(2)"
 D INITIZE^RGRSUTIL ;copy HL7 message into local RGDC array
 D EN^RGRSPAR2(ARRAY) ;parse HL7 nessage into local array RGRS
 I $$SKIP^RGRSZZPT(1,ARRAY) D  G EXIT ;skip if certain data is not there
 . D SKIPBULL^RGRSBULL(ARRAY)
 S RGRSDFN=$$GETDFN^MPIF001(@ARRAY@(991.01)) ;Get DFN from ICN
 S OTHSITE=@ARRAY@("SENDING SITE")
 ;
 ;If patient not known in site, send bulletin, go exit
 ;
 I +RGRSDFN=-1 M RGRS("MESSAGE")=RGDC D NOT2^RGRSBUL1(ARRAY) G EXIT
 ;
 D GETDATA^MPIFQ0("^DPT(",RGRSDFN,"RGRSDATA",".01;.09;991.01;991.03","EI")
 S NAME=$G(RGRSDATA(2,RGRSDFN,.01,"E"))
 S LASTNAME=$P(NAME,",",1)
 S SSN=$G(RGRSDATA(2,RGRSDFN,.09,"E"))
 S ICN=$G(RGRSDATA(2,RGRSDFN,991.01,"E"))
 S CMORIEN=$G(RGRSDATA(2,RGRSDFN,991.03,"I"))
 S CMOR=$$NS^XUAF4(CMORIEN)
 S CMORDISP=$P(CMOR,"^",1)
 S CMOR=$P(CMOR,"^",2)
 ;
 S @ARRAY@("NAME")=@ARRAY@(.01)
 S @ARRAY@("SSN")=@ARRAY@(.09)
 S @ARRAY@("ICN")=@ARRAY@(991.01)
 S @ARRAY@("CMOR")=$P($$NS^XUAF4($$LKUP^XUAF4(OTHSITE)),"^")
 ;
 ;If ICN or CMOR don't match, send bulletin and go exit
 I '$$MATCH(RGRSDFN,ARRAY,,,ICN,CMOR,.BULSUB) D  G EXIT
 . D MTCHBULL^RGRSBULL(RGRSDFN,ARRAY,NAME,SSN,ICN,CMORDISP,BULSUB)
 ;
 ;If patient is Sensitive at other site but not here send bulletin
 S SENSTVTY=@ARRAY@("SENSITIVITY")
 I '$$SENSTIVE(RGRSDFN),SENSTVTY D SENSTIVE^RGRSBUL1(RGRSDFN,ARRAY,NAME)
 ;
EXIT ;
 Q
 ;
SENSTIVE(DFN) ;CHECK SENSITIVITY FLAG FOR A PATIENT
 Q:$G(DFN)="" 0
 Q:$P($G(^DGSL(38.1,DFN,0)),"^",2)=1 1
 Q 0
 ;
 ;
MATCH(DFN,ARRAY,LASTNAME,SSN,ICN,CMOR,BULSUB) ;
 Q:$G(DFN)=""!($G(ARRAY)="") 0
 N COUNT,TRUE S (COUNT,TRUE)=0
 S BULSUB=""
 I $D(LASTNAME) D
 . S COUNT=COUNT+1
 . I (LASTNAME'=""),(LASTNAME=$P(@ARRAY@(.01),",",1)) S TRUE=TRUE+1
 I $D(SSN) D
 . S COUNT=COUNT+1
 . I (SSN'=""),(SSN=$G(@ARRAY@(.09))) S TRUE=TRUE+1
 I $D(ICN) D
 . S COUNT=COUNT+1
 . I (ICN'=""),(ICN=$G(@ARRAY@(991.01))) S TRUE=TRUE+1 Q
 . S BULSUB=BULSUB_"ICN"
 I $D(CMOR) D
 . S COUNT=COUNT+1
 . I (CMOR'=""),(CMOR=$G(@ARRAY@("SITENUM"))) S TRUE=TRUE+1 Q
 . I BULSUB]"" S BULSUB=BULSUB_" & "
 . S BULSUB=BULSUB_"CMOR"
 I COUNT=TRUE Q 1
 Q 0