LRCYPCT ;AVAMC/REG - CYTOPATH %POS,NEG,SUSP, & UNSAT ;8/13/95 15:41 ;
;;5.2;LAB SERVICE;**72**;Sep 27, 1994
S LRDICS="CY" D ^LRAP G:'$D(Y) END S IOP="HOME" D ^%ZIS W @IOF,!,LRO(68)," (",LRABV,") Cytology Specimens:"
I $O(^LRO(69.2,LRAA,12,0)) W !,"Use morphology list " S %=1 D YN^LRU G:%<1 END I %=1 D M G:$D(LRA) TO
F X=80013,69760,"09460","09010" S Y=$O(^LAB(61.1,"C",X,0)) W !?25,$S(Y:"% "_$P(^LAB(61.1,Y,0),"^"),1:"No entry in Morphology file for SNOMED code: "_X) G:'Y OUT S LRA(Y)=$P(^(0),"^")
TO W ! K LRN,LRM I $O(^LRO(69.2,LRAA,11,0)) W !,"Use topography category list " S %=1 D YN^LRU G:%<1 END I %=1 D SET G:$D(LRN) DATE
W ! F B=1:1 D ASK Q:X[U!(X="")
DATE G:B<2 END W ! D B^LRU G:Y<0 END S LRSDT=LRSDT-.01,LRLDT=LRLDT+.99 W !!,"Include locations for each morphology " S %=2 D YN^LRU G:%<1 END S LRP=$S(%=1:1,1:0)
S ZTRTN="QUE^LRCYPCT" D BEG^LRUTL G:POP!($D(ZTSK)) END
QUE U IO K ^TMP($J) S LR=0 D L^LRU,S^LRU,XR^LRU,H S LR("F")=1
F X=0:0 S LRSDT=$O(^LR(LRXR,LRSDT)) Q:'LRSDT!(LRSDT>LRLDT) D LRDFN
D P K ^TMP($J) D END^LRUTL,END Q
LRDFN F LRDFN=0:0 S LRDFN=$O(^LR(LRXR,LRSDT,LRDFN)) Q:'LRDFN D I
Q
I F LRI=0:0 S LRI=$O(^LR(LRXR,LRSDT,LRDFN,LRI)) Q:'LRI I $P($P($G(^LR(LRDFN,LRSS,LRI,0)),U,6)," ")=LRABV D T
Q
T F O=0:0 S O=$O(^LR(LRDFN,LRSS,LRI,2,O)) Q:'O S T=^(O,0) D TG
Q
TG Q:'$D(^LAB(61,T,0)) S T=$P(^(0),"^",2) S A=0 F E=0:0 S A=$O(LRN(A)) Q:A="" I A=$E(T,1,LRM(A)) D G Q
Q
G S:'$D(^TMP($J,A)) ^(A)=0 S X=^(A),^(A)=X+1 S LRL=$P(^LR(LRDFN,LRSS,LRI,0),"^",8) S:LRL="" LRL="??"
F M=0:0 S M=$O(^LR(LRDFN,LRSS,LRI,2,O,2,M)) Q:'M S M(1)=^(M,0) I $D(LRA(M(1))) S:'$D(^TMP($J,A,M(1))) ^(M(1))=0 S X=^(M(1)),^(M(1))=X+1 S:'$D(^TMP($J,A,M(1),LRL)) ^(LRL)=0 S X=^(LRL),^(LRL)=X+1 Q
Q
P S LRN=0 F A=0:0 S LRN=$O(^TMP($J,LRN)) Q:LRN=""!(LR("Q")) S S=^(LRN),LR=LR+S D:$Y>(IOSL-6) H Q:LR("Q") W !!,LRN(LRN,0)," (",LRN,"): ",?55,$J(S,5) D S
Q:LR("Q") D:$Y>(IOSL-10) H Q:LR("Q") W !!,"Total specimens found: ",?55,$J(LR,5) F B=0:0 S B=$O(LRA(B)) Q:'B!(LR("Q")) W !?3,$P(LRA(B),"^") S X=$P(LRA(B),"^",2) Q:'LR W ?36,$J(X,5)," (",$J(X/LR*100,4,1),"%)"
Q
S F B=0:0 S B=$O(^TMP($J,LRN,B)) Q:'B!(LR("Q")) S T=^(B) D:$Y>(IOSL-6) H1 Q:LR("Q") W !?3,$P(LRA(B),"^"),?36,$J(T,5)," (",$J(T/S*100,4,1),"%)" S $P(LRA(B),"^",2)=$P(LRA(B),"^",2)+T D:LRP L
Q
L S LRL=0 F C=0:0 S LRL=$O(^TMP($J,LRN,B,LRL)) Q:LRL=""!(LR("Q")) S L=^(LRL) D:$Y>(IOSL-6) H2 Q:LR("Q") W !?5,$E(LRL,1,23),?30,$J(L,3)
Q
ASK K A("B") W !,"Select 1 or more characters of SNOMED TOPOGRAPHY code (Choice# ",B,"): " R X:DTIME Q:X=""!(X[U)
D CK G:$D(A("B")) ASK S LRN(X)="",LRM(X)=$L(X)
C R !,"ENTER IDENTIFYING COMMENT: ",X(1):DTIME I X(1)=""!(X[U) K LRN(X),LRM(X) W $C(7),!!,"You must enter an identifying comment <ENTRY DELETED>",! G ASK
I X(1)'?1ANP.ANP!($L(X(1))<2)!($L(X(1))>30)!(X(1)["?") W $C(7),!!,"Enter free text 2-30 characters",!," (Ex. for 2 you may want to enter Respiratory System)",! G C
S LRN(X,0)=X(1) Q
;
H I $D(LR("F")),IOST?1"C".E D M^LRU Q:LR("Q")
D F^LRU W !,LRO(68)," Counts From ",LRSTR," To ",LRLST,! W:LRP ?5,"Location",?25,"Location Count" W ?55,"Count",!,LR("%") Q
H1 D H Q:LR("Q") W !,LRN(LRN,0),?55,$J(S,5) Q
H2 D H1 Q:LR("Q") W !?3,$P(LRA(B),U),?36,$J(T,5)," (",$J(T/S*100,4,1),"%)" Q
OUT W !!,$C(7),?12,"Please have appropriate person enter missing SNOMED code",!?24,"in the MORPHOLOGY FIELD file (#61.1)" D V^LRU Q
CK I X'?1UN.UN!($L(X)>6) S A("B")=1 G SHW
S I=0 F I(1)=1:1:$L(X) I "0123456789ABCDEFXY"'[$E(X,I(1)) S A("B")=1 Q
SHW Q:'$D(A("B")) W $C(7),!!,"Enter up to 6 characters.",!,"Entry can only contain digits, letters 'X' and 'Y'.",!,"One character entered -> most general All 6 characters -> most specific",! Q
;
SET S X=0 F B=0:0 S X=$O(^LRO(69.2,LRAA,11,"B",X)) Q:X="" F C=0:0 S C=$O(^LRO(69.2,LRAA,11,"B",X,C)) Q:'C S E=$P(^LRO(69.2,LRAA,11,C,0),"^",2),LRN(X)="",LRM(X)=$L(X),LRN(X,0)=E W !,X," ",E
S:$D(LRN) B=2 Q
M F B=0:0 S B=$O(^LRO(69.2,LRAA,12,B)) Q:'B S LRA(B)=$P(^LAB(61.1,B,0),"^") W !,LRA(B)
Q
;
END D V^LRU Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRCYPCT 4026 printed Nov 22, 2024@17:23:54 Page 2
LRCYPCT ;AVAMC/REG - CYTOPATH %POS,NEG,SUSP, & UNSAT ;8/13/95 15:41 ;
+1 ;;5.2;LAB SERVICE;**72**;Sep 27, 1994
+2 SET LRDICS="CY"
DO ^LRAP
if '$DATA(Y)
GOTO END
SET IOP="HOME"
DO ^%ZIS
WRITE @IOF,!,LRO(68)," (",LRABV,") Cytology Specimens:"
+3 IF $ORDER(^LRO(69.2,LRAA,12,0))
WRITE !,"Use morphology list "
SET %=1
DO YN^LRU
if %<1
GOTO END
IF %=1
DO M
if $DATA(LRA)
GOTO TO
+4 FOR X=80013,69760,"09460","09010"
SET Y=$ORDER(^LAB(61.1,"C",X,0))
WRITE !?25,$SELECT(Y:"% "_$PIECE(^LAB(61.1,Y,0),"^"),1:"No entry in Morphology file for SNOMED code: "_X)
if 'Y
GOTO OUT
SET LRA(Y)=$PIECE(^(0),"^")
TO WRITE !
KILL LRN,LRM
IF $ORDER(^LRO(69.2,LRAA,11,0))
WRITE !,"Use topography category list "
SET %=1
DO YN^LRU
if %<1
GOTO END
IF %=1
DO SET
if $DATA(LRN)
GOTO DATE
+1 WRITE !
FOR B=1:1
DO ASK
if X[U!(X="")
QUIT
DATE if B<2
GOTO END
WRITE !
DO B^LRU
if Y<0
GOTO END
SET LRSDT=LRSDT-.01
SET LRLDT=LRLDT+.99
WRITE !!,"Include locations for each morphology "
SET %=2
DO YN^LRU
if %<1
GOTO END
SET LRP=$SELECT(%=1:1,1:0)
+1 SET ZTRTN="QUE^LRCYPCT"
DO BEG^LRUTL
if POP!($DATA(ZTSK))
GOTO END
QUE USE IO
KILL ^TMP($JOB)
SET LR=0
DO L^LRU
DO S^LRU
DO XR^LRU
DO H
SET LR("F")=1
+1 FOR X=0:0
SET LRSDT=$ORDER(^LR(LRXR,LRSDT))
if 'LRSDT!(LRSDT>LRLDT)
QUIT
DO LRDFN
+2 DO P
KILL ^TMP($JOB)
DO END^LRUTL
DO END
QUIT
LRDFN FOR LRDFN=0:0
SET LRDFN=$ORDER(^LR(LRXR,LRSDT,LRDFN))
if 'LRDFN
QUIT
DO I
+1 QUIT
I FOR LRI=0:0
SET LRI=$ORDER(^LR(LRXR,LRSDT,LRDFN,LRI))
if 'LRI
QUIT
IF $PIECE($PIECE($GET(^LR(LRDFN,LRSS,LRI,0)),U,6)," ")=LRABV
DO T
+1 QUIT
T FOR O=0:0
SET O=$ORDER(^LR(LRDFN,LRSS,LRI,2,O))
if 'O
QUIT
SET T=^(O,0)
DO TG
+1 QUIT
TG if '$DATA(^LAB(61,T,0))
QUIT
SET T=$PIECE(^(0),"^",2)
SET A=0
FOR E=0:0
SET A=$ORDER(LRN(A))
if A=""
QUIT
IF A=$EXTRACT(T,1,LRM(A))
DO G
QUIT
+1 QUIT
G if '$DATA(^TMP($JOB,A))
SET ^(A)=0
SET X=^(A)
SET ^(A)=X+1
SET LRL=$PIECE(^LR(LRDFN,LRSS,LRI,0),"^",8)
if LRL=""
SET LRL="??"
+1 FOR M=0:0
SET M=$ORDER(^LR(LRDFN,LRSS,LRI,2,O,2,M))
if 'M
QUIT
SET M(1)=^(M,0)
IF $DATA(LRA(M(1)))
if '$DATA(^TMP($JOB,A,M(1)))
SET ^(M(1))=0
SET X=^(M(1))
SET ^(M(1))=X+1
if '$DATA(^TMP($JOB,A,M(1),LRL))
SET ^(LRL)=0
SET X=^(LRL)
SET ^(LRL)=X+1
QUIT
+2 QUIT
P SET LRN=0
FOR A=0:0
SET LRN=$ORDER(^TMP($JOB,LRN))
if LRN=""!(LR("Q"))
QUIT
SET S=^(LRN)
SET LR=LR+S
if $Y>(IOSL-6)
DO H
if LR("Q")
QUIT
WRITE !!,LRN(LRN,0)," (",LRN,"): ",?55,$JUSTIFY(S,5)
DO S
+1 if LR("Q")
QUIT
if $Y>(IOSL-10)
DO H
if LR("Q")
QUIT
WRITE !!,"Total specimens found: ",?55,$JUSTIFY(LR,5)
FOR B=0:0
SET B=$ORDER(LRA(B))
if 'B!(LR("Q"))
QUIT
WRITE !?3,$PIECE(LRA(B),"^")
SET X=$PIECE(LRA(B),"^",2)
if 'LR
QUIT
WRITE ?36,$JUSTIFY(X,5)," (",$JUSTIFY(X/LR*100,4,1),"%)"
+2 QUIT
S FOR B=0:0
SET B=$ORDER(^TMP($JOB,LRN,B))
if 'B!(LR("Q"))
QUIT
SET T=^(B)
if $Y>(IOSL-6)
DO H1
if LR("Q")
QUIT
WRITE !?3,$PIECE(LRA(B),"^"),?36,$JUSTIFY(T,5)," (",$JUSTIFY(T/S*100,4,1),"%)"
SET $PIECE(LRA(B),"^",2)=$PIECE(LRA(B),"^",2)+T
if LRP
DO L
+1 QUIT
L SET LRL=0
FOR C=0:0
SET LRL=$ORDER(^TMP($JOB,LRN,B,LRL))
if LRL=""!(LR("Q"))
QUIT
SET L=^(LRL)
if $Y>(IOSL-6)
DO H2
if LR("Q")
QUIT
WRITE !?5,$EXTRACT(LRL,1,23),?30,$JUSTIFY(L,3)
+1 QUIT
ASK KILL A("B")
WRITE !,"Select 1 or more characters of SNOMED TOPOGRAPHY code (Choice# ",B,"): "
READ X:DTIME
if X=""!(X[U)
QUIT
+1 DO CK
if $DATA(A("B"))
GOTO ASK
SET LRN(X)=""
SET LRM(X)=$LENGTH(X)
C READ !,"ENTER IDENTIFYING COMMENT: ",X(1):DTIME
IF X(1)=""!(X[U)
KILL LRN(X),LRM(X)
WRITE $CHAR(7),!!,"You must enter an identifying comment <ENTRY DELETED>",!
GOTO ASK
+1 IF X(1)'?1ANP.ANP!($LENGTH(X(1))<2)!($LENGTH(X(1))>30)!(X(1)["?")
WRITE $CHAR(7),!!,"Enter free text 2-30 characters",!," (Ex. for 2 you may want to enter Respiratory System)",!
GOTO C
+2 SET LRN(X,0)=X(1)
QUIT
+3 ;
H IF $DATA(LR("F"))
IF IOST?1"C".E
DO M^LRU
if LR("Q")
QUIT
+1 DO F^LRU
WRITE !,LRO(68)," Counts From ",LRSTR," To ",LRLST,!
if LRP
WRITE ?5,"Location",?25,"Location Count"
WRITE ?55,"Count",!,LR("%")
QUIT
H1 DO H
if LR("Q")
QUIT
WRITE !,LRN(LRN,0),?55,$JUSTIFY(S,5)
QUIT
H2 DO H1
if LR("Q")
QUIT
WRITE !?3,$PIECE(LRA(B),U),?36,$JUSTIFY(T,5)," (",$JUSTIFY(T/S*100,4,1),"%)"
QUIT
OUT WRITE !!,$CHAR(7),?12,"Please have appropriate person enter missing SNOMED code",!?24,"in the MORPHOLOGY FIELD file (#61.1)"
DO V^LRU
QUIT
CK IF X'?1UN.UN!($LENGTH(X)>6)
SET A("B")=1
GOTO SHW
+1 SET I=0
FOR I(1)=1:1:$LENGTH(X)
IF "0123456789ABCDEFXY"'[$EXTRACT(X,I(1))
SET A("B")=1
QUIT
SHW if '$DATA(A("B"))
QUIT
WRITE $CHAR(7),!!,"Enter up to 6 characters.",!,"Entry can only contain digits, letters 'X' and 'Y'.",!,"One character entered -> most general All 6 characters -> most specific",!
QUIT
+1 ;
SET SET X=0
FOR B=0:0
SET X=$ORDER(^LRO(69.2,LRAA,11,"B",X))
if X=""
QUIT
FOR C=0:0
SET C=$ORDER(^LRO(69.2,LRAA,11,"B",X,C))
if 'C
QUIT
SET E=$PIECE(^LRO(69.2,LRAA,11,C,0),"^",2)
SET LRN(X)=""
SET LRM(X)=$LENGTH(X)
SET LRN(X,0)=E
WRITE !,X," ",E
+1 if $DATA(LRN)
SET B=2
QUIT
M FOR B=0:0
SET B=$ORDER(^LRO(69.2,LRAA,12,B))
if 'B
QUIT
SET LRA(B)=$PIECE(^LAB(61.1,B,0),"^")
WRITE !,LRA(B)
+1 QUIT
+2 ;
END DO V^LRU
QUIT