source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRTSTOUT.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: 7.9 KB
Line 
1LRTSTOUT ;SLC/CJS-JAM TESTS OFF ACCESSIONS ;8/11/97
2 ;;5.2;LAB SERVICE;**100,121,153,202,221,337**;Sep 27, 1994;Build 2
3 ;Cancel tests - Test are no longer deleted, instead the status is changed to Not Performed.
4EN ;
5 D ^LRPARAM Q:$G(LREND)
6 I '$D(LRLABKY) W !?5,"You are not authorized to change test status.",!,$C(7) S LREND=1 Q
7 K LRXX,LRSCNXB W @IOF
8 F S (LREND,LRNOP)=0 D FIX D I $G(LREND) D END Q
9 . I $G(LREND) D END S LREND=1 Q
10 . K DIC D:'$G(LRNOP) CHG D END
11 Q
12FIX S (LREND,LRNOP)=0,LRNOW=$$NOW^XLFDT
13 W ! S LRACC=1 D LRACC Q:$G(LRNOP)
14 K LRACC,LRNATURE I $G(LRAN)<1 S LREND=1 Q
15 I '$P($G(^LRO(68,+$G(LRAA),1,+$G(LRAD),1,+$G(LRAN),0)),U,2) W !?5,"Accession has no Test ",! S LRNOP=1 Q
16 L +^LRO(68,LRAA,1,LRAD,1,LRAN):1 I '$T W !,"Someone else is working on this accession",! S LRNOP=1 Q
17 S LRX=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRACN=$P(^(.2),U),LRUID=$P(^(.3),U)
18 S LRDFN=+LRX,LRSN=+$P(LRX,U,5),LRODT=+$P(LRX,U,4)
19 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3)
20 D PT^LRX W !,PNM,?30,SSN
21 S LRIDT=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,5) L +^LR(LRDFN,LRSS,LRIDT):1 I '$T W !,"Someone else is working on this data." L -^LRO(68,LRAA,1,LRAD,1,LRAN) S LRNOP=1 Q
22 I '$G(^LR(LRDFN,LRSS,LRIDT,0)) W !?5," Can't find Lab Data for this accession",! D UNLOCK S LRNOP=1 Q
23 I LRODT,LRSN,$D(^LRO(69,LRODT,1,LRSN,0))#2 D
24 . N LRACN,LRAA,LRAD
25 . D SHOW^LROS
26 K DIR S DIR(0)="E" D ^DIR S:$E(X)=U LRNOP=1 Q:$G(LRNOP)
27FX1 ;
28 D SHOWTST
29 Q
30CHG K LRCTST,DIC W !
31 N LRIFN
32 S:'$D(DIC("A")) DIC("A")="Change which LABORATORY TEST: "
33 S DIC="^LRO(68,"_LRAA_",1,"_LRAD_",1,"_LRAN_",4,",DIC("S")="I '$L($P(^(0),U,5))",DIC(0)="AEMOQ"
34 F D ^DIC Q:Y<1 S LRCTST(+Y)=$P(^LAB(60,+Y,0),U),DIC("A")="Select another test: "
35 K DIC I '$O(LRCTST(0)) D Q
36 . L -^LR(LRDFN,LRSS,LRIDT) L -^LRO(68,LRAA,1,LRAD,1,LRAN)
37 . W !?5,"No Test Selected",!
38 I '$L(LRODT)&'$L(LRSN) W !,"NO CHANGE" D UNLOCK,END Q
39 K LRCCOM S LRCCOM="",LREND=0 I '$D(^LRO(69,LRODT,1,LRSN,0))#2 W !?5,"There is no Order for this Accession",! D UNLOCK,END Q
40 W @IOF,!!?5,"Change Accession : ",LRACN,?40,"UID: ",LRUID
41 S I=0 F S I=$O(LRCTST(I)) Q:I<1 W !?10,LRCTST(I)
42 D FX2 Q:$G(LREND)
43 S LRTSTS=0 F S LRTSTS=$O(LRCTST(LRTSTS)) Q:LRTSTS<1 D
44 . Q:'$D(^LAB(60,LRTSTS,0))#2 S LRTNM=$P(^(0),U)
45 . S LRORDTST=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRTSTS,0),U,9) D SET,CLNPENDG
46 . W:'$G(LREND) !?5,"[ "_LRTNM_" ] ",$S('$D(LRLABKY):" Marked Canceled by Floor",1:" Marked Not Performed"),!
47 S LREND=0 K LRCTST
48 Q
49SHOWTST ;
50 N LRI,LRN,DIR,LRY,LRIC,X
51 S DIR(0)="E"
52 D DEMO
53 S LRN=0,LRI=0 F S LRI=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI)) Q:LRI<1!($G(LRY)) D
54 . S LRIC=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI,0)),U,4,6) Q:'$D(^LAB(60,+LRI,0))#2 W !,?5,$P(^(0),U) S LRN=LRN+1 I LRIC D
55 . . W ?35," "_$S($L($P(LRIC,U,3)):$P(LRIC,U,3),1:"Completed")_" "_$$FMTE^XLFDT($P(LRIC,U,2),"5FMPZ")_" by "_$P(LRIC,U)
56 . I LRN>18 D ^DIR S:$E(X)=U LRY=1 Q:$G(LRY) D DEMO S LRN=0
57 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRODT=$P(X,U,4),LRSN=$P(X,U,5)
58 Q
59DEMO W !,PNM,?50,SSN
60 W !,"TESTS ON ACCESSION: ",LRACN,?40,"UID: ",LRUID
61 Q
62SET ;
63 S:'$G(LRNOW) LRNOW=$$NOW^XLFDT
64 S LRLLOC=$P(^LRO(69,LRODT,1,LRSN,0),U,7) D
65 . N II,X,LRI,LRSTATUS,OCXTRACE
66 . S:$G(LRDBUG) OCXTRACE=1
67 . S LRI=0 F S LRI=$O(^LRO(69,LRODT,1,LRSN,2,LRI)) Q:LRI<1 I $D(^(LRI,0))#2,LRTSTS=+^(0) S (LRSTATUS,II(LRTSTS))="" D K II
68 . . Q:$P(^LRO(69,LRODT,1,LRSN,2,LRI,0),U,11) S ORIFN=$P(^(0),U,7)
69 . . S X=1+$O(^LRO(69,LRODT,1,LRSN,2,LRI,1.1,"A"),-1),X(1)=$P($G(^(0)),U,4)
70 . . S ^LRO(69,LRODT,1,LRSN,2,LRI,1.1,X,0)=$P($G(LRNATURE),U,5)_": "_LRCCOM,X=X+1,X(1)=X(1)+1
71 . . S ^LRO(69,LRODT,1,LRSN,2,LRI,1.1,X,0)=$S($G(LRMERG):"*Merged:",'$D(LRLABKY):"*Cancel by Floor:",1:"*NP Action:")_$$FMTE^XLFDT(LRNOW,"5MZ")
72 . . S ^LRO(69,LRODT,1,LRSN,2,LRI,1.1,0)="^^"_X_"^"_X(1)_"^"_DT
73 . . I $G(ORIFN),$D(II) D NEW^LR7OB1(LRODT,LRSN,$S($G(LRMSTATI)=""!($G(LRMSTATI)=1):"OC",1:"SC"),$G(LRNATURE),.II,LRSTATUS)
74 . . I ORIFN,$$VER^LR7OU1<3 D DC^LRCENDE1
75 . . S $P(^LRO(69,LRODT,1,LRSN,2,LRI,0),"^",9)="CA",$P(^(0),U,10)="L",$P(^(0),U,11)=DUZ
76 . . S:$D(^LRO(69,LRODT,1,LRSN,"PCE")) ^LRO(69,"AE",DUZ,LRODT,LRSN,LRI)=""
77 K ORIFN,ORSTS
78 I $D(^LRO(68,+$G(LRAA),1,+$G(LRAD),1,+$G(LRAN),0))#2,$D(^(4,$G(LRTSTS),0))#2 S $P(^(0),U,4,6)=DUZ_U_LRNOW_U_$S($G(LRMERG):"*Merged",1:"*Not Performed") D
79 . S LROWDT=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,0)),U,3) I LROWDT,LROWDT'=LRAD D ROL Q
80 . S LROWDT=+$G(^LRO(68,LRAA,1,LRAD,1,LRAN,9)) I LROWDT D ROL
81 I $G(LRIDT),$L($G(LRSS)),$L(LRCCOM),$G(^LR(LRDFN,LRSS,LRIDT,0)) D
82 . D 63(LRDFN,LRSS,LRIDT,LRTNM,LRCCOM)
83 . D:'$D(^LRO(68,LRAA,1,LRAD,1,"AD",DT,LRAN)) XREF^LRVER3A
84 D EN^LA7ADL($P($G(^LRO(68,+$G(LRAA),1,+$G(LRAD),1,+$G(LRAN),.3)),"^")) ; Put in list to check for auto download.
85 Q
86ROL ;
87 Q:+$G(^LRO(68,LRAA,1,LROWDT,1,LRAN,0))'=LRDFN Q:'$D(^(4,LRTSTS,0))#2
88 S $P(^LRO(68,LRAA,1,LROWDT,1,LRAN,4,LRTSTS,0),U,4,6)=DUZ_U_LRNOW_U_"*Not performed"
89 Q
90LRACC K LRAN
91 S LREND=0,LREXMPT=1 D ^LRWU4 K LREXMPT
92 Q:'$G(LRAA)!('$G(LRAN))!('$D(^LRO(68,LRAA,0))#2)
93 S DA(2)=LRAA,DA(1)=LRAD,LRSS=$P(^LRO(68,LRAA,0),U,2)
94 I '$L(LRSS) S LRAN=0,LRNOP=1 W !?5,"No Subscript for this Accession Area ",!!
95 Q
96LREND S LREND=1 Q
97UNLOCK ;
98 L -(^LR($G(LRDFN),$G(LRSS),$G(LRIDT)),^LRO(68,$G(LRAA),1,$G(LRAD),1,$G(LRAN))) D END Q
99EXIT ;
100 K LRSCNX,LRNOECHO,LRACN,LRLABRV,LRNOW
101END ;
102 K LRCCOM0,LRCCOM1,LRCCOMX,LREND,LRI,LRL,LRNATURE,LRNOP,LRSCN,LRMSTATI,LRORDTST,LROWDT,LRPRAC,LRTSTS,LRUID
103 K Q9,LRXX,DIR,LRCOM,LRAGE,DI,LRCTST,LRACN,LRACN0,LRDOC,LRLL,LRNOW
104 K LROD0,LROD1,LROD3,LROOS,LROS,LROSD,LROT,LRROD,LRTT,X4
105 D KVA^VADPT,END^LRTSTJAM
106 Q
107FX2 ;
108 S LREND=0
109 I '$L($G(LRNATURE)) D DC^LROR6() I $G(LRNATURE)="-1" W !!,$C(7),"Nothing Changed",! S LREND=1 Q
110 S LRL=52 I '$D(LRLABKY) G FX3
111 K DIR S (LRCOM,LRCCOM1)="" W !
112 S DIR(0)="62.5,5",DIR("A")="Select NP comment Lab Description screen " S:$L($G(LRSCNXB)) DIR("B")=LRSCNXB
113 S DIR("?")="Select Lab Description file screen to be used to expand your NP reason."
114 S DIR("?",1)=" Press return to accept the default expansion screens."
115 S DIR("?",2)=" "
116 S DIR("?",3)="Select the Lab Description file expansion screen."
117 S DIR("?",4)="The default expansion screens are GENERAL, ORDER and LAB"
118 S DIR("?",5)="You may select addition lab description expansion screens"
119 S DIR("?",6)="Press return if you want to only use the default screens"
120 S DIR("?",7)=" "
121 K LRSCNXB,LRNOECHO
122 S:'$D(LRSCN) LRSCN="AKL"
123 D ^DIR I $E(X)=U S LREND=1 Q
124 I $E(X)="@" S LRSCN="AKL",LRSCNXB="" G FX2
125 I $L(X) S LRSCNXB=Y(0),LRSCN=LRSCN_Y
126FX3 K DIR W !
127 S DIR("A")=$S('$D(LRLABKY):"Reason for Cancel",1:"Not Perform Reason ") S:$L($G(LRXX)) DIR("B")=$G(LRXX)
128 S DIR(0)="FU^1:"_LRL_"^"
129 D ^DIR I $E(X)=U S LREND=1 Q
130 I '$L(X) W !,"You must enter Reason",! G FX2
131 I $D(LRLABKY) S LRXX=Y,Q9="1,"_LRL_","_LRSCN D COM^LRNUM
132 I '$D(X) G FX2
133 I $E(X,$L(X))=" " S X=$E(X,1,($L(X)-1))
134 S (LRCCOM,LRCCOMX)=X
135 I '$D(LRLABKY) W !,"("_LRCCOM_")"
136 K DIR S DIR(0)="Y",DIR("A")="Satisfactory Comment ",DIR("B")="Yes"
137 D ^DIR W ! K DIR
138 I Y'=1 G FX2
139 S LRCCOM=$E($S('$D(LRLABKY):"*Floor Cancel Reason:",1:"*NP Reason:")_LRCCOM,1,68)
140 Q
141 ;
14263(LRDFN,LRSS,LRIDT,LRTNM,LRCCOM) ;
143 N X,Y,D0,D1,DA,DR,DIC,DIE,LRCCOM0,LRNOECHO,DLAYGO
144 S DLAYGO=63,DIC(0)="SL"
145 S:'$G(LRNOW) LRNOW=$$NOW^XLFDT
146 S LRNOECHO=1
147 S LRCCOM0=$E("*"_LRTNM_$S($G(LRMERG):" Merged: ",'$D(LRLABKY):" Floor Canceled: ",1:" Not Performed: ")_$$FMTE^XLFDT(LRNOW,"5FMPZ")_" by "_DUZ,1,68)
148 S DA=LRIDT,DA(1)=LRDFN,DIE="^LR("_LRDFN_","""_LRSS_""","
149 S LRCCOM0=$TR(LRCCOM0,";","-") ; Strip ";" - FileMan uses ";" to parse DR string.
150 S DR=".99///^S X="_""""_LRCCOM0_"""" D ^DIE
151 Q:LRSS="MI"
152631 K D0,D1,DA,DR,DIC,DIE
153 S DIC(0)="SL"
154 S DA=LRIDT,DA(1)=LRDFN,DIE="^LR("_LRDFN_","""_LRSS_""",",DIC=DIE
155 S LRCCOM=$TR(LRCCOM,";","-") ; Strip ";" - FileMan uses ";" to parse DR string.
156 S LRCCOM=$TR(LRCCOM,"""","'") ; Change " to ' -- " causes FileMan error.
157 S DR=".99///^S X="_""""_LRCCOM_""""
158 D ^DIE
159 Q
160CLNPENDG ;Remove pending from Lab test when set to not performed
161 N LRIFN
162 S LRIFN=$P($G(^LAB(60,LRTSTS,.2)),U)
163 Q:LRIFN=""
164 S:$P($G(^LR(LRDFN,LRSS,LRIDT,LRIFN)),U)="pending" $P(^LR(LRDFN,LRSS,LRIDT,LRIFN),U)=""
165 Q
Note: See TracBrowser for help on using the repository browser.