source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAUSM.m@ 724

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

initial load of WorldVistAEHR

File size: 3.2 KB
RevLine 
[613]1LRAUSM ;AVAMC/REG - AUTOPSY SNOMED SEARCH ;8/14/95 09:53
2 ;;5.2;LAB SERVICE;**72,253**;Sep 27, 1994
3 S IOP="HOME",LR("S")=$P(^LRO(69.2,LRAA,0),U,8) D ^%ZIS W @IOF,?20,LRAA(1)," search by ",S(7)," code"
4 S (LR,LR(1),LR(2),LR(3))=0
5TP K A("B") W !!,"TOPOGRAPHY (Organ/Tissue)",!?5,"Select 1 or more characters of the code:",!?5 R "For all sites type 'ALL' : ",X:DTIME Q:X=""!(X[U) I X["ALL" S S(2)="ALL"
6 E D CK G:$D(A("B")) TP S S(2)=X,S(1)=$L(X)
7 K LRN,LRM S (LRO,LRN)="" W !!,S(7) I LRSN=61.5 D POS^LRAPSM Q:'$D(LRO)
8 W !?5,"For all diagnoses type 'ALL'" F B=1:1 D ASK Q:X[U!(X="")!(LRN="ALL")
9 Q:B<2&(LRN="") S:LRN=""&(B=2) LRN=$O(LRN(0)) W ! D B^LRU Q:Y<0 S LRSDT=LRSDT-.01,LRLDT=LRLDT+.99
10 S ZTRTN="QUE^LRAUSM" D BEG^LRUTL Q:POP!($D(ZTSK))
11QUE U IO K ^TMP($J) D L^LRU,S^LRU,XR^LRU S ^TMP($J,0)=S(2)_U_LRN_U_"AUTOPSY"_U_S(7)
12 F X=0:0 S LRSDT=$O(^LR(LRXR,LRSDT)) Q:'LRSDT!(LRSDT>LRLDT) D LRDFN
13 D ^LRAPSM1,END^LRUTL Q
14Y I $E(X,1,Y(1))=Y(2) S I=1 Q
15Y1 S I=1 F I(1)=1:1:Y(1) S I(2)=$E(Y(2),I(1)) I I(2)'="*",I(2)'=$E(X,I(1)) S I=0 Q
16 Q
17LRDFN S:'$D(LR("S")) LR("S")=$P(^LRO(69.2,LRAA,0),U,8) F LRDFN=0:0 S LRDFN=$O(^LR(LRXR,LRSDT,LRDFN)) Q:'LRDFN I $P($P($G(^LR(LRDFN,"AU")),U,6)," ")=LRABV S LR(2)=LR(2)+1,LR(4)=^("AU") D T
18 Q
19T S LRAC=$P(LR(4),"^",6),LRAN=+$P(LRAC," ",3),LRYR=$E(LR(4),1,3)
20 Q:'$D(^LR(LRDFN,"AY",0)) S T=0 F LR(20)=0:1 S T=$O(^LR(LRDFN,"AY",T)) Q:'T S LR(7)=+^(T,0) D TG
21 S LR=LR+LR(20) Q ;# organ/tissues
22TG Q:'$D(^LAB(61,LR(7),0)) S LR(11)=^(0),LR(5)=$P(LR(11),"^"),LR(11)=$P(LR(11),"^",2) I S(2)'="ALL",$E(LR(11),1,S(1))'=S(2) Q:S(2)'["*" S Y(1)=S(1),X=LR(11),Y(2)=S(2) D Y1 Q:'I
23 S LR(1)=LR(1)+1 D M Q ;Tot of organ/tissues searched for
24M F M=0:0 S M=$O(^LR(LRDFN,"AY",T,V,M)) Q:'M S X=^(M,0),LR(8)=+X,LRM=$P(X,"^",2) D @($S(LRSN'=61.2:"MX",1:"E"))
25 Q
26E F E=0:0 S E=$O(^LR(LRDFN,"AY",T,V,M,1,E)) Q:'E S LR(8)=+^(E,0) D MX
27 Q
28MX Q:'$D(^LAB(LRSN,LR(8),0)) S W=^(0) I $D(LRO),LRO]"",LRO'=LRM Q
29 I LRN="ALL" S:'$D(^TMP($J,LRYR,LRAN,LR(7),0)) ^(0)=LR(5) S W(2)=$P(W,"^",2) S:W(2)="" W(2)="?????" S ^(W(2))=$P(W,"^") G PRT
30 S X=$P(W,"^",2),Y=-1 F Z=1:1 S Y=$O(LRN(Y)) Q:Y="" S Y(1)=LRM(Y),Y(2)=LRN(Y) D Y I I S:'$D(^TMP($J,LRYR,LRAN,LR(7),0)) ^(0)=LR(5) S ^(Y)=$P(W,"^")
31 Q:'$D(^TMP($J,LRYR,LRAN))
32PRT S LRPF=^DIC($P(^LR(LRDFN,0),"^",2),0,"GL"),LRFLN=+$P(@(LRPF_"0)"),"^",2),DFN=$P(^LR(LRDFN,0),"^",3),LRDPF=$P(^(0),U,2) Q:'$D(@(LRPF_DFN_",0)"))
33 S LRPPT=@(LRPF_DFN_",0)"),LRP=$P(LRPPT,"^"),SSN=$P(LRPPT,"^",9)
34 S SEX=$P(LRPPT,"^",2),DOB=$P(LRPPT,"^",3),LRYR=$E($P(LR(4),"^"),1,3)
35 D SSN^LRU
36 S LRAC=$P(LR(4),"^",6),LRAN=+$P(LRAC," ",3),X1=$P(LR(4),"^"),X2=DOB D ^%DTC S AGE=X\365.25
37 S:AGE<1 AGE="<1"
38 S ^TMP($J,LRYR,LRAN)=LRAC_"^"_AGE_"^"_SEX_"^"_LRP_"^"_SSN(1)_"^"_+$E($P(LR(4),"^"),4,5)_"/"_+$E($P(LR(4),"^"),6,7)_"^"_LRFLN,^TMP($J,"B",LRP,LRYR,LRAN)=""
39 Q
40CK ;from LRAPC, LRAPSM
41 I X'?1PUN.PUN!($L(X)>7) S A("B")=1 G SHW
42 S I=0 F I(1)=1:1:$L(X) I "0123456789*ABCDEFXY"'[$E(X,I(1)) S A("B")=1 Q
43SHW Q:'$D(A("B")) W $C(7),!!,"Enter up to 7 characters.",!,"Entry can only contain digits, letters ABCDEFXY or '*' (for wild cards).",!,"One character entered -> most general All 7 characters -> most specific",! Q
44ASK K A("B") W !,"Choice #",$J(B,2),": Select 1 or more characters of the code: " R X:DTIME Q:X=""!(X[U) I X["ALL" S LRN="ALL" Q
45 D CK G:$D(A("B")) ASK S LRN(X)=X,LRM(X)=$L(X) Q
Note: See TracBrowser for help on using the repository browser.