DGRRLU5 ; ALB/sgg/MM - DG Replacement and Rehosting RPC for VADPT ; May-4-2004 ;
;;5.3;Registration;**538**;Aug 13, 1993
; provider lookup
; called by DGRRLU at line PRVLUP^DGRRLU5 if PARAMS("SEARCH_TYPE") = "PRVLUP"
;
;
DOC ;INPUT: Input is by the following parameters in the PARAMS() array:
;
;"PRV_VPID" - VPID [Required VPID unless PRV_LNAM is not Null.]
; If not null the query will only return the one person
; with this VPID, and only then if SSN, PROV and STN filters
; do not exclude this person.
;"PRV_LNAM" - LAST NAME [Required Char String unless VPID is not Null.]
; If not null the query will only return persons whose
; last name starts with this string.
;"PRV_FNAM" - FIRST NAME [Optional: Character String or Null.]
; If not null the query will only return persons whose
; first name starts with this string.
;"PRV_SSN" - SSN FILTER [Optional: 9 digits or Null.]
; If not null the query will only return persons with
; this social security number.
;"PRV_PROV" - PROVIDER FILTER [Optional: "P" or Null.]
; If set to "P" the query includes only providers, i.e.
; persons with a person class active on the PRV_DATE.
;"PRV_STN" - STATION NUMBER FILTER [Optional: an STN or Null.]
; If not null the query only returns persons with this
; station number.
;"PRV_MNM" - MAXIMUM NUMBER [Optional: min=1 max=50 default=50.]
; The maximum number of persons the query will return.
; If VPID is not null this is always 1.
;"PRV_DATE" - DATE [Optional: if Null this defaults to Today.]
; The Date against which a persons active person class is
; determined.
;
;OUTPUT: Output an XML with a schema as given:
;
; <?xml version="1.0" encoding="utf-8" ?>
; <persons> Example Data
; <person>
; </vpid> 999999999
; </ien> 11579
; </lname> KRUSHER
; </fname> WILL
; </mname> MIDDIE
; </ssn> 232323232
; </dob> 2330303
; </sex> M
; <providerInfo>
; </type> Physician Assistants
; </classification> Physician Assistant
; </specialization> Medical
; </VACode> V100100
; </X12Code> 363AM0700N
; </SpecialityCode> 97
; </providerInfo>
; </person>
; <error message=''></error>
; <maximum message=''></maximum>
; <record count='1'></record>
; <institution name='ALBANY' number='500' productiondatabase='0' domain='DMA.FO-ALBANY.DOMAIN.EXT' ></institution>
; </persons>
;
;
PRVLUP(RESULT,PARAMS) ;
NEW DGRRVPID,DGRRLNAM,DGRRFNAM,DGRRSSN,DGRRPROV,DGRRSTN,DGRRMNM,DGRRDATE
SET DGRRVPID=$G(PARAMS("PRV_VPID")) ; - The VPID of a Provider (Required unless lookup is by Provider Name)
SET DGRRLNAM=$G(PARAMS("PRV_LNAM")) ; - Part or all of the last name to use for basis of query (Required unless lookup is by VPID)
SET DGRRFNAM=$G(PARAMS("PRV_FNAM")) ; - Part or all of the first name to use for basis of query filter (optional, can be null)
SET DGRRSSN=$G(PARAMS("PRV_SSN")) ; - Social Security Number (null or full 9 digits) to use as additional filter for query
SET DGRRPROV=$G(PARAMS("PRV_PROV")) ; - If value set to "P", screen for only providers (only persons with active person class)
SET DGRRSTN=$G(PARAMS("PRV_STN")) ; - Filter persons based on station number entered (optional, can be null)
SET DGRRMNM=$G(PARAMS("PRV_MNM")) ; - Maximum Number of entries to return (Number between 1 and 50. Null defaults to 50)
SET DGRRDATE=$G(PARAMS("PRV_DATE")) ; - Date to be used to determine whether person has active person class. If null, current date is used.
;
N DGRRARR,DGRRCNT,ERRMESS,DGRRGLB
DO ADD("<persons>")
SET DGRRCNT=0 ;Initialize Record Count
IF (DGRRLNAM=""),(DGRRVPID="") SET ERRMESS="Query requires a last name or a VPID." GOTO FINALLY
;
D EN1^XUPSQRY(.DGRRARR,DGRRVPID,DGRRLNAM,DGRRFNAM,DGRRSSN,DGRRPROV,DGRRSTN,DGRRMNM,DGRRDATE)
K ^TMP($J,"PLUQRY")
M ^TMP($J,"PLUQRY")=@DGRRARR
I '$D(^TMP($J,"PLUQRY",1))!($G(^TMP($J,"PLUQRY",1))=0) D Q
.S ERRMESS="No records found."
.D FINALLY
N DGRRI,DGRRCNT
S (DGRRI,DGRRCNT)=0
F S DGRRI=$O(^TMP($J,"PLUQRY",DGRRI)) Q:DGRRI="" D
.N DGRR0,DGRR1,DGRR2,DGRR3,DGRR4,DGRRVPID,DGRRIEN,DGRRNM,DGRRSSN,DGRRDOB,DGRRSEX
.S DGRRCNT=DGRRCNT+1
.; DGRR0=VPID^IEN^Last Name~First Name~Middle Name^SSN^DOB^SEX
.S DGRR0=$G(^TMP($J,"PLUQRY",DGRRCNT,0))
.S DGRR1=$G(^TMP($J,"PLUQRY",DGRRCNT,1)) ;Provider Type
.S DGRR2=$G(^TMP($J,"PLUQRY",DGRRCNT,2)) ;Provider Classification
.S DGRR3=$G(^TMP($J,"PLUQRY",DGRRCNT,3)) ;Area of Specialization
.; DGRR4=VA Code^X12 Code^Specialty Code
.S DGRR4=$G(^TMP($J,"PLUQRY",DGRRCNT,4))
.S DGRRVPID=$P(DGRR0,U)
.S DGRRIEN=$P(DGRR0,U,2)
.S DGRRNM=$P(DGRR0,U,3)
.S DGRRSSN=$P(DGRR0,U,4)
.S DGRRDOB=$P(DGRR0,U,5)
.S DGRRSEX=$P(DGRR0,U,6)
.D FOUND
D FINALLY
Q
;
FINALLY DO ADD("<error message='"_$G(ERRMESS)_"'></error>")
DO ADD("<maximum message=''></maximum>")
DO ADD("<record count='"_DGRRCNT_"'></record>")
I $G(DGRRARR)'="" K @DGRRARR
K ^TMP($J,"PLUQRY")
Q
;
FOUND ;Build XML of found records
;
DO ADD("<person>")
DO ADD("<vpid>"_$$CHARCHK^DGRRUTL(DGRRVPID)_"</vpid>")
DO ADD("<ien>"_$$CHARCHK^DGRRUTL(DGRRIEN)_"</ien>")
DO ADD("<lname>"_$$CHARCHK^DGRRUTL($P(DGRRNM,"~",1))_"</lname>")
DO ADD("<fname>"_$$CHARCHK^DGRRUTL($P(DGRRNM,"~",2))_"</fname>")
DO ADD("<mname>"_$$CHARCHK^DGRRUTL($P(DGRRNM,"~",3))_"</mname>")
DO ADD("<ssn>"_$$CHARCHK^DGRRUTL(DGRRSSN)_"</ssn>")
DO ADD("<dob>"_$$CHARCHK^DGRRUTL(DGRRDOB)_"</dob>")
DO ADD("<sex>"_$$CHARCHK^DGRRUTL(DGRRSEX)_"</sex>")
DO ADD("<providerInfo>")
DO ADD("<type>"_$$CHARCHK^DGRRUTL($P(DGRR1,U))_"</type>")
DO ADD("<classification>"_$$CHARCHK^DGRRUTL($P(DGRR2,U))_"</classification>")
DO ADD("<specialization>"_$$CHARCHK^DGRRUTL($P(DGRR3,U))_"</specialization>")
DO ADD("<VACode>"_$$CHARCHK^DGRRUTL($P(DGRR4,U))_"</VACode>")
DO ADD("<X12Code>"_$$CHARCHK^DGRRUTL($P(DGRR4,U,2))_"</X12Code>")
DO ADD("<SpecialityCode>"_$$CHARCHK^DGRRUTL($P(DGRR4,U,3))_"</SpecialityCode>")
DO ADD("</providerInfo>")
DO ADD("</person>")
QUIT
;
ADD(STR) ; add string to array
SET DGRRLINE=DGRRLINE+1
SET @DGRRESLT@(DGRRLINE)=STR
QUIT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGRRLU5 7160 printed Nov 22, 2024@18:07:38 Page 2
DGRRLU5 ; ALB/sgg/MM - DG Replacement and Rehosting RPC for VADPT ; May-4-2004 ;
+1 ;;5.3;Registration;**538**;Aug 13, 1993
+2 ; provider lookup
+3 ; called by DGRRLU at line PRVLUP^DGRRLU5 if PARAMS("SEARCH_TYPE") = "PRVLUP"
+4 ;
+5 ;
DOC ;INPUT: Input is by the following parameters in the PARAMS() array:
+1 ;
+2 ;"PRV_VPID" - VPID [Required VPID unless PRV_LNAM is not Null.]
+3 ; If not null the query will only return the one person
+4 ; with this VPID, and only then if SSN, PROV and STN filters
+5 ; do not exclude this person.
+6 ;"PRV_LNAM" - LAST NAME [Required Char String unless VPID is not Null.]
+7 ; If not null the query will only return persons whose
+8 ; last name starts with this string.
+9 ;"PRV_FNAM" - FIRST NAME [Optional: Character String or Null.]
+10 ; If not null the query will only return persons whose
+11 ; first name starts with this string.
+12 ;"PRV_SSN" - SSN FILTER [Optional: 9 digits or Null.]
+13 ; If not null the query will only return persons with
+14 ; this social security number.
+15 ;"PRV_PROV" - PROVIDER FILTER [Optional: "P" or Null.]
+16 ; If set to "P" the query includes only providers, i.e.
+17 ; persons with a person class active on the PRV_DATE.
+18 ;"PRV_STN" - STATION NUMBER FILTER [Optional: an STN or Null.]
+19 ; If not null the query only returns persons with this
+20 ; station number.
+21 ;"PRV_MNM" - MAXIMUM NUMBER [Optional: min=1 max=50 default=50.]
+22 ; The maximum number of persons the query will return.
+23 ; If VPID is not null this is always 1.
+24 ;"PRV_DATE" - DATE [Optional: if Null this defaults to Today.]
+25 ; The Date against which a persons active person class is
+26 ; determined.
+27 ;
+28 ;OUTPUT: Output an XML with a schema as given:
+29 ;
+30 ; <?xml version="1.0" encoding="utf-8" ?>
+31 ; <persons> Example Data
+32 ; <person>
+33 ; </vpid> 999999999
+34 ; </ien> 11579
+35 ; </lname> KRUSHER
+36 ; </fname> WILL
+37 ; </mname> MIDDIE
+38 ; </ssn> 232323232
+39 ; </dob> 2330303
+40 ; </sex> M
+41 ; <providerInfo>
+42 ; </type> Physician Assistants
+43 ; </classification> Physician Assistant
+44 ; </specialization> Medical
+45 ; </VACode> V100100
+46 ; </X12Code> 363AM0700N
+47 ; </SpecialityCode> 97
+48 ; </providerInfo>
+49 ; </person>
+50 ; <error message=''></error>
+51 ; <maximum message=''></maximum>
+52 ; <record count='1'></record>
+53 ; <institution name='ALBANY' number='500' productiondatabase='0' domain='DMA.FO-ALBANY.DOMAIN.EXT' ></institution>
+54 ; </persons>
+55 ;
+56 ;
PRVLUP(RESULT,PARAMS) ;
+1 NEW DGRRVPID,DGRRLNAM,DGRRFNAM,DGRRSSN,DGRRPROV,DGRRSTN,DGRRMNM,DGRRDATE
+2 ; - The VPID of a Provider (Required unless lookup is by Provider Name)
SET DGRRVPID=$GET(PARAMS("PRV_VPID"))
+3 ; - Part or all of the last name to use for basis of query (Required unless lookup is by VPID)
SET DGRRLNAM=$GET(PARAMS("PRV_LNAM"))
+4 ; - Part or all of the first name to use for basis of query filter (optional, can be null)
SET DGRRFNAM=$GET(PARAMS("PRV_FNAM"))
+5 ; - Social Security Number (null or full 9 digits) to use as additional filter for query
SET DGRRSSN=$GET(PARAMS("PRV_SSN"))
+6 ; - If value set to "P", screen for only providers (only persons with active person class)
SET DGRRPROV=$GET(PARAMS("PRV_PROV"))
+7 ; - Filter persons based on station number entered (optional, can be null)
SET DGRRSTN=$GET(PARAMS("PRV_STN"))
+8 ; - Maximum Number of entries to return (Number between 1 and 50. Null defaults to 50)
SET DGRRMNM=$GET(PARAMS("PRV_MNM"))
+9 ; - Date to be used to determine whether person has active person class. If null, current date is used.
SET DGRRDATE=$GET(PARAMS("PRV_DATE"))
+10 ;
+11 NEW DGRRARR,DGRRCNT,ERRMESS,DGRRGLB
+12 DO ADD("<persons>")
+13 ;Initialize Record Count
SET DGRRCNT=0
+14 IF (DGRRLNAM="")
IF (DGRRVPID="")
SET ERRMESS="Query requires a last name or a VPID."
GOTO FINALLY
+15 ;
+16 DO EN1^XUPSQRY(.DGRRARR,DGRRVPID,DGRRLNAM,DGRRFNAM,DGRRSSN,DGRRPROV,DGRRSTN,DGRRMNM,DGRRDATE)
+17 KILL ^TMP($JOB,"PLUQRY")
+18 MERGE ^TMP($JOB,"PLUQRY")=@DGRRARR
+19 IF '$DATA(^TMP($JOB,"PLUQRY",1))!($GET(^TMP($JOB,"PLUQRY",1))=0)
Begin DoDot:1
+20 SET ERRMESS="No records found."
+21 DO FINALLY
End DoDot:1
QUIT
+22 NEW DGRRI,DGRRCNT
+23 SET (DGRRI,DGRRCNT)=0
+24 FOR
SET DGRRI=$ORDER(^TMP($JOB,"PLUQRY",DGRRI))
if DGRRI=""
QUIT
Begin DoDot:1
+25 NEW DGRR0,DGRR1,DGRR2,DGRR3,DGRR4,DGRRVPID,DGRRIEN,DGRRNM,DGRRSSN,DGRRDOB,DGRRSEX
+26 SET DGRRCNT=DGRRCNT+1
+27 ; DGRR0=VPID^IEN^Last Name~First Name~Middle Name^SSN^DOB^SEX
+28 SET DGRR0=$GET(^TMP($JOB,"PLUQRY",DGRRCNT,0))
+29 ;Provider Type
SET DGRR1=$GET(^TMP($JOB,"PLUQRY",DGRRCNT,1))
+30 ;Provider Classification
SET DGRR2=$GET(^TMP($JOB,"PLUQRY",DGRRCNT,2))
+31 ;Area of Specialization
SET DGRR3=$GET(^TMP($JOB,"PLUQRY",DGRRCNT,3))
+32 ; DGRR4=VA Code^X12 Code^Specialty Code
+33 SET DGRR4=$GET(^TMP($JOB,"PLUQRY",DGRRCNT,4))
+34 SET DGRRVPID=$PIECE(DGRR0,U)
+35 SET DGRRIEN=$PIECE(DGRR0,U,2)
+36 SET DGRRNM=$PIECE(DGRR0,U,3)
+37 SET DGRRSSN=$PIECE(DGRR0,U,4)
+38 SET DGRRDOB=$PIECE(DGRR0,U,5)
+39 SET DGRRSEX=$PIECE(DGRR0,U,6)
+40 DO FOUND
End DoDot:1
+41 DO FINALLY
+42 QUIT
+43 ;
FINALLY DO ADD("<error message='"_$GET(ERRMESS)_"'></error>")
+1 DO ADD("<maximum message=''></maximum>")
+2 DO ADD("<record count='"_DGRRCNT_"'></record>")
+3 IF $GET(DGRRARR)'=""
KILL @DGRRARR
+4 KILL ^TMP($JOB,"PLUQRY")
+5 QUIT
+6 ;
FOUND ;Build XML of found records
+1 ;
+2 DO ADD("<person>")
+3 DO ADD("<vpid>"_$$CHARCHK^DGRRUTL(DGRRVPID)_"</vpid>")
+4 DO ADD("<ien>"_$$CHARCHK^DGRRUTL(DGRRIEN)_"</ien>")
+5 DO ADD("<lname>"_$$CHARCHK^DGRRUTL($PIECE(DGRRNM,"~",1))_"</lname>")
+6 DO ADD("<fname>"_$$CHARCHK^DGRRUTL($PIECE(DGRRNM,"~",2))_"</fname>")
+7 DO ADD("<mname>"_$$CHARCHK^DGRRUTL($PIECE(DGRRNM,"~",3))_"</mname>")
+8 DO ADD("<ssn>"_$$CHARCHK^DGRRUTL(DGRRSSN)_"</ssn>")
+9 DO ADD("<dob>"_$$CHARCHK^DGRRUTL(DGRRDOB)_"</dob>")
+10 DO ADD("<sex>"_$$CHARCHK^DGRRUTL(DGRRSEX)_"</sex>")
+11 DO ADD("<providerInfo>")
+12 DO ADD("<type>"_$$CHARCHK^DGRRUTL($PIECE(DGRR1,U))_"</type>")
+13 DO ADD("<classification>"_$$CHARCHK^DGRRUTL($PIECE(DGRR2,U))_"</classification>")
+14 DO ADD("<specialization>"_$$CHARCHK^DGRRUTL($PIECE(DGRR3,U))_"</specialization>")
+15 DO ADD("<VACode>"_$$CHARCHK^DGRRUTL($PIECE(DGRR4,U))_"</VACode>")
+16 DO ADD("<X12Code>"_$$CHARCHK^DGRRUTL($PIECE(DGRR4,U,2))_"</X12Code>")
+17 DO ADD("<SpecialityCode>"_$$CHARCHK^DGRRUTL($PIECE(DGRR4,U,3))_"</SpecialityCode>")
+18 DO ADD("</providerInfo>")
+19 DO ADD("</person>")
+20 QUIT
+21 ;
ADD(STR) ; add string to array
+1 SET DGRRLINE=DGRRLINE+1
+2 SET @DGRRESLT@(DGRRLINE)=STR
+3 QUIT