source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRADEL.m@ 1375

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1GMRADEL ;HIRMFO/WAA-PATIENT DELETE REACTION ;11/14/06 13:18
2 ;;4.0;Adverse Reaction Tracking;**36**;Mar 29, 1996;Build 9
3 ;
4 ; Is this data Correct question:
5 ;Single Reaction:
6 ; user |
7 ; reponse | action taken
8 ;-------------------------------------------------------------
9 ; Yes | Data is Sign off
10 ; |
11 ; No | User is asked if they wish to delete the entry
12 ; ^,timeout|---------------------------------------------------
13 ; | response | action taken
14 ; |---------------------------------------------------
15 ; | yes | the entry is deleted
16 ; | ^,timeout|
17 ; | |
18 ; | no | the entry is not deletes and a alert trigered
19 ; |---------------------------------------------------
20 ;
21 ;Multiple Reaction:
22 ; user |
23 ; reponse | action taken
24 ;-------------------------------------------------------------
25 ; select | Selected reaction will be signed
26 ;reactions |
27 ; |
28 ;reactions | all User is asked if they wish to delete the entry
29 ;NOT |---------------------------------------------------
30 ;selected | response | action taken
31 ; OR |---------------------------------------------------
32 ;^,timeout | yes | the entries is deleted
33 ; | ^,timeout|
34 ; | |
35 ; | no | the entries is not deletes and a alert trigered
36 ; |---------------------------------------------------
37 ;
38 ;Note: Only one entry point will be needed.....
39DEL ; Main Entry point
40 N DIR,GMRACNT,GMRAPCT
41 D DELPRT ; No reaction to be deleted
42 S DIR(0)="YA",DIR("B")="YES"
43 S DIR("?")="PLEASE ENTER 'Y' TO DELETE THE CAUSATIVE AGENT"_$S(GMRACNT>1:"S",1:"")_" 'N' NOT TO DELETE THE DATA"
44 S DIR("??")="^D PRINT^GMRASIGN",DIR("A")="Do you wish to delete "_$S(GMRACNT>1:"these",1:"this")_" Causative Agent"_$S(GMRACNT>1:"s",1:"")_"? " D ^DIR
45 I $D(DIRUT) S Y=1,GMRAOUT=1
46 S GMRAPCT=Y
47 Q:'GMRAPCT ; User did not want to delete the entry(s)
48 ; User want to delete the data
49 D DELETE
50 Q
51DELETE ; Deleting the data
52 N X
53 ;W !,"One moment please deleting data..."
54 S X=0 F S X=$O(^TMP($J,"GMRASF",X)) Q:X<1 D
55 .N GMRAPA
56 .S GMRAPA=$O(^TMP($J,"GMRASF",X,0)) ; find 120.8 data
57 .S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)=""
58 .I '$G(^TMP($J,"GMRASF",X,GMRAPA)) D EIE Q ;36 Existing records are marked entered in error rather than being deleted
59 .N GMRAPA1
60 .S GMRAPA1=0
61 .; find 120.85 data
62 .F S GMRAPA1=$O(^GMR(120.85,"C",GMRAPA,GMRAPA1)) Q:GMRAPA1<1 D
63 ..S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0))
64 ..I GMRAPA1(0)="" K ^GMR(120.85,"C",GMRAPA,GMRAPA1) Q
65 ..D ; delete 120.85 data
66 ...N DIK,DA
67 ...S DIK="^GMR(120.85,",DA=GMRAPA1 D ^DIK
68 ...D UNLOCK^GMRAUTL(120.85,GMRAPA1) ; Unlocking the data 120.85
69 ...;W "." ;36
70 ...Q
71 ..Q
72 .D ; delete 120.8 data
73 ..N DIK,DA
74 ..S DIK="^GMR(120.8,",DA=GMRAPA D ^DIK
75 ..D UNLOCK^GMRAUTL(120.8,GMRAPA) ; Unlocking the data 120.8
76 ..;W "." ;36
77 ..Q
78 .S X=$O(^TMP($J,"GMRASF","B",GMRAPA,0))
79 .K ^TMP($J,"GMRASF",X,GMRAPA),^TMP($J,"GMRASF","B",GMRAPA,X)
80 .Q
81 Q
82DELPRT ; List all the reaction not signed
83 N X,GMRAPA
84 W @IOF
85 S (GMRACNT,X)=0
86 F S X=$O(^TMP($J,"GMRASF",X)) Q:X<1 D
87 .S GMRAPA=$O(^TMP($J,"GMRASF",X,0))
88 .S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)=""
89 .W !,$P(GMRAPA(0),U,2)
90 .S GMRACNT=GMRACNT+1
91 .Q
92 Q
93 ;
94EIE ;Section added in patch 36, will mark existing records entered in error
95 N GMRADFN,ALDATA,SUB
96 S GMRADFN=$P(GMRAPA(0),U)
97 S ALDATA("GMRAERRDT")=$$NOW^XLFDT,ALDATA("GMRAERRBY")=$G(DUZ,.5)
98 D EIE^GMRAGUI1(GMRAPA,GMRADFN,"ALDATA")
99 S SUB=$O(^TMP($J,"GMRASF","B",GMRAPA,0))
100 K ^TMP($J,"GMRASF",SUB,GMRAPA),^TMP($J,"GMRASF","B",GMRAPA,SUB) ;Delete entry as it's been taken care of
101 Q
Note: See TracBrowser for help on using the repository browser.