SROESNR ;BIR/ADM - NURSE INTRAOP REPORT E-SIG UTILITY ; [ 02/20/02 6:57 AM ]
;;3.0;Surgery;**100,184**;24 Jun 93;Build 35
;
;** NOTICE: This routine is part of an implementation of a nationally
;** controlled procedure. Local modifications to this routine
;** are prohibited.
;
Q
IN N SRS S SRS=1 D GET
Q
EX N SRS S SRS=2 D GET,COMP
I $D(^TMP("SRNRAD1",$J,SRTN))!$D(^TMP("SRNRAD2",$J,SRTN)) D ^SROESNR2
Q
GET K ^TMP("SRNRAD"_SRS,$J,SRTN) D VIEW^SROESNR0,MULT
Q
MULT ; get data from multiples
N SRK
F SRK=130.23,130.28,130.36,130.24,130.065,130.31,130.028,130.16,130.02,130.32,130.01,130.33,130.08,130.04,130.11,130.013,130.18,130.0647,130.0664 D MULT^SROESNR1
S SRK=130.06 D MULT^SROESNR3
Q
COMP ; compare before and after view
N SRFLD,SRCHNG,SRE,SRE1,SRE2,SRS,SRS1,SROTH,SRLN,SRMULT,X
S SRFLD="" F S SRFLD=$O(^TMP("SRNRAD1",$J,SRTN,130,SRFLD)) Q:SRFLD="" S SRCHNG=0 D
.I $P(SRFLD,"-",2)[";W" D Q
..F SRS=1,2 Q:SRCHNG S SRLN=0,SROTH=$S(SRS=1:2,1:1) F S SRLN=$O(^TMP("SRNRAD"_SRS,$J,SRTN,130,SRFLD,SRLN)) Q:'SRLN D Q:SRCHNG
...I ^TMP("SRNRAD"_SRS,$J,SRTN,130,SRFLD,SRLN)'=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,130,SRFLD,SRLN)) S SRCHNG=1
..I 'SRCHNG F SRS=1,2 K ^TMP("SRNRAD"_SRS,$J,SRTN,130,SRFLD)
.I ^TMP("SRNRAD1",$J,SRTN,130,SRFLD)'=$G(^TMP("SRNRAD2",$J,SRTN,130,SRFLD)) S SRCHNG=1
.I 'SRCHNG F SRS=1,2 K ^TMP("SRNRAD"_SRS,$J,SRTN,130,SRFLD)
CMULT ; process multiples
F SRS=1,2 K ^TMP("SRNRMULT"_SRS,$J,SRTN)
F SRS=1,2 S SRMULT="A" F S SRMULT=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT)) Q:SRMULT="" S SROTH=$S(SRS=1:2,1:1) D PASS1
F SRS=1,2 S SRMULT="A" F S SRMULT=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT)) Q:SRMULT="" S SROTH=$S(SRS=1:2,1:1) D PASS2
F SRS=1,2 S SRMULT="A" F S SRMULT=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT)) Q:SRMULT="" S SROTH=$S(SRS=1:2,1:1) D PASS3
F SRS=1,2 S SRMULT="A" F S SRMULT=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT)) Q:SRMULT="" S SROTH=$S(SRS=1:2,1:1) D PASS4
Q
PASS1 ; delete nodes for unchanged fields except for .01 fields
S SRE=0 F S SRE=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE)) Q:'SRE S SRE1="" F S SRE1=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1)) Q:SRE1="" D
.S SRFLD="" F S SRFLD=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)) Q:SRFLD="" S SRCHNG=0 D
..S Y=$P(SRFLD,"-",3) I $P(Y,",",2)=.01 Q
..I $P(SRFLD,"-",3)[";W" D Q
...F SRS1=1,2 Q:SRCHNG S SRLN=0,SROTH=$S(SRS1=1:2,1:1) F S SRLN=$O(^TMP("SRNRAD"_SRS1,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)) Q:'SRLN D
....I ^TMP("SRNRAD"_SRS1,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)'=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)) S SRCHNG=1
...I 'SRCHNG F SRS1=1,2 K ^TMP("SRNRAD"_SRS1,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)
..S SROTH=$S(SRS=1:2,1:1) I ^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)'=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)) S SRCHNG=1
..I 'SRCHNG F SRS1=1,2 K ^TMP("SRNRAD"_SRS1,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)
Q
PASS2 ; delete .01 nodes of sub-multiples if no changes underneath - before or after
N SRNXT1,SRNXT2,SRY1,SRY2
S SRE=0 F S SRE=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE)) Q:'SRE S SRE1=0 F S SRE1=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1)) Q:SRE1="" D
.S SRFLD="" F S SRFLD=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)) Q:SRFLD="" D
..I ^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)'=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)) Q
..S SRNXT1=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD))
..S SRNXT2=$O(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD))
..I SRNXT1="",SRNXT2="" K ^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD),^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD) Q
..S SRY1=$P(SRNXT1,"-",3),SRY2=$P(SRNXT2,"-",3) I $P(SRY1,",",2)=.01,$P(SRY2,",",2)=.01 K ^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD),^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)
Q
PASS3 ; delete .01 nodes for top level multiples if no changes underneath
S SRE=0 F S SRE=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE)) Q:'SRE S SRFLD="" F S SRFLD=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,0,SRFLD)) Q:SRFLD="" D
.S Y=$P(SRFLD,"-",3) I $P(Y,",",2)'=.01 Q
.I ^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,0,SRFLD)'=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,0,SRFLD)) Q
.I $O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,0,SRFLD))="",$O(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,0,SRFLD))="" D
..I $O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,0))'="",$O(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,0))'="" Q
..K ^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,0,SRFLD),^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,0,SRFLD)
Q
PASS4 ; set up list of changed fields for display in addendum
S SRE="" F S SRE=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE)) Q:'SRE S SRE1="" F S SRE1=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1)) Q:SRE1="" S SRFLD="" F S SRFLD=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)) Q:SRFLD="" D
.I $P(SRFLD,"-",3)[";W" D Q
..S SRLN=0 F S SRLN=$O(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)) Q:'SRLN D
...S ^TMP("SRNRMULT"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)=$G(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
...S ^TMP("SRNRMULT"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
.S ^TMP("SRNRMULT"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)=$G(^TMP("SRNRAD"_SRS,$J,SRTN,SRMULT,SRE,SRE1,SRFLD))
.S ^TMP("SRNRMULT"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD)=$G(^TMP("SRNRAD"_SROTH,$J,SRTN,SRMULT,SRE,SRE1,SRFLD))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROESNR 5467 printed Oct 16, 2024@18:44:11 Page 2
SROESNR ;BIR/ADM - NURSE INTRAOP REPORT E-SIG UTILITY ; [ 02/20/02 6:57 AM ]
+1 ;;3.0;Surgery;**100,184**;24 Jun 93;Build 35
+2 ;
+3 ;** NOTICE: This routine is part of an implementation of a nationally
+4 ;** controlled procedure. Local modifications to this routine
+5 ;** are prohibited.
+6 ;
+7 QUIT
IN NEW SRS
SET SRS=1
DO GET
+1 QUIT
EX NEW SRS
SET SRS=2
DO GET
DO COMP
+1 IF $DATA(^TMP("SRNRAD1",$JOB,SRTN))!$DATA(^TMP("SRNRAD2",$JOB,SRTN))
DO ^SROESNR2
+2 QUIT
GET KILL ^TMP("SRNRAD"_SRS,$JOB,SRTN)
DO VIEW^SROESNR0
DO MULT
+1 QUIT
MULT ; get data from multiples
+1 NEW SRK
+2 FOR SRK=130.23,130.28,130.36,130.24,130.065,130.31,130.028,130.16,130.02,130.32,130.01,130.33,130.08,130.04,130.11,130.013,130.18,130.0647,130.0664
DO MULT^SROESNR1
+3 SET SRK=130.06
DO MULT^SROESNR3
+4 QUIT
COMP ; compare before and after view
+1 NEW SRFLD,SRCHNG,SRE,SRE1,SRE2,SRS,SRS1,SROTH,SRLN,SRMULT,X
+2 SET SRFLD=""
FOR
SET SRFLD=$ORDER(^TMP("SRNRAD1",$JOB,SRTN,130,SRFLD))
if SRFLD=""
QUIT
SET SRCHNG=0
Begin DoDot:1
+3 IF $PIECE(SRFLD,"-",2)[";W"
Begin DoDot:2
+4 FOR SRS=1,2
if SRCHNG
QUIT
SET SRLN=0
SET SROTH=$SELECT(SRS=1:2,1:1)
FOR
SET SRLN=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,130,SRFLD,SRLN))
if 'SRLN
QUIT
Begin DoDot:3
+5 IF ^TMP("SRNRAD"_SRS,$JOB,SRTN,130,SRFLD,SRLN)'=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,130,SRFLD,SRLN))
SET SRCHNG=1
End DoDot:3
if SRCHNG
QUIT
+6 IF 'SRCHNG
FOR SRS=1,2
KILL ^TMP("SRNRAD"_SRS,$JOB,SRTN,130,SRFLD)
End DoDot:2
QUIT
+7 IF ^TMP("SRNRAD1",$JOB,SRTN,130,SRFLD)'=$GET(^TMP("SRNRAD2",$JOB,SRTN,130,SRFLD))
SET SRCHNG=1
+8 IF 'SRCHNG
FOR SRS=1,2
KILL ^TMP("SRNRAD"_SRS,$JOB,SRTN,130,SRFLD)
End DoDot:1
CMULT ; process multiples
+1 FOR SRS=1,2
KILL ^TMP("SRNRMULT"_SRS,$JOB,SRTN)
+2 FOR SRS=1,2
SET SRMULT="A"
FOR
SET SRMULT=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT))
if SRMULT=""
QUIT
SET SROTH=$SELECT(SRS=1:2,1:1)
DO PASS1
+3 FOR SRS=1,2
SET SRMULT="A"
FOR
SET SRMULT=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT))
if SRMULT=""
QUIT
SET SROTH=$SELECT(SRS=1:2,1:1)
DO PASS2
+4 FOR SRS=1,2
SET SRMULT="A"
FOR
SET SRMULT=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT))
if SRMULT=""
QUIT
SET SROTH=$SELECT(SRS=1:2,1:1)
DO PASS3
+5 FOR SRS=1,2
SET SRMULT="A"
FOR
SET SRMULT=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT))
if SRMULT=""
QUIT
SET SROTH=$SELECT(SRS=1:2,1:1)
DO PASS4
+6 QUIT
PASS1 ; delete nodes for unchanged fields except for .01 fields
+1 SET SRE=0
FOR
SET SRE=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE))
if 'SRE
QUIT
SET SRE1=""
FOR
SET SRE1=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1))
if SRE1=""
QUIT
Begin DoDot:1
+2 SET SRFLD=""
FOR
SET SRFLD=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
if SRFLD=""
QUIT
SET SRCHNG=0
Begin DoDot:2
+3 SET Y=$PIECE(SRFLD,"-",3)
IF $PIECE(Y,",",2)=.01
QUIT
+4 IF $PIECE(SRFLD,"-",3)[";W"
Begin DoDot:3
+5 FOR SRS1=1,2
if SRCHNG
QUIT
SET SRLN=0
SET SROTH=$SELECT(SRS1=1:2,1:1)
FOR
SET SRLN=$ORDER(^TMP("SRNRAD"_SRS1,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
if 'SRLN
QUIT
Begin DoDot:4
+6 IF ^TMP("SRNRAD"_SRS1,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)'=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
SET SRCHNG=1
End DoDot:4
+7 IF 'SRCHNG
FOR SRS1=1,2
KILL ^TMP("SRNRAD"_SRS1,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)
End DoDot:3
QUIT
+8 SET SROTH=$SELECT(SRS=1:2,1:1)
IF ^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)'=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
SET SRCHNG=1
+9 IF 'SRCHNG
FOR SRS1=1,2
KILL ^TMP("SRNRAD"_SRS1,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)
End DoDot:2
End DoDot:1
+10 QUIT
PASS2 ; delete .01 nodes of sub-multiples if no changes underneath - before or after
+1 NEW SRNXT1,SRNXT2,SRY1,SRY2
+2 SET SRE=0
FOR
SET SRE=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE))
if 'SRE
QUIT
SET SRE1=0
FOR
SET SRE1=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1))
if SRE1=""
QUIT
Begin DoDot:1
+3 SET SRFLD=""
FOR
SET SRFLD=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
if SRFLD=""
QUIT
Begin DoDot:2
+4 IF ^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)'=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
QUIT
+5 SET SRNXT1=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
+6 SET SRNXT2=$ORDER(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
+7 IF SRNXT1=""
IF SRNXT2=""
KILL ^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD),^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)
QUIT
+8 SET SRY1=$PIECE(SRNXT1,"-",3)
SET SRY2=$PIECE(SRNXT2,"-",3)
IF $PIECE(SRY1,",",2)=.01
IF $PIECE(SRY2,",",2)=.01
KILL ^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD),^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)
End DoDot:2
End DoDot:1
+9 QUIT
PASS3 ; delete .01 nodes for top level multiples if no changes underneath
+1 SET SRE=0
FOR
SET SRE=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE))
if 'SRE
QUIT
SET SRFLD=""
FOR
SET SRFLD=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,0,SRFLD))
if SRFLD=""
QUIT
Begin DoDot:1
+2 SET Y=$PIECE(SRFLD,"-",3)
IF $PIECE(Y,",",2)'=.01
QUIT
+3 IF ^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,0,SRFLD)'=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,0,SRFLD))
QUIT
+4 IF $ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,0,SRFLD))=""
IF $ORDER(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,0,SRFLD))=""
Begin DoDot:2
+5 IF $ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,0))'=""
IF $ORDER(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,0))'=""
QUIT
+6 KILL ^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,0,SRFLD),^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,0,SRFLD)
End DoDot:2
End DoDot:1
+7 QUIT
PASS4 ; set up list of changed fields for display in addendum
+1 SET SRE=""
FOR
SET SRE=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE))
if 'SRE
QUIT
SET SRE1=""
FOR
SET SRE1=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1))
if SRE1=""
QUIT
SET SRFLD=""
FOR
SET SRFLD=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
if SRFLD=""
QUIT
Begin DoDot:1
+2 IF $PIECE(SRFLD,"-",3)[";W"
Begin DoDot:2
+3 SET SRLN=0
FOR
SET SRLN=$ORDER(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
if 'SRLN
QUIT
Begin DoDot:3
+4 SET ^TMP("SRNRMULT"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)=$GET(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
+5 SET ^TMP("SRNRMULT"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN)=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD,SRLN))
End DoDot:3
End DoDot:2
QUIT
+6 SET ^TMP("SRNRMULT"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)=$GET(^TMP("SRNRAD"_SRS,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
+7 SET ^TMP("SRNRMULT"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD)=$GET(^TMP("SRNRAD"_SROTH,$JOB,SRTN,SRMULT,SRE,SRE1,SRFLD))
End DoDot:1
+8 QUIT