source: FOIAVistA/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAPET0.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 5.8 KB
Line 
1GMRAPET0 ;HIRMFO/RM-VERIFIED ALLERGY TASKS ;4/7/06 12:38
2 ;;4.0;Adverse Reaction Tracking;**6,17,21,20**;Mar 29, 1996;Build 1
3EN1(GMRADFN,GMRAPA,GMRACT,GMRAOUT) ;
4 ; ENTRY TO PERFORM ALL OF THE TASKS NECESSARY FOR
5 ; A PROGRESS NOTE TO BE ENTERED BY ART
6 ; INPUT:
7 ; GMRADFN = PATIENT IEN IN THE PATIENT FILE
8 ; GMRAPA = THE IEN IN THE PATIENT ALLERGY FILE
9 ; GMRACT = THE ACTION TO BE ENTERED FOR THIS REACTION
10 ; = "V" VERIFICATION OF A REACTION
11 ; = "S" SIGN OFF OF A REACTION
12 ; = "M" MEDWATCH FORM ENTERD
13 ; = "E" REACTION ENERED IN ERROR
14 ; OUTPUT:
15 ; GMRAOUT = REACTION ALL WAS PASSED
16 ; = 1 USER ABORT OR PN FAIL IN SOME WAY
17 ; = 0 PASSED
18 ;
19 ; VARABLE LIST
20 ; GMRACW = IS THE PROGRESS NOTE TITLE
21 ; GMRALOC = IS THE LOCATION OF THE PATIENT
22 ; GMRAHLOC = IS THE LOCATION IN FILE 44
23 ; GMRADFN = IS THE PATIENT IEN
24 ; GMRADT = IS THE DATE THE EVENT TOOK PLACE
25 ; GMRADUZ = IS THE USER WHO ENTERED THE INFORMATION
26 ; GMRAPN = IS THE IEN OF THE PROGRESS NOTE THAT WAS ENTERED
27 ;
28 ;CHECKING FOR A VALID TITLE
29 K ^TMP("TIUP",$J),GMRAPN
30 N GMRACW,GMRALOC,GMRAHLOC,GMRAXBOS ;21
31 S GMRAPN=-1,GMRAXBOS=$$BROKER^XWBLIB ;21 Got GUI?
32 I "VSME"'[GMRACT S GMRAOUT=1 D EXIT Q
33 ; The following lines of code which reference Progress Notes files and
34 ; routines will have to change when TIU replaces Progress Notes.
35 ;S GMRACW=0 F S GMRACW=$O(^GMR(121.2,"B","ADVERSE REACTION/ALLERGY",GMRACW)) Q:GMRACW<1 I $P($G(^GMR(121.1,$P($G(^GMR(121.2,GMRACW,0)),U,2),0)),U)="GENERAL NOTE" Q
36 ;-----ADDED BY VAUGHN 1/13/97 FOR TIU REPLACES LINE ABOVE----
37 S GMRACW=+$$WHATITLE^TIUPUTU("ADVERSE REACTION/ALLERGY")
38 ;------END---
39 ;-----CHANGED BY VAUGHN 1/13/97 FOR TIU---
40 I GMRACW<1!($T(NEW^TIUPNAPI)']"")!('$$CANPICK^TIULP(GMRACW)) S GMRAOUT=1 D EXIT Q ;21
41 ;I GMRACW<1!($T(PN^GMRPART)']"") S GMRAOUT=1 D EXIT Q
42 ;-----END----
43 D @GMRACT I GMRAOUT D EXIT Q ; THIS TELL'S THE PROGRAM WHERE TO GO
44 S GMRALOC=""
45 D VAD^GMRAUTL1(GMRADFN,"",.GMRALOC,"","","")
46 I GMRALOC'="" S GMRAHLOC=+$G(^DIC(42,GMRALOC,44))
47 ;E I '$G(GMRAXBOS) D ASK ;20
48 ; Call to Progress Notes
49 ; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
50 ;S:'GMRAOUT GMRAPN=+$$PN^GMRPART(GMRADFN,GMRADUZ,GMRADT,GMRACW,GMRAHLOC)
51 ;---REPLACED LINE ABOVE WITH LINE BELOW;1/13/97 VAUGHN---
52 I 'GMRAOUT D
53 .S GMRAPN=0 D NEW^TIUPNAPI(.GMRAPN,GMRADFN,GMRADUZ,GMRADT,GMRACW,$G(GMRAHLOC),$S($G(GMRAXBOS):0,1:1)) ;17,21 Allow editing if not in GUI
54 ;----------END-------
55 I GMRAPN=-1,'$G(GMRAXBOS) S GMRAOUT=1 W !,"No Progress Note was created." ;21
56 I GMRAPN=0,'$G(GMRAXBOS) W !,"Progress note has not been signed." ;21
57 D EXIT
58 Q
59EXIT ; Clean up of variables
60 K ^TMP("TIUP",$J),GMRAPN,GMRALOC,GMRAHLOC,GMRADUZ
61 Q
62ASK ; Simple file manager query for a location in file 44
63 N DIC
64 S X=""
65 S DIC=44,DIC(0)="AEQ",DIC("A")="Select a Hospital Location: ",DIC("S")="I ""CMW""[$P(^(0),U,3)" ;20
66 W !,"A progress note is being created because you "_$S(GMRACT="V":"verified",GMRACT="E":"inactivated",GMRACT="S":"activated",1:"entered a medwatch form for"),!,$P($G(^GMR(120.8,GMRAPA,0)),U,2),"." ;20
67 W !,"Enter a hospital location to be associated with this note." ;20
68 D ^DIC
69 I $D(DTOUT)!($D(DUOUT)) S GMRAOUT=1 Q
70 S GMRAHLOC=+Y
71 Q
72V ; Verified Reaction
73 N GMRAI ;21
74 S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0))
75 S GMRADT=$P(GMRAPA(0),U,17),GMRADUZ=$P(GMRAPA(0),U,18)
76 S:GMRADUZ="" GMRADUZ=DUZ ; Autoverified reaction being reverified
77 S ^TMP("TIUP",$J,1,0)="This patient has had an "_$S($P(GMRAPA(0),"^",14)="P":"adverse reaction reported for ",1:"allergy to ")_$P(GMRAPA(0),"^",2)
78 S ^TMP("TIUP",$J,2,0)="verified on "_$$FMTE^XLFDT(GMRADT,1)_"."
79 S GMRAI=2 D ADDCOM("V",.GMRAI) ;21
80 S ^TMP("TIUP",$J,0)=U_U_GMRAI_U_GMRAI_U_GMRADT_"^^^" ;21
81 Q
82S ; Signed Reaction
83 N GMRAI,GMRAREAC ;21
84 D NOW^%DTC
85 S GMRADT=%,GMRADUZ=DUZ
86 S GMRAREAC=0,GMRAI=3 F S GMRAREAC=$O(GMRAPA(GMRAREAC)) Q:GMRAREAC<1 S GMRAI=GMRAI+1,^TMP("TIUP",$J,GMRAI,0)=$P($G(^GMR(120.8,GMRAREAC,0)),U,2) S GMRAPA=GMRAREAC D ;21
87 .D ADDCOM("O",.GMRAI) ;21
88 .S GMRAI=GMRAI+1,^TMP("TIUP",$J,GMRAI,0)="" ;21
89 S ^TMP("TIUP",$J,1,0)="This patient has had the following reaction"_$S(GMRAI=3:" ",1:"s ")
90 S ^TMP("TIUP",$J,2,0)="signed-off on "_$$FMTE^XLFDT(GMRADT,1)_"."
91 S ^TMP("TIUP",$J,3,0)="" ;21
92 S ^TMP("TIUP",$J,0)=U_U_GMRAI_U_GMRAI_U_GMRADT_"^^^"
93 Q
94M ; MedWATCH data entered
95 N X
96 S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0))
97 D NOW^%DTC
98 S GMRADT=%,GMRADUZ=DUZ
99 S ^TMP("TIUP",$J,1,0)="This patient has had a MEDWatch report completed on "_$$FMTE^XLFDT(GMRADT,1)_" for"
100 S ^TMP("TIUP",$J,2,0)=$S($P(GMRAPA(0),"^",14)="P":"an adverse reaction to ",1:"allergy to ")_$P(GMRAPA(0),"^",2)_"."
101 S ^TMP("TIUP",$J,0)=U_U_"2"_U_"2"_U_GMRADT_"^^^"
102 Q
103E ; Reaction Entered in Error
104 N GMRAER,GMRAI ;21
105 S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0))
106 S GMRAER=$G(^GMR(120.8,GMRAPA,"ER")) I GMRAER="" S GMRAOUT=1 Q
107 S GMRADT=$P(GMRAER,U,2),GMRADUZ=$P(GMRAER,U,3)
108 S ^TMP("TIUP",$J,1,0)="The "_$S($P(GMRAPA(0),"^",14)="P":"adverse reaction ",1:"allergy ")_"to "_$P(GMRAPA(0),"^",2)_" was removed on "_$$FMTE^XLFDT($P(GMRADT,"."),2)_"." ;20
109 S ^TMP("TIUP",$J,2,0)="This reaction was either an erroneous entry or was found" ;20
110 S ^TMP("TIUP",$J,3,0)="to no longer be a true "_$S($P(GMRAPA(0),"^",14)="P":"adverse reaction",1:"allergy")_"." ;20
111 S GMRAI=3 D ADDCOM("E",.GMRAI) ;21,20
112 S ^TMP("TIUP",$J,0)=U_U_GMRAI_U_GMRAI_U_GMRADT_"^^^" ;21
113 Q
114 ;
115ADDCOM(TYPE,CNT) ;Add any comments to progress note - section added in patch 21
116 N SUB,ENTRY
117 S ENTRY=$O(^GMR(120.8,GMRAPA,26,"AVER",TYPE,0)) Q:'+ENTRY
118 S CNT=CNT+1,^TMP("TIUP",$J,CNT,0)="",CNT=CNT+1,^TMP("TIUP",$J,CNT,0)="Author's comments:"
119 S CNT=CNT+1,^TMP("TIUP",$J,CNT,0)=""
120 S SUB=0 F S SUB=$O(^GMR(120.8,GMRAPA,26,ENTRY,2,SUB)) Q:'+SUB S CNT=CNT+1,^TMP("TIUP",$J,CNT,0)=^GMR(120.8,GMRAPA,26,ENTRY,2,SUB,0)
121 Q
Note: See TracBrowser for help on using the repository browser.