source: FOIAVistA/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/ALPBPARM.m@ 1751

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

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1ALPBPARM ;SFVAMC/JC - Parameter Definitions ;05/02/2003 15:24
2 ;;3.0;BAR CODE MED ADMIN;**8**;Mar 2004
3 N DEF,OPR,ZLNK
4 N ALPBSCRN,ALPBPARM,ALPBDIVE,ALPBDIVI,ALPBDIVP,ALPBINST,LNK,ERR,DIC,DIE,DA,DR,DIR
5 D Q3
6 S DIR(0)="Y",DIR("B")="YES" D ^DIR
7 I $D(DTOUT)!($D(DUOUT)) G OUT
8 S DEF=Y K DA,DIR,Y
9 I DEF=1 S ALPBPARM="PSB BKUP DEFAULT"
10 ;Associate HL7 Logical Links with division(s)
11 I $G(ALPBPARM)']"" S ALPBPARM="PSB BKUP MACHINES"
12 S DIR(0)="S^A:Add a Logical Link;D:Delete a Logical Link"
13 S DIR("A")="OPERATION",DIR("B")="ADD"
14 D ^DIR
15 I $D(DTOUT)!($D(DUOUT)) G OUT
16 S OPR=Y K DA,DIR,Y
17 I DEF=1 D DLINKS G OUT
18DIV ;division
19 N ALPBDIVP,ALPBDIVI,ALPBDIVE,ALPBINST
20 S ALPBDIVP=""
21 ;note-parameter file requires institutions instead of divisions
22 ;in DIV class
23 D Q1 S DIR(0)="PO^40.8:EMZ" D ^DIR
24 Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
25 S ALPBDIVI=+Y ;INTERNAL MEDICAL CENTER DIVISION
26 S ALPBDIVE=$P(Y,U,2) ;EXTERNAL MED CTR DIVISION
27 S ALPBINST=$P(Y(0),U,7) ;INSTITUTION FILE POINTER
28 I $G(ALPBINST)']"" W !,"Medical Ctr Divisions must be associated with an institution." G OUT
29 S ALPBDIVP="DIV.`"_ALPBINST ;PARAMETER FILE REFERENCE
30 I $G(ALPBDIVP)']"" W !,"Division information is required." G OUT
31 K DA,DIR,Y
32 D LINKS G DIV
33 Q
34DLINKS ;What logical links for the DEFAULT parmeter?
35 K Y S X="BAR CODE MED ADMIN",DIC="^DIC(9.4,",DIC(0)="X",D="B" D IX^DIC
36 S ALPBPKG=+$P($G(Y),U,1)
37 I '$G(ALPBPKG) W !,"BAR CODE MED ADMIN MISSING FROM PACKAGE FILE." Q
38 S ALPBPKG="PKG.`"_ALPBPKG
39 K ZLNK
40 D GET(.ZLNK)
41 I '$D(ZLNK) W !,"No DEFAULT links defined for this package." Q:OPR="D"
42 W !,"The following DEFAULT links are associated with this package:"
43 S X="" F S X=$O(ZLNK("LINKS",X)) Q:X<1 D
44 . W !,$P(ZLNK("LINKS",X),U,2)
45 . I OPR="D" S ALPSCRN($P(ZLNK("LINKS",X),U,2),X)=ZLNK("LINKS",X)
46 F D Q:$G(DUOUT)!($G(DTOUT))!($G(DIRUT))
47 . D Q2
48 . I OPR="D" S DIR("S")="I $D(ALPSCRN($P(^HLCS(870,+Y,0),U,1)))"
49 . S DIR("A")="Select WorkStation Link "
50 . S DIR(0)="PO^870:EMZ" D ^DIR
51 . I $G(DUOUT)!($G(DTOUT))!($G(DIRUT)) K DA,DIR,Y Q
52 . I Y>0 S RESULT=$$SET(ALPBPKG,$P(Y,U,2))
53 . I $G(RESULT)'<1 W !,RESULT
54 . K DA,DIR,Y
55 K ZLNK
56 Q
57LINKS ;What logical links for a division?
58 W !,"The Institution associated with this division is ",$$NS^XUAF4(ALPBINST)
59 D GET(.LNK,ALPBDIVE,1)
60 I '$D(LNK),$G(OPR)="D" W !,"No links defined for this division." Q
61 W !,"The following links are associated with this division:"
62 S X="" F S X=$O(LNK("LINKS",X)) Q:X<1 D
63 . W !,$P(LNK("LINKS",X),U,2)
64 . I OPR="D" S ALPSCRN($P(LNK("LINKS",X),U,2),X)=LNK("LINKS",X)
65 K LNK
66 F D Q:$G(DUOUT)!($G(DTOUT))!($G(DIRUT))
67 . D Q2
68 . I OPR="D" S DIR("S")="I $D(ALPSCRN($P(^HLCS(870,+Y,0),U,1)))"
69 . S DIR("A")="Select WorkStation Link "
70 . S DIR(0)="PO^870:EMZ" D ^DIR
71 . I $G(DUOUT)!($G(DTOUT))!($G(DIRUT)) K DA,DIR,Y Q
72 . I Y>0 S RESULT=$$SET(ALPBDIVP,$P(Y,U,2))
73 . I $G(RESULT)'<1 W !,RESULT
74 . K DA,DIR,Y,RESULT
75 Q
76SET(ALPBDIVP,LINK) ;function to set or delete parameter for logical link
77 ;and returns error response or zero
78 I OPR="A" D EN^XPAR(ALPBDIVP,ALPBPARM,LINK,LINK,.ERR) I ERR=0 W "...Added"
79 I OPR="D" D DEL^XPAR(ALPBDIVP,ALPBPARM,LINK,.ERR) I ERR=0 W "...Deleted" I $D(ALPSCRN(LINK)) K ALPSCRN(LINK)
80 Q ERR
81GET(HLL,DIV,FLG,PR) ;Return HLL("LINKS") array for a given patient division
82 ;HLL-HLL("links") array - pass by reference
83 ;DIV- DIVISION (OPTIONAL)
84 ;FLG-1=DON'T RETURN DEFAULT IF DIV IS EMPTY (OPTIONAL)
85 ;PR-SUBSCRIBER PROTOCOL TO INCLUDE WITH THE HLL ARRAY (DEF=BCBU ORM RECV)
86 ;or a default group if div null
87 I $G(PR)="" S PR="PSB BCBU ORM RECV"
88 I +$G(FLG)'=1 S FLG=0
89 N LST S LST=""
90 I $G(DIV)="" D G OUT
91 . K Y S X="BAR CODE MED ADMIN",DIC="^DIC(9.4,",DIC(0)="X",D="B" D IX^DIC
92 . S ALPBPKG=+$P($G(Y),U,1)
93 . Q:'ALPBPKG S ALPBPKG="PKG.`"_ALPBPKG
94 . D GETLST^XPAR(.LST,ALPBPKG,"PSB BKUP DEFAULT","E",.ERR)
95 . D GET1
96 N INST S INST=$$DV(DIV)
97 I INST']"" W !,"Unknown Institiution-please review Medical Ctr Division File." G OUT
98 D GETLST^XPAR(.LST,"DIV.`"_INST,"PSB BKUP MACHINES","E",.ERR)
99 I $O(LST(0))<1!(ERR) D
100 . Q:+FLG=1
101 . D GET(.HLL,"") ;Try to use default list if no results.
102GET1 ;
103 I $O(LST(0)),ERR=0 N X S X=0 F S X=$O(LST(X)) Q:X<1 D
104 . Q:$P(LST(X),U,2)']""
105 . N LNK870 S LNK870=$P(LST(X),U,2) Q:$E(LNK870,1,2)="VA" ;don't init hospital
106 . S HLL("LINKS",X)=PR_U_$P(LST(X),U,2)
107 Q
108DV(DV) ;take internal or external division and return institution
109 I +DV>0 S X="`"_DV
110 N Y,DIC,DA
111 S DIC=40.8,DIC(0)="MQZ",X=DV D ^DIC
112 I Y'<1 Q $P(Y(0),U,7)
113 Q ""
114Q1 ;division help
115 S DIR("?")=" "
116 S DIR("?",1)="If you are associating different workstations with different"
117 S DIR("?",2)="divisions, you must choose a division first, then you will be asked"
118 S DIR("?",3)="to enter HL7 Logical Links that correspond to this division."
119 Q
120Q2 ;Link help
121 S DIR("?")=" "
122 S DIR("?",1)="Each of the workstations you use for BCMA backups will"
123 S DIR("?",2)="have a fixed TCP/IP address assigned and an HL7 Logical"
124 S DIR("?",3)="Link associated with it. Now your workstations must be"
125 S DIR("?",4)="associated with each division you have defined. If you are not a multi-"
126 S DIR("?",5)="divisional facility, all workstations will be associated"
127 S DIR("?",6)="with only one facility."
128 Q
129Q3 ;Ask Default
130 W !,"Do you want all backup data to go to the same group of"
131 W !,"backup devices regardless of the patient's division?"
132 Q
133OUT ;EXIT
134 Q
Note: See TracBrowser for help on using the repository browser.