source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRALAB0.m@ 1716

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1GMRALAB0 ;HIRMFO/WAA-THIS PROGRAM WILL SELECT ALL LAB TEST FOR A PATIENT ;1/9/96 09:47
2 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
3EN1 ;THIS PROGRAM IS TO FIND AND PRINT ALL LAB TEST FOR A PATIENT
4 G:GMRAOUT EXIT
5 W @IOF N DIE,DA,GMRAXXX,GMRAX,GMRAGHC
6 S GMRALRCV=$S($T(GMTSLRCE^GMTSLRCE)']"":0,1:+$$VERSION^XPDUTL("GMTS"))
7 S GMRALRCG=$S(+GMRALRCV>2:"^TMP(",1:"^UTILITY(")
8 K @(GMRALRCG_"""LRC"",$J)"),^TMP($J,"GMRALAB")
9 S GMRADT=$P(^GMR(120.85,GMRAPA1,0),U)
10 D ^GMRADSP7 Q:'GMRAPA
11SELECT W ! D LST
12 ;SELECT ACTION
13 S GMRAOUT=0
14 K DIR S DIR(0)="SMOBA^A:ADD;D:DELETE;E:EDIT",DIR("A")="Select Action (A/D/E): "
15 S DIR("?",1)="ENTER A TO ADD NEW LAB DATA, D TO DELETE LAB DATA OR "
16 S DIR("?")="E TO EDIT LAB DATA ON FILE FOR THIS PATIENT"
17 D ^DIR K DIR I "^^"[Y S GMRAOUT=$L(Y) G EXIT
18 S GMRASEL=Y K DIR,GMRADFL
19 I GMRASEL="A" S GMRALOOK=0 W ! D ADD^GMRALAB1 K GMRALOOK G:GMRAOUT&('$D(GMRADFL)) EXIT G SELECT
20 I GMRASEL="D" W ! D DEL^GMRALAB1 G:GMRAOUT EXIT G SELECT
21 I GMRASEL="E" W ! D EDIT^GMRALAB1 G:GMRAOUT EXIT G SELECT
22 G SELECT
23DISP ;DISPLAY ALL THE LABTEST FOR THIS PATIENT
24 K @(GMRALRCG_"""LRC"",$J)"),^TMP($J,"GMRALAB") S GMRACT=1,GMRACH=1
25 S DFN=+GMRAPA(0)
26 D DT Q:GMRAOUT
27 S GMRALOOK=1
28 I $D(GMRABGDT),+GMRALRCV S SEX=$P(GMRASEX,U),GMTS1=9999999-GMRAENDT,GMTS2=9999999-GMRABGDT,MAX=9999999,LRDFN=$P($G(^DPT(DFN,"LR")),U) D:LRDFN XTRCT^GMTSLRCE
29 K GMTS1,GMTS2,MAX,SEX,LRDFN
30 S GMRACT=0,GMRAX=0 F S GMRAX=$O(@(GMRALRCG_"""LRC"",$J,GMRAX)")) Q:GMRAX<1 D
31 .S GMRAY=0 F S GMRAY=$O(@(GMRALRCG_"""LRC"",$J,GMRAX,GMRAY)")) Q:GMRAY'>0 D
32 ..S GMRACT=GMRACT+1,^TMP($J,"GMRALAB","L",GMRACT)=@(GMRALRCG_"""LRC"",$J,GMRAX,GMRAY)")
33 ..Q
34 .Q
35DISP2 S Z=0 W @IOF,!,"LAB TEST:",!,?3,"Collection DT",?19,"Test Name",?39,"Specimen",?52,"Results",?68,"Hi/Low",!!
36 I '$D(^TMP($J,"GMRALAB","L")) W ?5,$S('GMRALRCV:"THE LAB EXTRACT IS NOT PRESENT, COULD NOT GET LAB TEST DATA",1:"THERE IS NO LAB DATA FOR THIS PATIENT FOR THIS DATE RANGE.") K GMRABGDT,GMRAENDT Q
37 F GMRACH=GMRACH:1 Q:'$D(^TMP($J,"GMRALAB","L",GMRACH)) D Q:GMRAOUT
38 .I $Y+3>IOSL D Q:GMRAOUT
39 ..S DIR(0)="E" D ^DIR I 'Y S GMRAOUT=1 S:$D(DIROUT) GMRAOUT=2
40 ..K Y,DIR,DIRUT,DIROUT,DUOUT,DTOUT
41 ..I GMRAOUT Q
42 ..W @IOF,!,"LAB TEST:",!,?3,"Collection DT",?19,"Test Name",?39,"Specimen",?52,"Results",?68,"Hi/Low",!!
43 ..Q
44 .W $J(GMRACH,Z),?4,$P(^TMP($J,"GMRALAB","L",GMRACH),U)
45 .W ?20,$E($P(^TMP($J,"GMRALAB","L",GMRACH),U,3),1,18)
46 .W ?39,$E($P(^TMP($J,"GMRALAB","L",GMRACH),U,2),1,10)
47 .I $P(^TMP($J,"GMRALAB","L",GMRACH),U,5)'="" W ?50,$P(^TMP($J,"GMRALAB","L",GMRACH),U,5)
48 .W ?53,$E($P($P(^TMP($J,"GMRALAB","L",GMRACH),U,4),"|"),1,10)," ",$P(^TMP($J,"GMRALAB","L",GMRACH),U,6)
49 .W ?68 I $P(^TMP($J,"GMRALAB","L",GMRACH),U,8)'="" W $P(^TMP($J,"GMRALAB","L",GMRACH),U,8),"/",$P(^TMP($J,"GMRALAB","L",GMRACH),U,7)
50 .W !
51 .Q
52 K X,GMRACH,GMRACT,GMRAX,GMRAY,GMRAZ,X,Y
53 Q
54LST ;This entry point is to display patient lab test adverse reaction.
55 I '$O(^GMR(120.85,GMRAPA1,4,0)) W !,"THIS PATIENT HAS NO LAB TEST ON FILE FOR THIS ADVERSE REACTION REPORT" K GMRABGDT,GMRAENDT Q
56 W @IOF,!,"This patient has the following Test selected: "
57 W !,"TEST/TX",?33,"RESULTS",?64,"DRAW DATE/TIME"
58 S GMRAXX=1,GMRAX=0 F S GMRAX=$O(^GMR(120.85,GMRAPA1,4,GMRAX)) Q:GMRAX<1 D Q:GMRAOUT
59 .I $Y+3>IOSL D Q:GMRAOUT
60 ..S DIR(0)="E" D ^DIR I 'Y S GMRAOUT=1 S:$D(DIROUT) GMRAOUT=2
61 ..K Y,DIR,DIRUT,DIROUT,DUOUT,DTOUT
62 ..I GMRAOUT Q
63 ..W @IOF,!,"TEST/TX",?33,"RESULTS",?64,"DRAW DATE/TIME"
64 ..Q
65 .W !,GMRAXX_") ",?5,$E($P(^GMR(120.85,GMRAPA1,4,GMRAX,0),U),1,26)
66 .W ?33,$E($P(^GMR(120.85,GMRAPA1,4,GMRAX,0),U,2),1,30)
67 .W ?64 W:$P(^GMR(120.85,GMRAPA1,4,GMRAX,0),U,3)>1 $$LDATE^GMRALAB1($P(^GMR(120.85,GMRAPA1,4,GMRAX,0),U,3))
68 .S GMRAXX=GMRAXX+1
69 .Q
70 K GMRAXX,GMRAX
71 Q
72DT ;SELECT LOOKUP DATE RANGE
73 I GMRALOOK Q
74 I '$D(GMRABGDT) S (GMRABGDT,GMRAENDT)=""
75 W ! K GMRADFL
76 S X1=$S(GMRABGDT'="":+GMRABGDT,1:GMRADT),X2=0 D C^%DTC S Y=X D D^DIQ S %DT("A")="View Tx/Test from: ",%DT("B")=Y,%DT="AETP" D ^%DT K %DT I X="^" S GMRAOUT=2,GMRADFL=1 G DTEX
77 S GMRABGDT=+Y D D^DIQ S $P(GMRABGDT,U,2)=Y
78 S X1=$S(GMRAENDT'="":+GMRAENDT,1:GMRADT),X2=0 D C^%DTC S Y=X D D^DIQ S %DT("A")="To: ",%DT("B")=Y,%DT="AETP",%DT(0)=+GMRABGDT D ^%DT K %DT I X="^" S GMRAOUT=2,GMRADFL=1 G DTEX
79 S GMRAENDT=+Y S:'$P(GMRAENDT,".",2) GMRAENDT=GMRAENDT+.24 D D^DIQ S $P(GMRAENDT,U,2)=Y
80DTEX K X2,X1,Y,X,%DT
81 Q
82EXIT ;EXIT THE PROGRAM
83 K GMRADT,GMRABGDT,GMRAENDT,GMRASEL,DIR,X,Y,^TMP($J,"GMRALAB"),@(GMRALRCG_"""LRC"",$J)"),GMRALOOK,GMRADFL
84 Q
Note: See TracBrowser for help on using the repository browser.