source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRRLU5.m@ 1141

Last change on this file since 1141 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.9 KB
Line 
1DGRRLU5 ; ALB/sgg/MM - DG Replacement and Rehosting RPC for VADPT ; May-4-2004 ;
2 ;;5.3;Registration;**538**;Aug 13, 1993
3 ; provider lookup
4 ; called by DGRRLU at line PRVLUP^DGRRLU5 if PARAMS("SEARCH_TYPE") = "PRVLUP"
5 ;
6 ;
7DOC ;INPUT: Input is by the following parameters in the PARAMS() array:
8 ;
9 ;"PRV_VPID" - VPID [Required VPID unless PRV_LNAM is not Null.]
10 ; If not null the query will only return the one person
11 ; with this VPID, and only then if SSN, PROV and STN filters
12 ; do not exclude this person.
13 ;"PRV_LNAM" - LAST NAME [Required Char String unless VPID is not Null.]
14 ; If not null the query will only return persons whose
15 ; last name starts with this string.
16 ;"PRV_FNAM" - FIRST NAME [Optional: Character String or Null.]
17 ; If not null the query will only return persons whose
18 ; first name starts with this string.
19 ;"PRV_SSN" - SSN FILTER [Optional: 9 digits or Null.]
20 ; If not null the query will only return persons with
21 ; this social security number.
22 ;"PRV_PROV" - PROVIDER FILTER [Optional: "P" or Null.]
23 ; If set to "P" the query includes only providers, i.e.
24 ; persons with a person class active on the PRV_DATE.
25 ;"PRV_STN" - STATION NUMBER FILTER [Optional: an STN or Null.]
26 ; If not null the query only returns persons with this
27 ; station number.
28 ;"PRV_MNM" - MAXIMUM NUMBER [Optional: min=1 max=50 default=50.]
29 ; The maximum number of persons the query will return.
30 ; If VPID is not null this is always 1.
31 ;"PRV_DATE" - DATE [Optional: if Null this defaults to Today.]
32 ; The Date against which a persons active person class is
33 ; determined.
34 ;
35 ;OUTPUT: Output an XML with a schema as given:
36 ;
37 ; <?xml version="1.0" encoding="utf-8" ?>
38 ; <persons> Example Data
39 ; <person>
40 ; </vpid> 999999999
41 ; </ien> 11579
42 ; </lname> KRUSHER
43 ; </fname> WILL
44 ; </mname> MIDDIE
45 ; </ssn> 232323232
46 ; </dob> 2330303
47 ; </sex> M
48 ; <providerInfo>
49 ; </type> Physician Assistants
50 ; </classification> Physician Assistant
51 ; </specialization> Medical
52 ; </VACode> V100100
53 ; </X12Code> 363AM0700N
54 ; </SpecialityCode> 97
55 ; </providerInfo>
56 ; </person>
57 ; <error message=''></error>
58 ; <maximum message=''></maximum>
59 ; <record count='1'></record>
60 ; <institution name='ALBANY' number='500' productiondatabase='0' domain='DMA.FO-ALBANY.MED.VA.GOV' ></institution>
61 ; </persons>
62 ;
63 ;
64PRVLUP(RESULT,PARAMS) ;
65 NEW DGRRVPID,DGRRLNAM,DGRRFNAM,DGRRSSN,DGRRPROV,DGRRSTN,DGRRMNM,DGRRDATE
66 SET DGRRVPID=$G(PARAMS("PRV_VPID")) ; - The VPID of a Provider (Required unless lookup is by Provider Name)
67 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)
68 SET DGRRFNAM=$G(PARAMS("PRV_FNAM")) ; - Part or all of the first name to use for basis of query filter (optional, can be null)
69 SET DGRRSSN=$G(PARAMS("PRV_SSN")) ; - Social Security Number (null or full 9 digits) to use as additional filter for query
70 SET DGRRPROV=$G(PARAMS("PRV_PROV")) ; - If value set to "P", screen for only providers (only persons with active person class)
71 SET DGRRSTN=$G(PARAMS("PRV_STN")) ; - Filter persons based on station number entered (optional, can be null)
72 SET DGRRMNM=$G(PARAMS("PRV_MNM")) ; - Maximum Number of entries to return (Number between 1 and 50. Null defaults to 50)
73 SET DGRRDATE=$G(PARAMS("PRV_DATE")) ; - Date to be used to determine whether person has active person class. If null, current date is used.
74 ;
75 N DGRRARR,DGRRCNT,ERRMESS,DGRRGLB
76 DO ADD("<persons>")
77 SET DGRRCNT=0 ;Initialize Record Count
78 IF (DGRRLNAM=""),(DGRRVPID="") SET ERRMESS="Query requires a last name or a VPID." GOTO FINALLY
79 ;
80 D EN1^XUPSQRY(.DGRRARR,DGRRVPID,DGRRLNAM,DGRRFNAM,DGRRSSN,DGRRPROV,DGRRSTN,DGRRMNM,DGRRDATE)
81 K ^TMP($J,"PLUQRY")
82 M ^TMP($J,"PLUQRY")=@DGRRARR
83 I '$D(^TMP($J,"PLUQRY",1))!($G(^TMP($J,"PLUQRY",1))=0) D Q
84 .S ERRMESS="No records found."
85 .D FINALLY
86 N DGRRI,DGRRCNT
87 S (DGRRI,DGRRCNT)=0
88 F S DGRRI=$O(^TMP($J,"PLUQRY",DGRRI)) Q:DGRRI="" D
89 .N DGRR0,DGRR1,DGRR2,DGRR3,DGRR4,DGRRVPID,DGRRIEN,DGRRNM,DGRRSSN,DGRRDOB,DGRRSEX
90 .S DGRRCNT=DGRRCNT+1
91 .; DGRR0=VPID^IEN^Last Name~First Name~Middle Name^SSN^DOB^SEX
92 .S DGRR0=$G(^TMP($J,"PLUQRY",DGRRCNT,0))
93 .S DGRR1=$G(^TMP($J,"PLUQRY",DGRRCNT,1)) ;Provider Type
94 .S DGRR2=$G(^TMP($J,"PLUQRY",DGRRCNT,2)) ;Provider Classification
95 .S DGRR3=$G(^TMP($J,"PLUQRY",DGRRCNT,3)) ;Area of Specialization
96 .; DGRR4=VA Code^X12 Code^Specialty Code
97 .S DGRR4=$G(^TMP($J,"PLUQRY",DGRRCNT,4))
98 .S DGRRVPID=$P(DGRR0,U)
99 .S DGRRIEN=$P(DGRR0,U,2)
100 .S DGRRNM=$P(DGRR0,U,3)
101 .S DGRRSSN=$P(DGRR0,U,4)
102 .S DGRRDOB=$P(DGRR0,U,5)
103 .S DGRRSEX=$P(DGRR0,U,6)
104 .D FOUND
105 D FINALLY
106 Q
107 ;
108FINALLY DO ADD("<error message='"_$G(ERRMESS)_"'></error>")
109 DO ADD("<maximum message=''></maximum>")
110 DO ADD("<record count='"_DGRRCNT_"'></record>")
111 I $G(DGRRARR)'="" K @DGRRARR
112 K ^TMP($J,"PLUQRY")
113 Q
114 ;
115FOUND ;Build XML of found records
116 ;
117 DO ADD("<person>")
118 DO ADD("<vpid>"_$$CHARCHK^DGRRUTL(DGRRVPID)_"</vpid>")
119 DO ADD("<ien>"_$$CHARCHK^DGRRUTL(DGRRIEN)_"</ien>")
120 DO ADD("<lname>"_$$CHARCHK^DGRRUTL($P(DGRRNM,"~",1))_"</lname>")
121 DO ADD("<fname>"_$$CHARCHK^DGRRUTL($P(DGRRNM,"~",2))_"</fname>")
122 DO ADD("<mname>"_$$CHARCHK^DGRRUTL($P(DGRRNM,"~",3))_"</mname>")
123 DO ADD("<ssn>"_$$CHARCHK^DGRRUTL(DGRRSSN)_"</ssn>")
124 DO ADD("<dob>"_$$CHARCHK^DGRRUTL(DGRRDOB)_"</dob>")
125 DO ADD("<sex>"_$$CHARCHK^DGRRUTL(DGRRSEX)_"</sex>")
126 DO ADD("<providerInfo>")
127 DO ADD("<type>"_$$CHARCHK^DGRRUTL($P(DGRR1,U))_"</type>")
128 DO ADD("<classification>"_$$CHARCHK^DGRRUTL($P(DGRR2,U))_"</classification>")
129 DO ADD("<specialization>"_$$CHARCHK^DGRRUTL($P(DGRR3,U))_"</specialization>")
130 DO ADD("<VACode>"_$$CHARCHK^DGRRUTL($P(DGRR4,U))_"</VACode>")
131 DO ADD("<X12Code>"_$$CHARCHK^DGRRUTL($P(DGRR4,U,2))_"</X12Code>")
132 DO ADD("<SpecialityCode>"_$$CHARCHK^DGRRUTL($P(DGRR4,U,3))_"</SpecialityCode>")
133 DO ADD("</providerInfo>")
134 DO ADD("</person>")
135 QUIT
136 ;
137ADD(STR) ; add string to array
138 SET DGRRLINE=DGRRLINE+1
139 SET @DGRRESLT@(DGRRLINE)=STR
140 QUIT
Note: See TracBrowser for help on using the repository browser.