source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRPXAPPU.m@ 1270

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

initial load of WorldVistAEHR

File size: 3.5 KB
RevLine 
[613]1LRPXAPPU ;SLC/STAFF - Test Lab APIs Utilities ;1/29/04 14:35
2 ;;5.2;LAB SERVICE;**295**;Sep 27, 1994
3 ;
4 ; This routine is used along with LRPXAPP for testing Lab APIs.
5 ;
6DISPLAY ; from LRPXAPP
7 ; displays results stored in a TMP global
8 N NUM,NUM1
9 W ! S NUM=""
10 F S NUM=$O(^TMP("LRPXAPP",$J,NUM)) Q:NUM="" D
11 . I $D(^TMP("LRPXAPP",$J,NUM))#2 W !,^(NUM) Q
12 . S NUM1=""
13 . F S NUM1=$O(^TMP("LRPXAPP",$J,NUM,NUM1)) Q:NUM1="" W !,NUM,",",NUM1
14 K ^TMP("LRPXAPP",$J)
15 Q
16 ;
17GETTYPE(TYPE,ERR) ; from LRPXAPP
18 ; asks for type of data (C, M, A), returned as TYPE
19 N DIR,DIRUT,DTOUT,X,Y K DIR
20 S ERR=0,TYPE=""
21 S DIR(0)="SAO^C:CHEMISTRY;M:MICROBIOLOGY;A:ANATOMIC PATHOLOGY"
22 S DIR("A")="Type of data -- C M A : "
23 S DIR("B")="C"
24 D ^DIR K DIR
25 I Y[U!$D(DTOUT) S ERR=1 Q
26 S TYPE=Y
27 W !
28 Q
29 ;
30GETPT(DFN,ERR) ; from LRPXAPP
31 ; asks for a patient, returns DFN
32 N DIC,X,Y K DIC,Y
33 S ERR=0
34 S DIC=2,DIC(0)="AEMOQZ"
35 D ^DIC I Y<1 S ERR=-1
36 S DFN=+Y
37 W !
38 Q
39 ;
40GETCOND(COND,TYPE,ERR) ; from LRPXAPI6,LRPXAPP
41 ; asks for a conditional expression, returned as COND
42 N DIR,DIRUT,DTOUT,X,Y K DIR
43 S TYPE=$G(TYPE,"C")
44 S ERR=0,COND=""
45 S DIR(0)="FAO^^I '$$CONDOK^LRPXAPIU(X,TYPE) K X"
46 S DIR("A")="Condition: "
47 D ^DIR K DIR
48 I Y[U!$D(DTOUT) S ERR=1 Q
49 S COND=Y
50 W !
51 Q
52 ;
53GETDATE(FROM,TO,ERR) ; from LRPXAPP
54 ; asks for a date range
55 ; FROM return as oldest date selection, TO as most recent
56 N DIR,DIRUT,DTOUT,X,Y K DIR
57 S (FROM,TO,ERR)=0
58 S DIR(0)="DAO^2900101:DT:EX"
59 S DIR("A")="From: "
60 D ^DIR K DIR
61 I Y[U!$D(DTOUT) S ERR=1 Q
62 I '$L(Y) S (FROM,TO)="" Q
63 S FROM=Y
64 ;
65 N DIR,X,Y K DIR
66 S DIR(0)="DAO^2900101:DT:EX"
67 S DIR("A")="To: "
68 D ^DIR K DIR
69 I $D(DIRUT) S FROM=0,ERR=-1 Q
70 S TO=Y D DATES^LRPXAPIU(.FROM,.TO)
71 W !
72 Q
73 ;
74GETTEST(TEST,TYPE,ERR) ; from LRPXAPP
75 ; asks for a lab test, returned as TEST
76 N DIC,X,Y K DIC
77 S ERR=0
78 S DIC=60,DIC(0)="AEMOQ"
79 S TYPE=$G(TYPE,"C") D
80 . I TYPE="C" S DIC("S")="I $P(^(0),U,4)=""CH"""
81 . I TYPE="M" S DIC("S")="I $P(^(0),U,4)=""MI"""
82 . I TYPE="A" S DIC("S")="I ""CYEMSPAU""[$P(^(0),U,4),$L($P(^(0),U,4))"
83 D ^DIC I Y<1 S ERR=-1
84 S TEST=+Y
85 W !
86 Q
87 ;
88GETAP(CODE,ERR) ; from LRPXAPP
89 ; asks for an AP item, returned as CODE
90 N FILE,DIC,DIR,DIRUT,DTOUT,X,Y K DIC,DIR
91 S ERR=0,CODE=""
92 S DIR(0)="SA^S:SPEC;T:TEST;O:ORGAN;D:DISEASE;M:MORPH;E:ETIOLOGY;F:FUNC;P:PROC;I:ICD"
93 S DIR("A")="Type of code -- S T O D M E F P I: "
94 D ^DIR K DIR
95 I Y[U!$D(DTOUT) S ERR=1 Q
96 S FILE=Y
97 I FILE="S" D Q ; specimen is free text
98 . N DIR,DIRUT,DTOUT,X,Y K DIR
99 . S DIR(0)="FAO^^"
100 . S DIR("A")="Specimen (free text): "
101 . D ^DIR K DIR
102 . I Y[U!$D(DTOUT) S ERR=1 Q
103 . S CODE="A;S;1."_$$UP^XLFSTR(Y)
104 D I Y<1!$D(DTOUT) S ERR=1 Q
105 . S DIC(0)="AEMOQ"
106 . I FILE="T" D GETTEST(.Y,"A",.ERR) Q
107 . I FILE="O" S DIC=61 D ^DIC Q
108 . I FILE="D" S DIC=61.4 D ^DIC Q
109 . I FILE="M" S DIC=61.1 D ^DIC Q
110 . I FILE="E" S DIC=61.2 D ^DIC Q
111 . I FILE="F" S DIC=61.3 D ^DIC Q
112 . I FILE="P" S DIC=61.5 D ^DIC Q
113 . I FILE="I" S DIC=80 D ^DIC Q
114 S CODE="A;"_FILE_";"_+Y
115 W !
116 Q
117 ;
118GETMICRO(CODE,ERR) ; from LRPXAPP
119 ; asks for a Micro item, returned as CODE
120 N FILE,DIC,DIR,DIRUT,DTOUT,X,Y K DIC,DIR
121 S ERR=0,CODE=""
122 S DIR(0)="SA^S:SPEC;T:TEST;O:ORGANISM;A:ANTIMICROBIAL;M:MYCOBACTERIA DRUG"
123 S DIR("A")="Type of code -- S T O A M : "
124 D ^DIR K DIR
125 I Y[U!$D(DTOUT) S ERR=1 Q
126 S FILE=Y
127 S DIC(0)="AEMOQ"
128 D I Y<1!$D(DTOUT) S ERR=1 Q
129 . I FILE="T" D GETTEST(.Y,"M",.ERR) Q
130 . I FILE="S" S DIC=61 D ^DIC Q
131 . I FILE="O" S DIC=61.2 D ^DIC Q
132 . I FILE="A" S DIC=62.06 D ^DIC Q
133 . I FILE="M" D Q
134 .. S DIC="^DD(63.39," D ^DIC ; dbia 999
135 .. I '$$TBDN^LRPXAPIU(+Y) S Y=-1 Q
136 S CODE="M;"_FILE_";"_+Y
137 W !
138 Q
Note: See TracBrowser for help on using the repository browser.