source: FOIAVistA/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUTPBN.m@ 901

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

initial load of FOIAVistA 6/30/08 version

File size: 7.3 KB
Line 
1TIUTPBN ; SLC/AJB - Trans Pharm Care Note ; July 29, 2003 [3/16/04 1:37pm]
2 ;;1.0;TEXT INTEGRATION UTILITIES;**170,183,202**;Jun 20, 1997
3 ;
4 Q
5EN ;
6 X ^%ZOSF("EON") W IOCUON,@IOF
7 N FDA,FDAIEN,MSG,POP,TIUDA,TIUFPRIV,TIUIEN,TIUPRNT,TIUTMP
8 D PRE
9 I $$CHKTITLE(142.5,"TIU TPBN FUTURE APPTS")<0 D G EXIT
10 . W !!,"The Health Summary Object did not install correctly."
11 . W !,"Installation cannot continue."
12 S TIUFPRIV=1
13 S TIUIEN=$$CHKTITLE(8925.1,"TRANSITIONAL PHARMACY BENEFIT NOTE")
14 S TIUIEN=$S(TIUIEN>0:TIUIEN,1:"+1")
15 I $$CHKTITLE(8930,"CLINICAL COORDINATOR")<0 W !!,"Installation Error: Class owner cannot be defined.",! G EXIT
16 I TIUIEN="+1" F D Q:TIUPRNT>0!($D(DUOUT))
17 . D GETCLASS
18 . I $D(DUOUT) W !!,"Installation Aborted by User." S XPDABORT=1 Q
19 . I +TIUPRNT<0 W !!,"Installation Error: Invalid Selection.",!
20 . I W !,"A DOCUMENT CLASS must be entered or '^' to abort."
21 I +$G(TIUPRNT)<0 G EXIT
22 I $$MKOBJS<0 Q
23 S FDA(8925.1,TIUIEN_",",.01)="TRANSITIONAL PHARMACY BENEFIT NOTE"
24 S FDA(8925.1,TIUIEN_",",.02)=""
25 S FDA(8925.1,TIUIEN_",",.03)="TRANSITIONAL PHARMACY BENEFIT NOTE"
26 S FDA(8925.1,TIUIEN_",",.04)="DOC"
27 S FDA(8925.1,TIUIEN_",",.05)=""
28 S FDA(8925.1,TIUIEN_",",.06)=$$CHKTITLE(8930,"CLINICAL COORDINATOR")
29 S FDA(8925.1,TIUIEN_",",.07)=13
30 S FDA(8925.1,TIUIEN_",",3.02)=1
31 S FDA(8925.1,TIUIEN_",",99)=$H
32 D UPDATE^DIE("","FDA","FDAIEN","MSG")
33 I $D(MSG) D Q
34 . W !!,"The following error message was returned:",!!
35 . S MSG="" F S MSG=$O(MSG("DIERR",1,"TEXT",MSG)) Q:MSG="" W MSG("DIERR",1,"TEXT",MSG),!
36 W !!,"Creation of TRANSITIONAL PHARMACY BENEFIT NOTE title successful...",! H 1
37 I TIUIEN="+1" D
38 . S TIUDA=FDAIEN(1)
39 . S FDA(8925.14,"+2,"_TIUPRNT_",",.01)=FDAIEN(1)
40 . S FDA(8925.14,"+2,"_TIUPRNT_",",4)="Transitional Pharmacy Benefit Note"
41 . D UPDATE^DIE("","FDA","FDAIEN","MSG")
42 . I $D(MSG) D S XPDABORT=1 Q
43 .. W !!,"The following error message was returned:",!!
44 .. S MSG="" F S MSG=$O(MSG("DIERR",1,"TEXT",MSG)) Q:MSG="" W MSG("DIERR",1,"TEXT",MSG),!
45 . W !,"Addition of "_$P(^TIU(8925.1,TIUPRNT,0),U)_" as parent successful...",! H 1
46 I $G(TIUDA)="" S TIUDA=TIUIEN
47 D GETBOIL
48 K FDAIEN
49 S FDAIEN(TIUDA)=TIUDA
50 S FDA(8925.1,TIUDA_",",3)="TIUTMP"
51 D UPDATE^DIE("","FDA","FDAIEN","MSG")
52 I $D(MSG) D Q
53 . W !!,"The following error message was returned:",!!
54 . S MSG="" F S MSG=$O(MSG("DIERR",1,"TEXT",MSG)) Q:MSG="" W MSG("DIERR",1,"TEXT",MSG),!
55 W !,"Boilerplate text and objects added successfully.",!
56 W !,"Update finished.",!
57 W !,"*** The TRANSITIONAL PHARMACY BENEFIT NOTE title must be"
58 W !,"*** activated before use.",!
59EXIT D
60 .N DIR,X,Y
61 .S DIR(0)="E"
62 .W ! D ^DIR
63 Q
64ADD(TXT) ;
65 S NEXTLINE=NEXTLINE+1
66 S @TARGET@(NEXTLINE,0)=TXT
67 Q
68ADDSTR(STR1,STR2,MAX) ;
69 N CNT,DONE,TMP
70 S CNT=0,(DONE,TMP)=""
71 I '$D(STR2) D ADD(STR1) Q
72 I $L(STR1)<MAX S $P(TMP," ",MAX-$L(STR1))=" ",STR1=STR1_TMP D ADD(STR1_STR2) Q
73 E F D Q:DONE=1
74 .N TMPSTR S TMPSTR=""
75 .I $L(STR1)=MAX,$E(STR1,MAX)=" " S DONE=1 D ADD(STR1_STR2) Q
76 .F D Q:DONE=1
77 ..S CNT=CNT+1
78 ..I $L(TMPSTR_$P(STR1," ",CNT)_" ")<60 S TMPSTR=TMPSTR_$P(STR1," ",CNT)_" "
79 ..E S DONE=1,TMP="",$P(TMP," ",MAX-$L(TMPSTR))=" ",TMPSTR=TMPSTR_TMP D ADD(TMPSTR_STR2),ADD($P(STR1," ",CNT,999))
80 Q
81AOPMEDS(DFN,TARGET) ;
82 N DRUG,EMPTY,INDEX,NEXTLINE,NODE,TIUSTAT,TIUSTATS,TMP,NVAMED,NVASTR
83 S EMPTY=1,NEXTLINE=0
84 D OCL^PSOORRL(DFN,"","")
85 S TIUSTATS="^ACTIVE^REFILL^HOLD^PROVIDER HOLD^ON CALL^ACTIVE (S)^NON-VERIFIED^DRUG INTERACTIONS^INCOMPLETE^PENDING^"
86 S INDEX=0
87 F S INDEX=$O(^TMP("PS",$J,INDEX)) Q:INDEX'>0 D
88 .S NODE=$G(^TMP("PS",$J,INDEX,0))
89 .I '($L($P(NODE,U,2))>0) Q
90 .I $P(NODE,U)'["O" Q
91 .S TIUSTAT=$P(NODE,U,9) I TIUSTAT="ACTIVE/SUSP" S TIUSTAT="ACTIVE (S)",$P(NODE,U,9)=TIUSTAT
92 .I $F(TIUSTATS,"^"_TIUSTAT_"^")=0 Q
93 .S EMPTY=0
94 .S TMP($P(NODE,U,2),INDEX)=NODE
95 .S TMP($P(NODE,U,2),INDEX,"P")=$P($G(^TMP("PS",$J,INDEX,"P",0)),U,2)
96 .I ^TMP("PS",$J,INDEX,"SIG",0)>0 D
97 ..N TIUSIG S TIUSIG=0
98 ..F S TIUSIG=$O(^TMP("PS",$J,INDEX,"SIG",TIUSIG)) Q:TIUSIG="" S TMP($P(NODE,U,2),INDEX,"SIG",TIUSIG)=^TMP("PS",$J,INDEX,"SIG",TIUSIG,0)
99 ;
100 S (DRUG,INDEX)=0
101 F S DRUG=$O(TMP(DRUG)) Q:DRUG="" F S INDEX=$O(TMP(DRUG,INDEX)) Q:INDEX="" D
102 . S NODE=TMP(DRUG,INDEX)
103 . D ADDSTR("")
104 . N SIG S SIG=0
105 . S NVASTR=""
106 . S NVAMED=$P($P(NODE,U),";")
107 . S NVAMED=$E(NVAMED,$L(NVAMED))
108 . I NVAMED="N" S NVASTR="Non-VA "
109 . F S SIG=$O(TMP(DRUG,INDEX,"SIG",SIG)) Q:SIG="" D
110 ..I SIG=1 D ADDSTR(NVASTR_DRUG_" "_TMP(DRUG,INDEX,"SIG",SIG),$P(NODE,U,9),60)
111 ..I SIG'=1 D ADDSTR(TMP(DRUG,INDEX,"SIG",SIG))
112 . D ADDSTR(" # Refills: "_$P(NODE,U,5)," Quantity: "_$P(NODE,U,12),30)
113 . D ADDSTR("Issue Date: "_$$FMTE^XLFDT($P(NODE,U,15))," Provider: "_TMP(DRUG,INDEX,"P"),30)
114 ;
115 I EMPTY D
116 .D ADDSTR(""),ADDSTR("No Medications Found"),ADDSTR("")
117 K ^TMP("PS",$J)
118 Q "~@"_$NA(@TARGET)
119GETBOIL ;
120 N LINE,LINETXT
121 F LINE=1:1 S LINETXT=$P($T(BOILTXT+LINE),";;",2) Q:LINETXT="EOM" S TIUTMP(LINE)=LINETXT
122 Q
123BOILTXT ;
124 ;;This patient has been identified as a new patient waiting for care from
125 ;;the VA and is eligible for the transitional pharmacy program.
126 ;;
127 ;;Patient Name: |PATIENT NAME|
128 ;;SSN: |PATIENT SSN|
129 ;;Age: |PATIENT AGE|
130 ;;
131 ;;Primary Care Provider: |TIU TPBN PCP|
132 ;;
133 ;;Allergies/Adverse Reactions:
134 ;;|ALLERGIES/ADR|
135 ;;
136 ;;Rx(s):
137 ;;|TIU TPBN ACT OUT MEDS|
138 ;;
139 ;;Over-the-counter drugs or drugs not issued by VA but currently taking
140 ;;(Please List):
141 ;;
142 ;;
143 ;;
144 ;;Non-formulary Rx requested, not filled:
145 ;;
146 ;;
147 ;;
148 ;;Formulary Alternatives Recommended:
149 ;;
150 ;;
151 ;;
152 ;;Next appointment(s):
153 ;;|TIU TPBN FUTURE APPTS|
154 ;;
155 ;;
156 ;;Counseling:
157 ;;
158 ;;The patient and/or the patient's caregiver was offered counseling on
159 ;;drug, dosage, schedule, route of administration, storage, potential
160 ;;side effects, significant drug interactions, and the procedure for
161 ;;obtaining refill prescriptions.
162 ;;
163 ;;Counseling was [] Provided [] Refused
164 ;;EOM
165 Q
166CHKTITLE(FILE,NAME) ;
167 N DIC,X,Y
168 S DIC=FILE,DIC(0)="X"
169 S X=NAME
170 D ^DIC
171 Q +Y
172GETCLASS ;
173 N DIC,X,Y
174 S DIC("A")="Select the DOCUMENT CLASS where the new title will be installed: "
175 S DIC(0)="AEQ",DIC="^TIU(8925.1,",DIC("S")="I $P(^(0),U,4)=""DC"""
176 W ! D ^DIC
177 S TIUPRNT=+Y
178 Q
179MKOBJS() ;
180 N TIUHSO
181 S TIUHSO=$$CHKTITLE(142.5,"TIU TPBN FUTURE APPTS")
182 I $$MKOBJ("TIU TPBN ACT OUT MEDS","S X=$$AOPMEDS^TIUTPBN(DFN,""^TMP(""""TIUMED"""",$J)"")")<0 D Q -1
183 . W !!,"Installation Error: TIU Object creation failed.",!
184 I $$MKOBJ("TIU TPBN FUTURE APPTS","S X=$$TIU^GMTSOBJ(DFN,"_TIUHSO_")")<0 D Q -1
185 . W !!,"Installation Error: TIU Object creation failed.",!
186 I $$MKOBJ("TIU TPBN PCP","S X=$P($$OUTPTPR^SDUTL3(DFN,DT),U,2)")<0 D Q -1
187 . W !!,"Installation Error: TIU Object creation failed.",!
188 Q 1
189MKOBJ(NAME,METHOD) ;
190 N FDA,FDAIEN,MSG
191 S FDA(8925.1,"+1,",.01)=NAME
192 S FDA(8925.1,"+1,",.03)=NAME
193 S FDA(8925.1,"+1,",.04)="O"
194 S FDA(8925.1,"+1,",.06)=$$CHKTITLE(8930,"CLINICAL COORDINATOR")
195 S FDA(8925.1,"+1,",.07)=11
196 S FDA(8925.1,"+1,",9)=METHOD
197 S FDA(8925.1,"+1,",99)=$H
198 D UPDATE^DIE("","FDA","FDAIEN","MSG")
199 I $D(MSG) D Q -1
200 . W !!,"TIU Object "_NAME_" creation failed. The following error message was returned:",!!
201 . S MSG="" F S MSG=$O(MSG("DIERR",1,"TEXT",MSG)) Q:MSG="" W MSG("DIERR",1,"TEXT",MSG),!
202 W !!,"Creation of TIU Object "_NAME_" successful..." H 1
203 Q 1
204PRE ;
205 N DA,DIK,NAME,X,Y
206 F NAME="TIU TPBN ACT OUT MEDS","TIU TPBN FUTURE APPTS","TIU TPBN PCP" D
207 .S DA=0,DA=$O(^TIU(8925.1,"B",NAME,DA))
208 .S DIK="^TIU(8925.1,"
209 .I DA>0 D ^DIK
210 S NAME="INS^GMTSOBJ"
211 D @NAME
212 Q
Note: See TracBrowser for help on using the repository browser.