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

IVMPREC5.m

Go to the documentation of this file.
  1. IVMPREC5 ;ALB/KCL - PROCESS INCOMING (Z03 EVENT TYPE) HL7 MESSAGES ; 3/6/01 4:42pm
  1. ;;2.0;INCOME VERIFICATION MATCH;**2,17,34**;21-OCT-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ; This routine will process batch ORU SSN(event type Z03) HL7
  1. ; messages received from the IVM center. Format of batch:
  1. ; BHS
  1. ; {MSH
  1. ; PID
  1. ; ZIV
  1. ; }
  1. ; BTS
  1. ;
  1. EN ; entry point to process SSN messages
  1. ;
  1. F IVMDA=1:0 S IVMDA=$O(^TMP($J,IVMRTN,IVMDA)) Q:'IVMDA S IVMSEG=$G(^(IVMDA,0)) I $E(IVMSEG,1,3)="MSH" D
  1. .K HLERR
  1. .S HLMID=$P(IVMSEG,HLFS,10) ; message control id from MSH
  1. .S IVMDA=$O(^TMP($J,IVMRTN,IVMDA)),IVMSEG=$G(^(+IVMDA,0)) I $E(IVMSEG,1,3)'="PID" D Q
  1. ..S HLERR="Missing PID segment" D ACK^IVMPREC
  1. .S DFN=$P($P(IVMSEG,HLFS,4),$E(HLECH),1)
  1. .I ('DFN!(DFN'=+DFN)!('$D(^DPT(+DFN,0)))) D Q
  1. ..S HLERR="Invalid DFN" D ACK^IVMPREC
  1. .I $P(IVMSEG,HLFS,20)'=$P(^DPT(DFN,0),"^",9) D Q
  1. ..S HLERR="Couldn't match IVM SSN with DHCP SSN" D ACK^IVMPREC
  1. .S IVMDA=$O(^TMP($J,IVMRTN,IVMDA)),IVMSEG=$G(^(+IVMDA,0)) I $E(IVMSEG,1,3)'="ZIV" D Q
  1. ..S HLERR="Missing ZIV segment" D ACK^IVMPREC
  1. .S IVMSEG=$P(IVMSEG,HLFS,2,999),IVMIY=$P(IVMSEG,HLFS,2)
  1. .S IVMIY=$$FMDATE^HLFNC(IVMIY) I $E(IVMIY,4,7)'="0000"!($E(IVMIY,1,3)<292) S HLERR="Invalid Income Year" D ACK^IVMPREC Q
  1. .;
  1. .I $P(IVMSEG,"^",4)=$P($G(^DPT(DFN,0)),"^",9) D Q
  1. ..S HLERR="Client SSN already on file in DHCP" D ACK^IVMPREC Q
  1. .I $P(IVMSEG,"^",6)]"",$P(IVMSEG,"^",7)']"" D Q
  1. ..S HLERR="Missing spouse IEN" D ACK^IVMPREC Q
  1. .I $P(IVMSEG,"^",6)]"",($P(IVMSEG,"^",6)=$P($$DEM^DGMTU1(+$P(IVMSEG,"^",7)),"^",9)) D Q
  1. ..S HLERR="Spouse SSN already on file in DHCP" D ACK^IVMPREC Q
  1. .;
  1. .I $P(IVMSEG,"^",4)="",($P(IVMSEG,"^",6)=""!($P(IVMSEG,"^",7)="")) D Q
  1. ..S HLERR="Missing client/spouse SSNs" D ACK^IVMPREC Q
  1. .;
  1. .D SSNCK I $D(HLERR) D ACK^IVMPREC Q
  1. .D STORE
  1. ;
  1. ; - send notification message if necessary
  1. I IVMCNTR D MAIL^IVMUFNC()
  1. Q
  1. ;
  1. SSNCK ; check to make sure the SSN(s) are valid SSA SSNs
  1. ;
  1. N FLAG,L,X
  1. S FLAG=0 ; set to 1 if problem with SSN
  1. ;
  1. F X=$P(IVMSEG,"^",4),$P(IVMSEG,"^",6) Q:FLAG D
  1. .S L=$E(X,1,3)
  1. .I L="000" S FLAG=1 Q ; begins with 000
  1. .I L>649,(L<700) S FLAG=1 Q ; 650-699 invalid
  1. .I L>728 S FLAG=1 Q ; 729-999 invalid
  1. I FLAG S HLERR="Invalid SSN sent"
  1. Q
  1. ;
  1. STORE ; store the ZIV segment in the (#301.5) file for uploading
  1. ;
  1. ; check for patient case record
  1. S DA(1)=$O(^IVM(301.5,"B",+DFN,0)),X=$$IEN^IVMUFNC4("ZIV")
  1. I DA(1)']"" S HLERR="Patient missing from IVM PATIENT file" D ACK^IVMPREC Q
  1. I $G(^IVM(301.5,DA(1),"IN",0))']"" S ^(0)="^301.501PA^^"
  1. S DIC="^IVM(301.5,"_DA(1)_",""IN"",",DIC(0)="L",DLAYGO=301.501
  1. S DIC("DR")="10////^S X=IVMSEG"
  1. K DD,DO D FILE^DICN
  1. ;
  1. ;
  1. STOREQ K DA,DIC,DIE,X,Y
  1. ;
  1. ;
  1. ; build mail message if SUPPRESS SSN UPLOAD NOTIFICATION is not set
  1. Q:$P($G(^IVM(301.9,1,0)),"^",3)
  1. ;
  1. ;
  1. ZIVBULL ; build mail message for transmission to IVM mail group notifying them
  1. ; that patients with updated SSA/SSN's have been received from the
  1. ; IVM Center and may now be uploaded into DHCP.
  1. ;
  1. S XMSUB="IVM - SSN UPLOAD"
  1. S IVMTEXT(1)="Updated SSA/SSNs have been received from the Income Verification"
  1. S IVMTEXT(2)="Match Center. Please select the 'SSN Upload' (SSN) option from the"
  1. S IVMTEXT(3)="'IVM Upload Menu' in order to view/update these SSA/SSNs. If you"
  1. S IVMTEXT(4)="have any questions concerning these updated SSA/SSNs, please contact"
  1. S IVMTEXT(5)="the Income Verification Match Center."
  1. S IVMTEXT(6)=""
  1. S IVMTEXT(7)="The following patients have SSA/SSNs to be viewed/updated: "
  1. S IVMTEXT(8)=" "
  1. S IVMCNTR=IVMCNTR+1
  1. S IVMPTID=$$PT^IVMUFNC4(DFN)
  1. S IVMTEXT(IVMCNTR+8)=$J(IVMCNTR_")",5)_" "_$P(IVMPTID,"^")_" ("_$P(IVMPTID,"^",3)_")"
  1. Q