Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/SURGERY-SR/SROACOP.m

    r613 r623  
    1 SROACOP ;BIR/MAM - CARDIAC OPERATIVE RISK SUMMARY ;12/20/07
    2         ;;3.0; Surgery ;**38,47,71,88,95,107,100,125,142,153,160,166**;24 Jun 93;Build 7
    3         I '$D(SRTN) W !!,"A Surgery Risk Assessment must be selected prior to using this option.",!!,"Press <RET> to continue  " R X:DTIME G END
    4         N SRCSTAT S SRACLR=0,SRSOUT=0,SRSUPCPT=1 D ^SROAUTL
    5 START   D:SRACLR RET G:SRSOUT END S SRACLR=0 K SRA,SRAO
    6         F I=206,206.1,208 S SRA(I)=$G(^SRF(SRTN,I))
    7         I $P(SRA(206),"^",41)="" K DA,DIE,DR S DA=SRTN,DIE=130,DR="472////N" D ^DIE K DA,DIE,DR S SRA(206)=$G(^SRF(SRTN,206))
    8         S Y=$P($G(^SRF(SRTN,1.1)),"^",3),C=$P(^DD(130,1.13,0),"^",2) D:Y'="" Y^DIQ S SRAO(2)=Y_"^1.13"
    9         S SRAO(1)=$P(SRA(206),"^",31)_"^364",SRAO(3)=$P(SRA(208),"^",12)_"^414"
    10         S (X,Y)=$P(SRA(206),"^",32) D:Y DT S SRAO("1A")=X_"^364.1"
    11         S Y=$P(SRAO(3),"^") I Y'="" S C=$P(^DD(130,414,0),"^",2) D Y^DIQ S $P(SRAO(3),"^")=Y
    12         S Y=$P(SRA(208),"^",13) D DT S SRAO("3A")=X_"^414.1"
    13         S Y=$P($G(^SRF(SRTN,.2)),"^",2) D DT S SRAO(4)=X_"^.22"
    14         S Y=$P($G(^SRF(SRTN,.2)),"^",3) D DT S SRAO(5)=X_"^.23"
    15         S SRAO(6)=SRA(206.1)_"^430"
    16         S SRCSTAT=">> Coding "_$S($P($G(^SRO(136,SRTN,10)),"^"):"",1:"Not ")_"Complete <<"
    17         S SRPAGE="PAGE: 1" D HDR^SROAUTL S SRAO(7)=""
    18         S (X,X1)=$P(SRAO(1),"^"),X=$S(X?1.3N:X_"%",1:X) W !," 1. Physician's Preoperative Estimate of Operative Mortality: "_X
    19         S X=$P(SRAO("1A"),"^") I X1'=""!(X'="") W !,?3," A. Date/Time Collected:    "_X
    20         W !," 2. ASA Classification:",?31,$P(SRAO(2),"^"),!," 3. Surgical Priority:",?31,$P(SRAO(3),"^")
    21         S X=$P(SRAO("3A"),"^") I X'="" W !,?3," A. Date/Time Collected:    "_X
    22         W !," 4. Date/Time Operation Began:",?31,$P(SRAO(4),"^"),!," 5. Date/Time Operation Ended:",?31,$P(SRAO(5),"^")
    23         W !," 6. Preoperative Risk Factors: "
    24         I $P(SRAO(6),"^")'="" S SRQ=0 S X=$P(SRAO(6),"^") W:$L(X)<49 X,! I $L(X)>48 S Z=$L(X) D
    25         .I X'[" " W ?25,X Q
    26         .S I=0,LINE=1 F  S SRL=$S(LINE=1:48,1:80) D  Q:SRQ
    27         ..I $E(X,1,SRL)'[" " W X,! S SRQ=1 Q
    28         ..S J=SRL-I,Y=$E(X,J),I=I+1 I Y=" " W $E(X,1,J-1),! S X=$E(X,J+1,Z),Z=$L(X),I=0,LINE=LINE+1 I Z<SRL W X S SRQ=1 Q
    29         N SRPROC,SRL S SRL=49 D CPTS^SROAUTL0 W !," 7. CPT Codes (view only):"
    30         F I=1:1 Q:'$D(SRPROC(I))  W:I=1 ?31,SRPROC(I) W:I'=1 !,?31,SRPROC(I)
    31         W ! D CHCK
    32         W !! F MOE=1:1:80 W "-"
    33 ASK     W !,"Select Operative Risk Summary Information to Edit: " R X:DTIME I '$T!("^"[X) G END
    34         S:X="a" X="A" I '$D(SRAO(X)),(X'?.N1":".N),(X'="A") D HELP G:SRSOUT END G START
    35         I X="A" S X="1:7"
    36         I X?.N1":".N S Y=$E(X),Z=$P(X,":",2) I Y<1!(Z>7)!(Y>Z) D HELP G:SRSOUT END G START
    37         I X'=7 D HDR^SROAUTL
    38         I X?.N1":".N D RANGE S SROERR=SRTN D ^SROERR0 G START
    39         I $D(SRAO(X))!(X=6) S EMILY=X D  S SROERR=SRTN D ^SROERR0 G START
    40         .I $$LOCK^SROUTL(SRTN) W !! D ONE,UNLOCK^SROUTL(SRTN)
    41 END     I '$D(SREQST) W @IOF D ^SRSKILL
    42         Q
    43 DT      I 'Y S X="" Q
    44         X ^DD("DD") S X=$P(Y,"@")_" "_$P(Y,"@",2)
    45         Q
    46 HELP    W @IOF,!!!!,"Enter the number or range of numbers you want to edit.  Examples of proper",!,"responses are listed below."
    47         W !!,"1. Enter 'A' to update all information.",!!,"2. Enter the corresponding number to update the information in a particular",!,"   field.  (For example, enter '3' to update Surgical Priority)"
    48         W !!,"3. Enter two numbers separated by a ':' to enter a range of information.",!,"   (For example, enter '1:2' to update Physician's Preoperative Estimate of",!,"   Mortality and ASA Classification.)"
    49         W !!,"Press ENTER to continue, or '^' to quit  " R X:DTIME I '$T!(X["^") S SRSOUT=1
    50         Q
    51 RANGE   ; range of numbers
    52         I $$LOCK^SROUTL(SRTN) D  D UNLOCK^SROUTL(SRTN)
    53         .W !! S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) F EMILY=SHEMP:1:CURLEY Q:SRSOUT  D ONE
    54         Q
    55 ONE     ; edit one item
    56         I EMILY=7 D DISP^SROAUTL0 Q
    57         K DR,DIE S DA=SRTN,DIE=130,DR=$P(SRAO(EMILY),"^",2)
    58         S DR=DR_"T",DIE=130 S DR=DR_$S(EMILY=3:";414.1T",1:"") D ^DIE K DR I $D(Y) S SRSOUT=1
    59         I EMILY=1 D
    60         .I $P(^SRF(SRTN,206),"^",31)="NS" S $P(^SRF(SRTN,206),"^",32)="NS" Q
    61         .S DR="364.1T",DIE=130 D ^DIE K DR I $D(Y) S SRSOUT=1
    62         Q
    63 RET     Q:SRSOUT  W !!,"Press ENTER to continue, or '^' to quit  " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
    64         Q
    65 NOW     ; update date/time of estimate of mortality
    66         N X D NOW^%DTC S $P(^SRF(DA,206),"^",32)=$E(%,1,12)
    67         Q
    68 KNOW    ; delete date/time of estimate of mortality
    69         S $P(^SRF(DA,206),"^",32)=""
    70         Q
    71 YN      ; store answer
    72         S SHEMP=$S(NYUK="NS":"Unknown",NYUK="N":"NO",NYUK="Y":"YES",1:"")
    73         Q
    74 CHCK    ;compare dates
    75         N SRINO,SRSP,SREM
    76         S SRSP=$P($G(^SRF(SRTN,208)),"^",13),SRINO=$P($G(^SRF(SRTN,.2)),"^",10),SREM=$P($G(^SRF(SRTN,206)),"^",32)
    77         I SRSP'="",SRINO'="",SRSP'<SRINO W !!,"*** NOTE: D/Time of Surgical Priority should be < the D/Time Patient in OR.***"
    78         I SREM'="",SRINO'="",SREM'<SRINO W !!,"*** NOTE: D/Time of Estimate of Mortality should be < the D/Time PT in OR. ***"
    79         Q
     1SROACOP ;BIR/MAM - CARDIAC OPERATIVE RISK SUMMARY ;02/14/07
     2 ;;3.0; Surgery ;**38,47,71,88,95,107,100,125,142,153,160**;24 Jun 93;Build 7
     3 I '$D(SRTN) W !!,"A Surgery Risk Assessment must be selected prior to using this option.",!!,"Press <RET> to continue  " R X:DTIME G END
     4 N SRCSTAT S SRACLR=0,SRSOUT=0,SRSUPCPT=1 D ^SROAUTL
     5START D:SRACLR RET G:SRSOUT END S SRACLR=0 K SRA,SRAO
     6 F I=206,206.1,208 S SRA(I)=$G(^SRF(SRTN,I))
     7 I $P(SRA(206),"^",41)="" K DA,DIE,DR S DA=SRTN,DIE=130,DR="472////N" D ^DIE K DA,DIE,DR S SRA(206)=$G(^SRF(SRTN,206))
     8 S Y=$P($G(^SRF(SRTN,1.1)),"^",3),C=$P(^DD(130,1.13,0),"^",2) D:Y'="" Y^DIQ S SRAO(2)=Y_"^1.13"
     9 S SRAO(1)=$P(SRA(206),"^",31)_"^364",SRAO(3)=$P(SRA(208),"^",12)_"^414"
     10 S Y=$P(SRA(206),"^",32) D DT S SRAO("1A")=X_"^364.1"
     11 S Y=$P(SRAO(3),"^") I Y'="" S C=$P(^DD(130,414,0),"^",2) D Y^DIQ S $P(SRAO(3),"^")=Y
     12 S Y=$P(SRA(208),"^",13) D DT S SRAO("3A")=X_"^414.1"
     13 S Y=$P($G(^SRF(SRTN,.2)),"^",2) D DT S SRAO(4)=X_"^.22"
     14 S Y=$P($G(^SRF(SRTN,.2)),"^",3) D DT S SRAO(5)=X_"^.23"
     15 S SRAO(6)=SRA(206.1)_"^430"
     16 S SRCSTAT=">> Coding "_$S($P($G(^SRO(136,SRTN,10)),"^"):"",1:"Not ")_"Complete <<"
     17 S SRPAGE="PAGE: 1" D HDR^SROAUTL S SRAO(7)=""
     18 S X=$P(SRAO(1),"^"),X=$S(X?1.3N:X_"%",1:X) W !," 1. Physician's Preoperative Estimate of Operative Mortality: "_X
     19 S X=$P(SRAO("1A"),"^") I X'="" W !,?3," A. Date/Time Collected:    "_X
     20 W !," 2. ASA Classification:",?31,$P(SRAO(2),"^"),!," 3. Surgical Priority:",?31,$P(SRAO(3),"^")
     21 S X=$P(SRAO("3A"),"^") I X'="" W !,?3," A. Date/Time Collected:    "_X
     22 W !," 4. Date/Time Operation Began:",?31,$P(SRAO(4),"^"),!," 5. Date/Time Operation Ended:",?31,$P(SRAO(5),"^")
     23 W !," 6. Preoperative Risk Factors: "
     24 I $P(SRAO(6),"^")'="" S SRQ=0 S X=$P(SRAO(6),"^") W:$L(X)<49 X,! I $L(X)>48 S Z=$L(X) D
     25 .I X'[" " W ?25,X Q
     26 .S I=0,LINE=1 F  S SRL=$S(LINE=1:48,1:80) D  Q:SRQ
     27 ..I $E(X,1,SRL)'[" " W X,! S SRQ=1 Q
     28 ..S J=SRL-I,Y=$E(X,J),I=I+1 I Y=" " W $E(X,1,J-1),! S X=$E(X,J+1,Z),Z=$L(X),I=0,LINE=LINE+1 I Z<SRL W X S SRQ=1 Q
     29 N SRPROC,SRL S SRL=49 D CPTS^SROAUTL0 W !," 7. CPT Codes (view only):"
     30 F I=1:1 Q:'$D(SRPROC(I))  W:I=1 ?31,SRPROC(I) W:I'=1 !,?31,SRPROC(I)
     31 W ! D CHCK
     32 W !! F MOE=1:1:80 W "-"
     33ASK W !,"Select Operative Risk Summary Information to Edit: " R X:DTIME I '$T!("^"[X) G END
     34 S:X="a" X="A" I '$D(SRAO(X)),(X'?.N1":".N),(X'="A") D HELP G:SRSOUT END G START
     35 I X="A" S X="1:7"
     36 I X?.N1":".N S Y=$E(X),Z=$P(X,":",2) I Y<1!(Z>7)!(Y>Z) D HELP G:SRSOUT END G START
     37 I X'=7 D HDR^SROAUTL
     38 I X?.N1":".N D RANGE S SROERR=SRTN D ^SROERR0 G START
     39 I $D(SRAO(X))!(X=6) S EMILY=X D  S SROERR=SRTN D ^SROERR0 G START
     40 .I $$LOCK^SROUTL(SRTN) W !! D ONE,UNLOCK^SROUTL(SRTN)
     41END I '$D(SREQST) W @IOF D ^SRSKILL
     42 Q
     43DT I 'Y S X="" Q
     44 X ^DD("DD") S X=$P(Y,"@")_" "_$P(Y,"@",2)
     45 Q
     46HELP W @IOF,!!!!,"Enter the number or range of numbers you want to edit.  Examples of proper",!,"responses are listed below."
     47 W !!,"1. Enter 'A' to update all information.",!!,"2. Enter the corresponding number to update the information in a particular",!,"   field.  (For example, enter '3' to update Surgical Priority)"
     48 W !!,"3. Enter two numbers separated by a ':' to enter a range of information.",!,"   (For example, enter '1:2' to update Physician's Preoperative Estimate of",!,"   Mortality and ASA Classification.)"
     49 W !!,"Press ENTER to continue, or '^' to quit  " R X:DTIME I '$T!(X["^") S SRSOUT=1
     50 Q
     51RANGE ; range of numbers
     52 I $$LOCK^SROUTL(SRTN) D  D UNLOCK^SROUTL(SRTN)
     53 .W !! S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) F EMILY=SHEMP:1:CURLEY Q:SRSOUT  D ONE
     54 Q
     55ONE ; edit one item
     56 I EMILY=7 D DISP^SROAUTL0 Q
     57 K DR,DIE S DA=SRTN,DIE=130,DR=$P(SRAO(EMILY),"^",2)
     58 S DR=DR_"T",DIE=130 S DR=DR_$S(EMILY=1:";364.1T",EMILY=3:";414.1T",1:"") D ^DIE K DR I $D(Y) S SRSOUT=1
     59 Q
     60RET Q:SRSOUT  W !!,"Press ENTER to continue, or '^' to quit  " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
     61 Q
     62NOW ; update date/time of estimate of mortality
     63 N X D NOW^%DTC S $P(^SRF(DA,206),"^",32)=$E(%,1,12)
     64 Q
     65KNOW ; delete date/time of estimate of mortality
     66 S $P(^SRF(DA,206),"^",32)=""
     67 Q
     68YN ; store answer
     69 S SHEMP=$S(NYUK="NS":"Unknown",NYUK="N":"NO",NYUK="Y":"YES",1:"")
     70 Q
     71CHCK ;compare dates
     72 N SRINO,SRSP,SREM
     73 S SRSP=$P($G(^SRF(SRTN,208)),"^",13),SRINO=$P($G(^SRF(SRTN,.2)),"^",10),SREM=$P($G(^SRF(SRTN,206)),"^",32)
     74 I SRSP'="",SRINO'="",SRSP'<SRINO W !!,"*** NOTE: D/Time of Surgical Priority should be < the D/Time Patient in OR.***"
     75 I SREM'="",SRINO'="",SREM'<SRINO W !!,"*** NOTE: D/Time of Estimate of Mortality should be < the D/Time PT in OR. ***"
     76 Q
Note: See TracChangeset for help on using the changeset viewer.