source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRALAB1.m@ 975

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1GMRALAB1 ;HIRMFO/WAA-THIS PROGRAM WILL SELECT ALL LAB TEST FOR A PATIENT ;1/9/96 09:48
2 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
3EDIT ;EDIT EXISTING DATA
4 I '$O(^GMR(120.85,GMRAPA1,4,0)) W !,?3,"YOU CANNOT EDIT WHEN THERE IS NO DATA ON FILE.",$C(7) Q
5EDITLST ; DISPLAY TO EDIT FIELD
6 D LST^GMRALAB0
7EEDT K DA,DO,DIC,DIE,DLAYGO,DR
8 S DA(1)=GMRAPA1,DIC="^GMR(120.85,"_DA(1)_",4,",DIC(0)="AMQEZ" D ^DIC K DIC,DLAYGO
9 I $D(DUOUT)!($D(DTOUT)) S GMRAOUT=1 Q
10 I Y=-1 S GMRAOUT=1 Q
11 S DA(1)=GMRAPA1,DIE="^GMR(120.85,"_DA(1)_",4,",DA=+Y,DR=".01;1;2" D ^DIE
12 K GMRAX,DA,DIE,DR
13 Q
14ADD ;This is to allow the user to select a LAB TEST
15 D DISP^GMRALAB0 I GMRAOUT S GMRAOUT=GMRAOUT-1 Q:GMRAOUT
16 K % I '$D(^TMP($J,"GMRALAB")) D ADD2 Q:X="" G ADD
17ADDED W !,"Enter the number of the TX/Test to ADD or ""N"" for NEW: "
18 R GMRAX:DTIME S:'$T GMRAX="^^" I "^^"[GMRAX S GMRAOUT=$L(GMRAX) Q
19 I "??"[GMRAX D:$L(GMRAX)=2 Q:GMRAOUT W !,"ENTER THE NUMBER OF THE ENTRY YOU WANT OR ""N"" FOR A NEW TEST" G ADDED
20 .D DISP^GMRALAB0 I GMRAOUT S GMRAOUT=GMRAOUT-1 Q:GMRAOUT
21 .Q
22 I GMRAX="n" S GMRAX="N"
23 I GMRAX="N" D ADD2 Q:X="" G ADD
24 I '$$VALST^GMRALAB1(GMRAX,"L") W !,$C(7),"INVALID SELECTION PLEASE SELECT ONE OF THE TEST/TX LISTED OR ""N"" FOR A NEW TEST" G ADD
25 S GMRALST=0 F S GMRALST=$O(GMRALST(GMRALST)) Q:GMRALST<1 S GMRAX=GMRALST D Q:GMRAOUT
26 .S X=$E($P(^TMP($J,"GMRALAB","L",GMRAX),U,3),1,18)
27 .I $D(^GMR(120.85,GMRAPA1,4,"B",X)) D Q:GMRAOUT!(%-1) K %
28 ..W !,"You already have a ",X," test on file."
29 ..S %=2 F W !,"Do You still want to add this one" D YN^DICN S:%=-1 %=2,GMRAOUT=1 Q:% W !,"ENTER YES TO ADD THE TEST/TX OR NO TO SELECT ANOTHER"
30 ..Q
31 .K DD,DO
32 .I '$D(^GMR(120.85,GMRAPA1,4,0)) S ^(0)="^120.8504^^"
33 .S DA(1)=GMRAPA1,DIC="^GMR(120.85,"_GMRAPA1_",4,",DIC(0)="L",DLAYGO=120.85 D FILE^DICN K DLAYGO Q:(+Y<1)
34 .S GMRARSLT=$E($P($P(^TMP($J,"GMRALAB","L",GMRAX),U,4),"|"),1,78)_" "_$E($P(^TMP($J,"GMRALAB","L",GMRAX),U,6),1,10)
35 .I $P(^TMP($J,"GMRALAB","L",GMRAX),U,8)'="" S GMRARSLT=GMRARSLT_" H:"_$E($P(^TMP($J,"GMRALAB","L",GMRAX),U,8),1,45)_"/L:"_$E($P(^TMP($J,"GMRALAB","L",GMRAX),U,7),1,45)
36 .S:$P(^TMP($J,"GMRALAB","L",GMRAX),U,5)'="" GMRARSLT=$E($P(^TMP($J,"GMRALAB","L",GMRAX),U,5),1,2)_" "_GMRARSLT
37 .S DA=+Y,DIE=DIC,DR="1////"_GMRARSLT_";2///"
38 .S DR=DR_$S($P($P(^TMP($J,"GMRALAB","L",GMRAX),U)," ",2)'="":$P($P(^TMP($J,"GMRALAB","L",GMRAX),U)," ")_"@"_$P($P(^TMP($J,"GMRALAB","L",GMRAX),U)," ",2),1:$P($P(^TMP($J,"GMRALAB","L",GMRAX),U)," ")) K DIC,Y D ^DIE
39 .K DA,DIE,DR,GMRAX,GMRARSLT,DD,DO,%,X
40 .Q
41 Q
42ADD2 ;This is to allow the patient's lab test to be added.
43 S DA=GMRAPA1,DIE="^GMR(120.85,",DLAYGO=120.85,DR="4" D ^DIE
44 S:$D(Y) GMRAOUT=1
45 K DA,DIE,DR
46 Q
47DEL ;This entry point is to delete a lab entry from the Adverse Reaction file.
48 I '$D(^GMR(120.85,GMRAPA1,4,0)) W !,"THERE IS NO LAB DATA SELECTED FOR THIS PATIENT" Q
49 K DA,DO,DIC,DIE,DLAYGO,DR
50 S DA(1)=GMRAPA1,DIC="^GMR(120.85,"_DA(1)_",4,",DIC(0)="AMQEZ" D ^DIC
51 I $D(DUOUT)!($D(DTOUT)) S GMRAOUT=1 Q
52 I Y=-1 S GMRAOUT=1 Q
53 K DIC,DA,DO,DLAYGO
54 S DA(1)=GMRAPA1,DIK="^GMR(120.85,"_DA(1)_",4,",DA=+Y D ^DIK
55 K DIC,DIC,DA,DO,DLAYGO
56 Q
57LDATE(X) ;This function takes X and will return Y
58 ;in a format that will keep every thing lined up for prints
59 N Y
60 S Y=$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)
61 I $P(X,".",2)'="" S X=$E($P(X,".",2),1,4) S:$L(X)<4 X=X_$E("000",1,(4-$L(X))) S Y=Y_"@"_$E(X,1,2)_":"_$E(X,3,4)
62 Q Y
63VALST(LST,SUB) ; GIVEN LST, THIS FUNCTION RETURNS 1 IF LIST VALID, ELSE 0
64 N X,Y,Z,A
65 K GMRALST
66 S Z=1 F X=1:1:$L(LST,",") S Y=$P(LST,",",X) D Q:'Z
67 .I Y'?1N.N,Y'?1N.N1"-"1N.N S Z=0 Q
68 .I Y?1N.N S Y=Y_"-"_Y
69 .F A=$P(Y,"-"):1:$P(Y,"-",2) S:'$D(^TMP($J,"GMRALAB",SUB,A)) Z=0 Q:'Z S GMRALST(A)=""
70 .Q
71 K:'Z GMRALST
72 Q Z
Note: See TracBrowser for help on using the repository browser.