source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRASIG1.m@ 701

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1GMRASIG1 ;HIRMFO/WAA-A/AR PATIENT SIGN OFF PART2 ;9/22/06 10:49
2 ;;4.0;Adverse Reaction Tracking;**2,17,21,36**;Mar 29, 1996;Build 9
3PRINT ;Print out data to be signed off on
4 N DIR,X,Y
5 S GMRAPA=""
6 I GMRASIGN W @IOF
7 W !,"ADVERSE REACTION",!,"----------------" ;21
8 S (GMRAI,GMRACNT)=0
9 F S GMRACNT=$O(^TMP($J,"GMRASF",GMRACNT)) Q:GMRACNT<1 S GMRAPA=$O(^TMP($J,"GMRASF",GMRACNT,0)) Q:GMRAPA<0 D Q:GMRAOUT I $Y>(IOSL-4) D PAGE Q:GMRAOUT
10 .W ! W:GMRACNTT>1 GMRACNT,")" ;21
11 .S GMRAG=^GMR(120.8,GMRAPA,0),GMRADRG=$S($P(GMRAG,U,20)="D":1,1:0)
12 .W " ",$P(GMRAG,U,2),! ;21
13 .W !,?11,"Obs/Hist:",?21,$S($P(GMRAG,U,6)="o":"OBSERVED",$P(GMRAG,U,6)="h":"HISTORICAL",1:"") I $P(GMRAG,U,6)="o" W !,?12,"Obs d/t: ",$$FMTE^XLFDT($P(^GMR(120.85,$O(^GMR(120.85,"C",GMRAPA,0)),0),U)) ;21
14 .K GMRAHEAD
15 .K GMRAREC I $D(^GMR(120.8,GMRAPA,10,0)) D
16 ..S GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
17 ..S GMRAREC=0 F S GMRAREC=$O(^GMR(120.8,GMRAPA,10,GMRAREC)) Q:GMRAREC'>0 D ;21
18 ...S X=$G(^GMR(120.8,GMRAPA,10,GMRAREC,0)),GMRAREC(GMRAREC)=$S($P(X,U)'=GMRAOTH:$P($G(^GMRD(120.83,+$P(X,U),0)),U),1:$P(X,U,2)) ;21
19 ...I $P(X,U,4)>0 S $P(GMRAREC(GMRAREC),U,2)=$$FMTE^XLFDT($P(X,U,4),2) ;21
20 ...Q ;21
21 ..Q
22 .I $D(GMRAREC)=11 S GMRAREC=$O(GMRAREC("")) W !,?5,"Signs/Symptoms: ",?21,$P(GMRAREC(GMRAREC),U) W:$P(GMRAREC(GMRAREC),U,2)'="" " ("_$P(GMRAREC(GMRAREC),U,2)_")" ;21
23 .;W ?65,$S($P(GMRAG,U,6)="o":"OBSERVED",$P(GMRAG,U,6)="h":"HISTORICAL",1:"")
24 .I $G(GMRAREC)>0 F S GMRAREC=$O(GMRAREC(GMRAREC)) Q:GMRAREC<1 W !,?21,$P(GMRAREC(GMRAREC),U) W:$P(GMRAREC(GMRAREC),U,2)'="" " ("_$P(GMRAREC(GMRAREC),U,2)_")" I $Y>(IOSL-4) D PAGE Q:GMRAOUT ;21
25 .Q:GMRAOUT D:$Y>(IOSL-4) PAGE Q:GMRAOUT W !
26 .D OUTPUT^GMRAPEM1 Q:GMRAOUT
27 .Q
28 Q:GMRACNTT'>1
29 Q:'GMRASIGN
30 W (GMRACNTT+1),") All of the above",! ;17
31 W (GMRACNTT+2),") None of the above",! ;17
32 Q
33PAGE ;PAGE
34 N DIR
35 D ENDPG^GMRADSP3 Q:GMRAOUT
36 W @IOF,!
37 Q
38PNOTE ; Generate a Progress Note for a patient
39 Q:$G(GMRAUSER,0)
40 N GMRAOUT S GMRAOUT=0
41 I $D(GMRASLL) D
42 .N GMRAFLL,X
43 .S X=0 F S X=$O(GMRASLL(X)) Q:X<1 D
44 ..I GMRASLL(X) Q
45 ..I $P($G(^GMR(120.8,X,0)),U,6)'="o" Q
46 ..S GMRAFLL(X)=""
47 ..Q
48 .Q:'$D(GMRAFLL)
49 .D EN1^GMRAPET0(DFN,.GMRAFLL,"S",.GMRAOUT)
50 .Q
51 Q
52ENCNT ; Count how many entries where selected and set up Sort order
53 N SUB ;36
54 S (GMRACNTT,X)=0 K ^TMP($J,"GMRARE") ; Resort the entries
55 F S X=$O(^TMP($J,"GMRASF","B",X)) Q:X<1 D
56 .S GMRACNTT=GMRACNTT+1
57 .S SUB=$O(^TMP($J,"GMRASF","B",X,0)) ;36
58 .S ^TMP($J,"GMRARE",GMRACNTT,X)=+$G(^TMP($J,"GMRASF","B",X,SUB)) ;36
59 .S ^TMP($J,"GMRARE","B",X,GMRACNTT)=+$G(^TMP($J,"GMRASF","B",X,SUB)) ;36
60 .Q
61 K ^TMP($J,"GMRASF")
62 M ^TMP($J,"GMRASF")=^TMP($J,"GMRARE")
63 K ^TMP($J,"GMRARE")
64 Q
65YNSO ;Select sign off for a patient
66 W @IOF,!,"Causative Agent Data edited this Session:"
67 K X D PRINT ; Redisplay the reactions
68 K DIR S DIR(0)="L^1:"_(GMRACNTT+2),GMRALL=GMRACNTT+1,GMRANON=GMRACNTT+2 ;17
69 S DIR(0)=DIR(0)_"^I X[""."" W !,""DO NOT USE DECIMAL VALUES."",$C(7) K X Q"
70 S DIR("A")="Select the Correct data "
71 S DIR("?")="^D PRINT^GMRASIG1"
72 D ^DIR K DIR
73 I $D(DTOUT)!($D(DUOUT)) S Y=GMRANON_","
74 I Y=(GMRALL_",") D ALLSNG^GMRASIGN ; User select all the reaction
75 I Y=(GMRANON_",") S Y="" ; user select not of the reactions
76 I $F(Y,","_GMRALL_",") W !,"INVALID SELECTION: You can only select ",GMRACNT+1,") All by itself." G YNSO
77 I $F(Y,","_GMRANON_",") W !,"INVALID SELECTION: You can only select ",GMRACNT+2,") None by itself." G YNSO
78 Q
Note: See TracBrowser for help on using the repository browser.