SRTPHRT6 ;BIR/SJA - HEART DONOR INFORMATION ;03/04/08
;;3.0; Surgery ;**167**;24 Jun 93;Build 27
I '$D(SRTPP) W !!,"A Transplant Assessment must be selected prior to using this option.",!!,"Press <RET> to continue " R X:DTIME G END
N SRX,SRY,SRZ
START Q:SRSOUT D DISP
W !!,"Select Transplant Information to Edit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 G END
I X="" G END
S:X="a" X="A" I '$D(SRAO(X)),(X'?.N1":".N),(X'="A") D HELP G:SRSOUT END G START
I X?1.2N1":"1.2N S Y=$P(X,":"),Z=$P(X,":",2) I Y<1!(Z>SRX)!(Y>Z) D HELP G:SRSOUT END G START
I X="A" S X="1:"_SRX
D HDR^SRTPUTL
I X?1.2N1":"1.2N D RANGE G START
I $D(SRAO(X)),+X=X S SREMIL=X D ONE G START
END W @IOF
Q
HELP W @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below."
W !!,"1. Enter 'A' to update all items.",!!,"2. Enter a number (1-"_SRX_") to update the information in that field. (For example,",!," enter '1' to update Donor Race)"
W !!,"3. Enter a range of numbers (1-"_SRX_") separated by a ':' to enter a range",!," of items. (For example, enter '1:4' to update items 1, 2, 3 and 4.)",!
PRESS W ! K DIR S DIR("A")="Press the return key to continue or '^' to exit: ",DIR(0)="FOA" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1
Q
RANGE ; range of numbers
S SRNOMORE=0,SRSHEMP=$P(X,":"),SRCURL=$P(X,":",2) F SREMIL=SRSHEMP:1:SRCURL Q:SRNOMORE D ONE
Q
ONE ; edit one item
I SREMIL=1 D ^SRTPRACE Q
K DR,DIE S DA=SRTPP,DR=$P(SRAO(SREMIL),"^",2)_"T",DIE=139.5 D ^DIE K DR I $D(Y) S SRNOMORE=1
Q
DISP ; display fields
S SRHPG="DONOR INFORMATION",SRPAGE="PAGE: "_$S(SRNOVA:6,1:4)_" OF "_$S(SRNOVA:6,1:4)
D HDR^SRTPUTL
K DR,SRAO S (DR,SRDR)="45;31;36;70;46;48;49;77;69;104;64;65;66;73;67;72" S SRAO(1)=""
K DA,DIC,DIQ,SRX,SRY,SRZ S DIC="^SRT(",DA=SRTPP,DIQ="SRY",DIQ(0)="E",DR=SRDR D EN^DIQ1 K DA,DIC,DIQ,DR
S (SRX,SRZ)=0 F I=1:1 S SRZ=$P(SRDR,";",I) Q:'SRZ S SRX=I,SRAO(I+1)=SRY(139.5,SRTPP,SRZ,"E")_"^"_SRZ
S SRX=SRX+1
; race information
K SRY,SRZ S DIC="^SRT(",DR=44,DA=SRTPP,DR(139.544)=".01"
S (II,JJ)=0 F S II=$O(^SRT(SRTPP,44,II)) Q:'II S SRACE=$G(^SRT(SRTPP,44,II,0)) D K SRY
.S DA(139.544)=II,DIQ="SRY",DIQ(0)="E" D EN^DIQ1
.S JJ=JJ+1,SRZ(139.544,JJ)=SRACE_"^"_$G(SRY(139.544,II,.01,"E")),SRZ(139.544)=JJ
D RACE
W !,"1. Donor Race:" S SRAO(1)="" I $G(SRZ(139.544)) F D=1:1:SRNUM1-1 W:D=1 ?18,SROL(D) W:D'=1 !,?18,SROL(D)
W !,"2. Donor Gender:",?27,$P(SRAO(2),"^")
W !,"3. Donor Height:",?27,$P(SRAO(3),"^"),?45,"HLA Typing (#,#,#)"
W !,"4. Donor Weight:",?27,$P(SRAO(4),"^"),?45,"=================="
W !,"5. Donor DOB:",?27,$P(SRAO(5),"^"),?45,"12. Donor HLA-A: ",$P(SRAO(12),"^")
W !,"6. Donor Age:",?27,$P(SRAO(6),"^"),?45,"13. Donor HLA-B: ",$P(SRAO(13),"^")
W !,"7. Donor ABO Blood Type:",?27,$P(SRAO(7),"^"),?45,"14. Donor HLA-C: ",$P(SRAO(14),"^")
W !,"8. Donor CMV:",?27,$P(SRAO(8),"^"),?45,"15. Donor HLA-DR: ",$P(SRAO(15),"^")
W !,"9. Donor Substance Abuse:",?27,$P(SRAO(9),"^"),?45,"16. Donor HLA-BW: ",$P(SRAO(16),"^")
W !,"10. Deceased Donor:",?27,$P($P(SRAO(10),"^"),"("),?45,"17. Donor HLA-DQ: ",$P(SRAO(17),"^")
W !,"11. Donor with Malignancy:",?27,$P(SRAO(11),"^")
W !!,SRLINE
Q
RACE ;Find all race entries and place into a string with commas inbetween
K SROL S SRORC=0,C=1,SRORACE="",SROLINE="",N=1,SROL=""
F S SRORC=$O(SRZ(139.544,SRORC)) Q:SRORC="" Q:C=11 D
.I $D(SRZ(139.544,SRORC)) S SRORACE(C)=$P(SRZ(139.544,SRORC),"^",2)
.I SROLINE'="" S SROLINE=SROLINE_", "_SRORACE(C)
.I SROLINE="" S SROLINE=SRORACE(C)
.S C=C+1
;Find total length of 'race' string and wrap the text if necessary
I $L(SROLINE)=45!$L(SROLINE)<45 S SROL(N)=SROLINE,SRNUM1=2
I $L(SROLINE)>45 D WRAP
K SROLINE,SRORC,SRORACE,SROLN,SROLN1,SROWRAP
Q
WRAP ;Wrap multiple race entries so that wrapped line
;does not break in the middle of a word
;
S SROLNGTH=$L(SROLINE),E=45,SROWRAP="",SROLN="",SROLN1="",SROL=""
F I=1:45:SROLNGTH S SROLN(I)=SROWRAP_$E(SROLINE,I,E) D
.F K=45:-1:1 I $E(SROLN(I),K)[" " D Q ;Break lines at space
..S SROLN1(I)=$E(SROLN(I),1,K-1)
..S SROWRAP=$E(SROLN(I),K+1,E)
.S E=E+45
;
S:'$D(SROLN1(I)) SROLN1(I)=SROLN(I),SROWRAP=""
I $L(SROLN1(I))+$L(SROWRAP)>44 S SROLN1(I+1)=SROWRAP ;Last line
I $L(SROLN1(I))+$L(SROWRAP)'>44 S SROLN1(I)=SROLN1(I)_" "_SROWRAP
;
;Renumber the SROLN1 array to be in numeric order
S SRNUM=0,SRNUM1=1
F S SRNUM=$O(SROLN1(SRNUM)) Q:SRNUM="" D
.S SROL(SRNUM1)=SROLN1(SRNUM)
.S SRNUM1=SRNUM1+1
Q
SRTPHRT6 ;BIR/SJA - HEART DONOR INFORMATION ;03/04/08
+1 ;;3.0; Surgery ;**167**;24 Jun 93;Build 27
+2 IF '$DATA(SRTPP)
WRITE !!,"A Transplant Assessment must be selected prior to using this option.",!!,"Press <RET> to continue "
READ X:DTIME
GOTO END
+3 NEW SRX,SRY,SRZ
START IF SRSOUT
QUIT
DO DISP
+1 WRITE !!,"Select Transplant Information to Edit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
GOTO END
+2 IF X=""
GOTO END
+3 IF X="a"
SET X="A"
IF '$DATA(SRAO(X))
IF (X'?.N1":".N)
IF (X'="A")
DO HELP
IF SRSOUT
GOTO END
GOTO START
+4 IF X?1.2N1":"1.2N
SET Y=$PIECE(X,":")
SET Z=$PIECE(X,":",2)
IF Y<1!(Z>SRX)!(Y>Z)
DO HELP
IF SRSOUT
GOTO END
GOTO START
+5 IF X="A"
SET X="1:"_SRX
+6 DO HDR^SRTPUTL
+7 IF X?1.2N1":"1.2N
DO RANGE
GOTO START
+8 IF $DATA(SRAO(X))
IF +X=X
SET SREMIL=X
DO ONE
GOTO START
END WRITE @IOF
+1 QUIT
HELP WRITE @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below."
+1 WRITE !!,"1. Enter 'A' to update all items.",!!,"2. Enter a number (1-"_SRX_") to update the information in that field. (For example,",!," enter '1' to update Donor Race)"
+2 WRITE !!,"3. Enter a range of numbers (1-"_SRX_") separated by a ':' to enter a range",!," of items. (For example, enter '1:4' to update items 1, 2, 3 and 4.)",!
PRESS WRITE !
KILL DIR
SET DIR("A")="Press the return key to continue or '^' to exit: "
SET DIR(0)="FOA"
DO ^DIR
KILL DIR
IF $DATA(DTOUT)!$DATA(DUOUT)
SET SRSOUT=1
+1 QUIT
RANGE ; range of numbers
+1 SET SRNOMORE=0
SET SRSHEMP=$PIECE(X,":")
SET SRCURL=$PIECE(X,":",2)
FOR SREMIL=SRSHEMP:1:SRCURL
IF SRNOMORE
QUIT
DO ONE
+2 QUIT
ONE ; edit one item
+1 IF SREMIL=1
DO ^SRTPRACE
QUIT
+2 KILL DR,DIE
SET DA=SRTPP
SET DR=$PIECE(SRAO(SREMIL),"^",2)_"T"
SET DIE=139.5
DO ^DIE
KILL DR
IF $DATA(Y)
SET SRNOMORE=1
+3 QUIT
DISP ; display fields
+1 SET SRHPG="DONOR INFORMATION"
SET SRPAGE="PAGE: "_$SELECT(SRNOVA:6,1:4)_" OF "_$SELECT(SRNOVA:6,1:4)
+2 DO HDR^SRTPUTL
+3 KILL DR,SRAO
SET (DR,SRDR)="45;31;36;70;46;48;49;77;69;104;64;65;66;73;67;72"
SET SRAO(1)=""
+4 KILL DA,DIC,DIQ,SRX,SRY,SRZ
SET DIC="^SRT("
SET DA=SRTPP
SET DIQ="SRY"
SET DIQ(0)="E"
SET DR=SRDR
DO EN^DIQ1
KILL DA,DIC,DIQ,DR
+5 SET (SRX,SRZ)=0
FOR I=1:1
SET SRZ=$PIECE(SRDR,";",I)
IF 'SRZ
QUIT
SET SRX=I
SET SRAO(I+1)=SRY(139.5,SRTPP,SRZ,"E")_"^"_SRZ
+6 SET SRX=SRX+1
+7 ; race information
+8 KILL SRY,SRZ
SET DIC="^SRT("
SET DR=44
SET DA=SRTPP
SET DR(139.544)=".01"
+9 SET (II,JJ)=0
FOR
SET II=$ORDER(^SRT(SRTPP,44,II))
IF 'II
QUIT
SET SRACE=$GET(^SRT(SRTPP,44,II,0))
Begin DoDot:1
+10 SET DA(139.544)=II
SET DIQ="SRY"
SET DIQ(0)="E"
DO EN^DIQ1
+11 SET JJ=JJ+1
SET SRZ(139.544,JJ)=SRACE_"^"_$GET(SRY(139.544,II,.01,"E"))
SET SRZ(139.544)=JJ
End DoDot:1
KILL SRY
+12 DO RACE
+13 WRITE !,"1. Donor Race:"
SET SRAO(1)=""
IF $GET(SRZ(139.544))
FOR D=1:1:SRNUM1-1
IF D=1
WRITE ?18,SROL(D)
IF D'=1
WRITE !,?18,SROL(D)
+14 WRITE !,"2. Donor Gender:",?27,$PIECE(SRAO(2),"^")
+15 WRITE !,"3. Donor Height:",?27,$PIECE(SRAO(3),"^"),?45,"HLA Typing (#,#,#)"
+16 WRITE !,"4. Donor Weight:",?27,$PIECE(SRAO(4),"^"),?45,"=================="
+17 WRITE !,"5. Donor DOB:",?27,$PIECE(SRAO(5),"^"),?45,"12. Donor HLA-A: ",$PIECE(SRAO(12),"^")
+18 WRITE !,"6. Donor Age:",?27,$PIECE(SRAO(6),"^"),?45,"13. Donor HLA-B: ",$PIECE(SRAO(13),"^")
+19 WRITE !,"7. Donor ABO Blood Type:",?27,$PIECE(SRAO(7),"^"),?45,"14. Donor HLA-C: ",$PIECE(SRAO(14),"^")
+20 WRITE !,"8. Donor CMV:",?27,$PIECE(SRAO(8),"^"),?45,"15. Donor HLA-DR: ",$PIECE(SRAO(15),"^")
+21 WRITE !,"9. Donor Substance Abuse:",?27,$PIECE(SRAO(9),"^"),?45,"16. Donor HLA-BW: ",$PIECE(SRAO(16),"^")
+22 WRITE !,"10. Deceased Donor:",?27,$PIECE($PIECE(SRAO(10),"^"),"("),?45,"17. Donor HLA-DQ: ",$PIECE(SRAO(17),"^")
+23 WRITE !,"11. Donor with Malignancy:",?27,$PIECE(SRAO(11),"^")
+24 WRITE !!,SRLINE
+25 QUIT
RACE ;Find all race entries and place into a string with commas inbetween
+1 KILL SROL
SET SRORC=0
SET C=1
SET SRORACE=""
SET SROLINE=""
SET N=1
SET SROL=""
+2 FOR
SET SRORC=$ORDER(SRZ(139.544,SRORC))
IF SRORC=""
QUIT
IF C=11
QUIT
Begin DoDot:1
+3 IF $DATA(SRZ(139.544,SRORC))
SET SRORACE(C)=$PIECE(SRZ(139.544,SRORC),"^",2)
+4 IF SROLINE'=""
SET SROLINE=SROLINE_", "_SRORACE(C)
+5 IF SROLINE=""
SET SROLINE=SRORACE(C)
+6 SET C=C+1
End DoDot:1
+7 ;Find total length of 'race' string and wrap the text if necessary
+8 IF $LENGTH(SROLINE)=45!$LENGTH(SROLINE)<45
SET SROL(N)=SROLINE
SET SRNUM1=2
+9 IF $LENGTH(SROLINE)>45
DO WRAP
+10 KILL SROLINE,SRORC,SRORACE,SROLN,SROLN1,SROWRAP
+11 QUIT
WRAP ;Wrap multiple race entries so that wrapped line
+1 ;does not break in the middle of a word
+2 ;
+3 SET SROLNGTH=$LENGTH(SROLINE)
SET E=45
SET SROWRAP=""
SET SROLN=""
SET SROLN1=""
SET SROL=""
+4 FOR I=1:45:SROLNGTH
SET SROLN(I)=SROWRAP_$EXTRACT(SROLINE,I,E)
Begin DoDot:1
+5 ;Break lines at space
FOR K=45:-1:1
IF $EXTRACT(SROLN(I),K)[" "
Begin DoDot:2
+6 SET SROLN1(I)=$EXTRACT(SROLN(I),1,K-1)
+7 SET SROWRAP=$EXTRACT(SROLN(I),K+1,E)
End DoDot:2
QUIT
+8 SET E=E+45
End DoDot:1
+9 ;
+10 IF '$DATA(SROLN1(I))
SET SROLN1(I)=SROLN(I)
SET SROWRAP=""
+11 ;Last line
IF $LENGTH(SROLN1(I))+$LENGTH(SROWRAP)>44
SET SROLN1(I+1)=SROWRAP
+12 IF $LENGTH(SROLN1(I))+$LENGTH(SROWRAP)'>44
SET SROLN1(I)=SROLN1(I)_" "_SROWRAP
+13 ;
+14 ;Renumber the SROLN1 array to be in numeric order
+15 SET SRNUM=0
SET SRNUM1=1
+16 FOR
SET SRNUM=$ORDER(SROLN1(SRNUM))
IF SRNUM=""
QUIT
Begin DoDot:1
+17 SET SROL(SRNUM1)=SROLN1(SRNUM)
+18 SET SRNUM1=SRNUM1+1
End DoDot:1
+19 QUIT