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

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

initial load of WorldVistAEHR

File size: 3.9 KB
RevLine 
[613]1DGRRLU4 ;BPFO/MM RPCs for Division preferences - ;11/15/04 11:38
2 ;;5.3;Registration;**538**;Aug 13, 1993
3 ;
4START(RESULT,PARAMS) ;Generates division/package preferences in xml format
5 ;
6 ;Called from DGRR PATIENT LKUP PREFERENCES remote procedure call
7 ;
8 ;Input: PARAMS("stationNumber")= station number for institution
9 ; If not defined, defaults to package parameter values.
10 ;
11 ;Output: RESULT contains the preferences for the division. If not
12 ; specified contains the default package parameters.
13 ;
14 N LINE,DGRRI,DGRRVAL,DGRRATT,DGRRDIV,DGRRDIVN,DGRRLINE,DGRRESLT
15 S DGRRDIVN=$G(PARAMS("stationNumber"))
16 S DGRRDIV=$$IEN^XUAF4(DGRRDIVN)
17 S DGRRLINE=0
18 K ^TMP($J,"PLU-DIVPREF")
19 S DGRRESLT="^TMP($J,""PLU-DIVPREF"")"
20 S RESULT=$NA(@DGRRESLT)
21 D ADD^DGRRUTL($$XMLHDR^DGRRUTL())
22 D ADD^DGRRUTL("<preferences>")
23 D ADD^DGRRUTL("<error/>")
24 D ADD^DGRRUTL("<institutionPreferences>")
25 D ADD^DGRRUTL("<stationNumber>"_$$CHARCHK^DGRRUTL($G(DGRRDIVN))_"</stationNumber>")
26 ;
27 ; Gather preference values and build xml file
28 F DGRRI=1:1 S LINE=$P($T(PREF+DGRRI),";;",2) Q:LINE="QUIT" D
29 .;Return preferences in precedence order set in Parameter Definition.
30 .;Will return division values if found. If not defined, returns
31 .;package default values
32 .S DGRRVAL=$$GET^XPAR("ALL^DIV.`"_DGRRDIV,$P(LINE,U),1,"E")
33 .S DGRRATT=$P(LINE,U,2)
34 .D ADD^DGRRUTL("<"_DGRRATT_">"_$$CHARCHK^DGRRUTL(DGRRVAL)_"</"_DGRRATT_">")
35 D ADD^DGRRUTL("</institutionPreferences>")
36 D ADD^DGRRUTL("</preferences>")
37 Q
38 ;
39UPDATE(RESULT,PARAMS) ;Entry point to add or change preference values
40 ;
41 ;Input: PARAMS("stationNumber")=Station # for the institution (Required)
42 ; PARAMS("divPreference",Preference Name)=Value (Required)
43 ;
44 ;Output: Results in xml format
45 ;
46 N DGRRARY,DGRRDIV,DGRRDIVN,DGRRERR,DGRRI,DGRRESLT,DGRRPREF,DGRRUPD,LINE
47 S DGRRDIVN=$G(PARAMS("stationNumber"))
48 S DGRRDIV=+$$IEN^XUAF4(DGRRDIVN)
49 K ^TMP($J,"PLU-DIVPREF-UPD")
50 S RESULT=$NA(^TMP($J,"PLU-DIVPREF-UPD"))
51 ; Log error for xml document and quit if invalid station number passed to call.
52 I 'DGRRDIV D Q
53 .S DGRRERR="Invalid stationNumber"
54 .S DGRRUPD="false"
55 .D XML(DGRRERR,DGRRUPD,RESULT)
56 ; Build array of preferences from parameter preference names.
57 F DGRRI=1:1 S LINE=$P($T(PREF+DGRRI),";;",2) Q:LINE="QUIT" D
58 .S DGRRARY($P(LINE,U,2))=$P(LINE,U)
59 S DGRRPREF=""
60 F DGRRI=1:1 S DGRRPREF=$O(DGRRARY(DGRRPREF)) Q:DGRRPREF="" D Q:DGRRUPD="false"
61 .N DGRRPR,DGRRVAL,ERR
62 .S (DGRRERR,DGRRUPD)=""
63 .S DGRRPR=$G(DGRRARY(DGRRPREF))
64 .S DGRRVAL=$G(PARAMS(DGRRPREF))
65 .;Value and Preference must be defined
66 .I DGRRPR=""!(DGRRVAL="") D Q
67 ..S DGRRUPD="false"
68 ..S DGRRERR="Invalid Preference "_$S(DGRRPR="":"Name",1:"Value")
69 .D EN^XPAR("DIV.`"_DGRRDIV,DGRRPR,1,DGRRVAL,.ERR)
70 .; If no errors, ERR=0. Errors are returned in the format:
71 .; internal entry number in Dialog file^error text describing error
72 .I ERR'=0 D Q
73 ..S DGRRUPD="false"
74 ..S DGRRERR=$P(ERR,U,2)
75 .S DGRRUPD="true"
76 D XML(DGRRERR,DGRRUPD,RESULT)
77 Q
78XML(DGRRERR,DGRRUPD,DGRRESLT) ;Builds xml document
79 N DGRRLINE
80 S DGRRERR=$G(DGRRERR)
81 S DGRRUPD=$G(DGRRUPD)
82 S DGRRLINE=0
83 K @DGRRESLT
84 D ADD^DGRRUTL($$XMLHDR^DGRRUTL())
85 D ADD^DGRRUTL("<preferences>")
86 D ADD^DGRRUTL("<error>"_$$CHARCHK^DGRRUTL(DGRRERR)_"</error>")
87 D ADD^DGRRUTL("<institutionPreferences>")
88 D ADD^DGRRUTL("<stationNumber>"_$$CHARCHK^DGRRUTL($G(DGRRDIVN))_"</stationNumber>")
89 D ADD^DGRRUTL("<preferencesUpdated>"_$$CHARCHK^DGRRUTL(DGRRUPD)_"</preferencesUpdated>")
90 D ADD^DGRRUTL("</institutionPreferences>")
91 D ADD^DGRRUTL("</preferences>")
92 Q
93 ;
94PREF ;Parameter definition^divPref received from/returned to calling app
95 ;;DGRR PL MAX NUM PATIENTS RET^maxNumPatients
96 ;;DGRR PL NUM PATIENTS PER PAGE^patientsPerPage
97 ;;DGRR PL PATIENT TYPE^patientType
98 ;;DGRR PL GENDER^gender
99 ;;DGRR PL PRIMARY ELIGIBILITY^primaryEligibility
100 ;;DGRR PL ROOM BED^roomBed
101 ;;DGRR PL SERVICE CONNECTED^serviceConnected
102 ;;DGRR PL VETERAN STATUS^veteranStatus
103 ;;DGRR PL WARD^ward
104 ;;DGRR PL VETERAN IMAGE^veteranImage
105 ;;QUIT
106 Q
Note: See TracBrowser for help on using the repository browser.