DGQERPC ;ALB/RPM - VIC REPLACEMENT VISTA TO MAXIMUS RPC ; 10/04/05
;;5.3;Registration;**571,679,1015**;Aug 13, 1993;Build 21
;
; This routine contains the primary entry points to the
; VistA to Maximus interface RPCs.
;
Q ;no direct entry
;
GETDEMO(RESULT,DGICN) ;retrieve patient demographics
;
; --rpc: DGQE GET PATIENT DEMO
;
; This remote procedure retrieves demographic data for a given patient
; and returns an array of text lines. Each text line consists of at
; least two circumflex("^")-delimited fields. The first field of each
; line contains an XML style tag (e.g. <RESULT>). The second through
; nth fields contain data.
;
; Supported References:
; DBIA #2701: $$GETDFN^MPIF001
;
; Input:
; DGICN - patient's Integration Control Number
;
; Output:
; RESULT - array of tag-labeled patient demographics
;
; Subscript Field# Field contents Description
; --------- ------ ------------------------- ----------------
; 1 1 <RESULT> RPC status tag
; 2 Card Print Release Status
; 3 "VIC"
;
; 2 1 <MSG> Remarks tag
; 2 Free text remarks
;
; 3 1 <NAME> Identifier tag
; 2 Full Name
; 3 Social Security Number
; 4 Date of Birth
;
; 4 1 <NAME1> Name components tag
; 2 Last Name
; 3 First Name
; 4 Middle Name
; 5 Name Suffix
; 6 Name Prefix
;
; 5 1 <TYPE> Veteran type tag
; 2 Service Connected Indicator
; 3 Prisoner of War Indicator
; 4 Purple Heart Indicator
;
; 6 1 <PATAS> Mailing address tag
; 2 Street Line 1
; 3 Street Line 2
; 4 Street Line 3
;
; 7 1 <PATAZ> Mailing address tag
; 2 City
; 3 State
; 4 Zip
;
; 8 1 <MPI> Master Patient Index tag
; 2 Integration Control Number
; 3 DFN
;
; 9 1 <SITE> Facility tag
; 2 Facility Name
; 3 Station Number
; 4 VISN
;
N DGDFN ;pointer to patient in PATIENT (#2) file
N DGVIC ;patient data array
;
;initialize patient data array
D INITARR^DGQEUT1(.DGVIC)
;
D ;drop out of block on error
. ;
. ;check for input parameter
. S DGDFN=+$$GETDFN^MPIF001($G(DGICN))
. Q:(DGDFN'>0)
. ;
. ;build patient object
. Q:'$$GETPAT^DGQEUT1(DGDFN,.DGVIC)
. ;
. ;build eligibility object
. Q:'$$GETELIG^DGQEUT1(DGDFN,.DGVIC)
;
;determine card print release status and get into array
D CPRSTAT^DGQEUT2(.DGVIC)
;
;build results document
D BLDDOC(.DGVIC,.RESULT)
;
Q
;
;
SETID(RESULT,DGICN,DGRSTAT,DGID) ;callback RPC from Maximus workstation
;
; --rpc: DGQE SET CARD ID
;
; This remote procedure provides a "callback" for the VIC PICS
; Workstation to notify VistA that a patient's VIC request has been
; successfully forwarded to the National Card Management Directory.
; The procedure creates an entry in the VIC REQUEST (#39.6) file when
; the Card Print Release Status is "H" [Hold].
;
; Supported References:
; DBIA #2701: $$GETDFN^MPIF001
;
; Input:
; DGICN - patient's Integration Control Number
; DGRSTAT - card print release status
; DGID - NCMD assigned Card ID
;
; Output:
; none
;
N DGDFN ;pointer to patient in PATIENT (#2) file
;
S DGDFN=+$$GETDFN^MPIF001($G(DGICN))
I DGDFN>0,$D(^DPT(DGDFN,0)),$G(DGRSTAT)]"" D
. I $E(DGRSTAT)="H" D STOCID^DGQEREQ(DGID,DGDFN,DGRSTAT)
S RESULT=1
;
Q
;
;
BLDDOC(DGPAT,DGRSLT) ;build results document based on DOCMAP table
; This procedure uses the array subscript to field location table
; in linetag DOCMAP to format the GETDEMO RPC result array.
;
; Input:
; DGPAT - combined patient/eligibility data array
;
; Output:
; DGRSLT - RPC result array
;
N DGFLD ;table field location
N DGLCNT ;line count
N DGLINE ;line content
N DGFLDNM ;field name
;
F DGLCNT=1:1 S DGLINE=$T(DOCMAP+DGLCNT) Q:DGLINE="" D
. S DGRSLT(DGLCNT)="<"_$P(DGLINE,";",3)_">" ;set TAG
. F DGFLD=4:1 S DGFLDNM=$P(DGLINE,";",DGFLD) Q:DGFLDNM="" D
. . S DGRSLT(DGLCNT)=DGRSLT(DGLCNT)_"^"_$G(DGPAT(DGFLDNM))
;
Q
;
;
DOCMAP ;document field to array subscript map;TAG;FIELD1;FIELD2;...;FIELDn
;;RESULT;STAT;DOCTYPE
;;MSG;REMARKS
;;NAME;NAME;SSN;DOB
;;NAME1;LAST;FIRST;MIDDLE;SUFFIX;PREFIX
;;TYPE;SC;POW;PH
;;PATAS;STREET1;STREET2;STREET3
;;PATAZ;CITY;STATE;ZIP
;;MPI;ICN;DFN
;;SITE;FACNAME;FACNUM;VISN
DGQERPC ;ALB/RPM - VIC REPLACEMENT VISTA TO MAXIMUS RPC ; 10/04/05
+1 ;;5.3;Registration;**571,679,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ; This routine contains the primary entry points to the
+4 ; VistA to Maximus interface RPCs.
+5 ;
+6 ;no direct entry
QUIT
+7 ;
GETDEMO(RESULT,DGICN) ;retrieve patient demographics
+1 ;
+2 ; --rpc: DGQE GET PATIENT DEMO
+3 ;
+4 ; This remote procedure retrieves demographic data for a given patient
+5 ; and returns an array of text lines. Each text line consists of at
+6 ; least two circumflex("^")-delimited fields. The first field of each
+7 ; line contains an XML style tag (e.g. <RESULT>). The second through
+8 ; nth fields contain data.
+9 ;
+10 ; Supported References:
+11 ; DBIA #2701: $$GETDFN^MPIF001
+12 ;
+13 ; Input:
+14 ; DGICN - patient's Integration Control Number
+15 ;
+16 ; Output:
+17 ; RESULT - array of tag-labeled patient demographics
+18 ;
+19 ; Subscript Field# Field contents Description
+20 ; --------- ------ ------------------------- ----------------
+21 ; 1 1 <RESULT> RPC status tag
+22 ; 2 Card Print Release Status
+23 ; 3 "VIC"
+24 ;
+25 ; 2 1 <MSG> Remarks tag
+26 ; 2 Free text remarks
+27 ;
+28 ; 3 1 <NAME> Identifier tag
+29 ; 2 Full Name
+30 ; 3 Social Security Number
+31 ; 4 Date of Birth
+32 ;
+33 ; 4 1 <NAME1> Name components tag
+34 ; 2 Last Name
+35 ; 3 First Name
+36 ; 4 Middle Name
+37 ; 5 Name Suffix
+38 ; 6 Name Prefix
+39 ;
+40 ; 5 1 <TYPE> Veteran type tag
+41 ; 2 Service Connected Indicator
+42 ; 3 Prisoner of War Indicator
+43 ; 4 Purple Heart Indicator
+44 ;
+45 ; 6 1 <PATAS> Mailing address tag
+46 ; 2 Street Line 1
+47 ; 3 Street Line 2
+48 ; 4 Street Line 3
+49 ;
+50 ; 7 1 <PATAZ> Mailing address tag
+51 ; 2 City
+52 ; 3 State
+53 ; 4 Zip
+54 ;
+55 ; 8 1 <MPI> Master Patient Index tag
+56 ; 2 Integration Control Number
+57 ; 3 DFN
+58 ;
+59 ; 9 1 <SITE> Facility tag
+60 ; 2 Facility Name
+61 ; 3 Station Number
+62 ; 4 VISN
+63 ;
+64 ;pointer to patient in PATIENT (#2) file
NEW DGDFN
+65 ;patient data array
NEW DGVIC
+66 ;
+67 ;initialize patient data array
+68 DO INITARR^DGQEUT1(.DGVIC)
+69 ;
+70 ;drop out of block on error
Begin DoDot:1
+71 ;
+72 ;check for input parameter
+73 SET DGDFN=+$$GETDFN^MPIF001($GET(DGICN))
+74 IF (DGDFN'>0)
QUIT
+75 ;
+76 ;build patient object
+77 IF '$$GETPAT^DGQEUT1(DGDFN,.DGVIC)
QUIT
+78 ;
+79 ;build eligibility object
+80 IF '$$GETELIG^DGQEUT1(DGDFN,.DGVIC)
QUIT
End DoDot:1
+81 ;
+82 ;determine card print release status and get into array
+83 DO CPRSTAT^DGQEUT2(.DGVIC)
+84 ;
+85 ;build results document
+86 DO BLDDOC(.DGVIC,.RESULT)
+87 ;
+88 QUIT
+89 ;
+90 ;
SETID(RESULT,DGICN,DGRSTAT,DGID) ;callback RPC from Maximus workstation
+1 ;
+2 ; --rpc: DGQE SET CARD ID
+3 ;
+4 ; This remote procedure provides a "callback" for the VIC PICS
+5 ; Workstation to notify VistA that a patient's VIC request has been
+6 ; successfully forwarded to the National Card Management Directory.
+7 ; The procedure creates an entry in the VIC REQUEST (#39.6) file when
+8 ; the Card Print Release Status is "H" [Hold].
+9 ;
+10 ; Supported References:
+11 ; DBIA #2701: $$GETDFN^MPIF001
+12 ;
+13 ; Input:
+14 ; DGICN - patient's Integration Control Number
+15 ; DGRSTAT - card print release status
+16 ; DGID - NCMD assigned Card ID
+17 ;
+18 ; Output:
+19 ; none
+20 ;
+21 ;pointer to patient in PATIENT (#2) file
NEW DGDFN
+22 ;
+23 SET DGDFN=+$$GETDFN^MPIF001($GET(DGICN))
+24 IF DGDFN>0
IF $DATA(^DPT(DGDFN,0))
IF $GET(DGRSTAT)]""
Begin DoDot:1
+25 IF $EXTRACT(DGRSTAT)="H"
DO STOCID^DGQEREQ(DGID,DGDFN,DGRSTAT)
End DoDot:1
+26 SET RESULT=1
+27 ;
+28 QUIT
+29 ;
+30 ;
BLDDOC(DGPAT,DGRSLT) ;build results document based on DOCMAP table
+1 ; This procedure uses the array subscript to field location table
+2 ; in linetag DOCMAP to format the GETDEMO RPC result array.
+3 ;
+4 ; Input:
+5 ; DGPAT - combined patient/eligibility data array
+6 ;
+7 ; Output:
+8 ; DGRSLT - RPC result array
+9 ;
+10 ;table field location
NEW DGFLD
+11 ;line count
NEW DGLCNT
+12 ;line content
NEW DGLINE
+13 ;field name
NEW DGFLDNM
+14 ;
+15 FOR DGLCNT=1:1
SET DGLINE=$TEXT(DOCMAP+DGLCNT)
IF DGLINE=""
QUIT
Begin DoDot:1
+16 ;set TAG
SET DGRSLT(DGLCNT)="<"_$PIECE(DGLINE,";",3)_">"
+17 FOR DGFLD=4:1
SET DGFLDNM=$PIECE(DGLINE,";",DGFLD)
IF DGFLDNM=""
QUIT
Begin DoDot:2
+18 SET DGRSLT(DGLCNT)=DGRSLT(DGLCNT)_"^"_$GET(DGPAT(DGFLDNM))
End DoDot:2
End DoDot:1
+19 ;
+20 QUIT
+21 ;
+22 ;
DOCMAP ;document field to array subscript map;TAG;FIELD1;FIELD2;...;FIELDn
+1 ;;RESULT;STAT;DOCTYPE
+2 ;;MSG;REMARKS
+3 ;;NAME;NAME;SSN;DOB
+4 ;;NAME1;LAST;FIRST;MIDDLE;SUFFIX;PREFIX
+5 ;;TYPE;SC;POW;PH
+6 ;;PATAS;STREET1;STREET2;STREET3
+7 ;;PATAZ;CITY;STATE;ZIP
+8 ;;MPI;ICN;DFN
+9 ;;SITE;FACNAME;FACNUM;VISN