source: FOIAVistA/tag/r/SURGERY-SR/SROACPM.m@ 636

Last change on this file since 636 was 636, checked in by George Lilly, 14 years ago

WorldVistAEHR overlayed on FOIAVistA

File size: 6.6 KB
Line 
1SROACPM ;BIR/ADM - CARDIAC RESOURCE INFO ;08/23/07
2 ;;3.0; Surgery ;**71,93,95,99,100,125,142,160,164**;24 Jun 93;Build 2
3 ;
4 ; Reference to ^DGPM("APTT1" supported by DBIA #565
5 ;
6 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
7 S SRSOUT=0,SRSUPCPT=1 D ^SROAUTL
8START G:SRSOUT END D HDR^SROAUTL
9 S DIR("A",1)="Enter/Edit Patient Resource Data",DIR("A",2)=" ",DIR("A",3)="1. Capture Information from PIMS Records",DIR("A",4)="2. Enter, Edit, or Review Information",DIR("A",5)=" "
10 S DIR("?",1)="Enter '1' if you want to capture patient information from PIMS",DIR("?",2)="records. Enter '2' if you want to enter, edit, or review patient",DIR("?")="other information on this screen."
11 S DIR("A")="Select Number",DIR(0)="NO^1:2" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y S SRSOUT=1 G END
12 I Y=1 D PIMS G START
13EDIT S:$P(^SRF(SRTN,206),"^",41)="" $P(^SRF(SRTN,206),"^",41)="N"
14 S SRR=0 S SRPAGE="PAGE: 1" D HDR^SROAUTL K DR S SRQ=0,(DR,SRDR)="418;419;440;.205;.232;470;471;473;472;431;442;513"
15 K DA,DIC,DIQ,SRY S DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="IE",DR=SRDR D EN^DIQ1 K DA,DIC,DIQ,DR
16 K SRZ S SRZ=0 F M=1:1 S I=$P(SRDR,";",M) Q:'I D
17 .D TR,GET
18 .S SRZ=SRZ+1,Y=$P(X,";;",2),SRFLD=$P(Y,"^"),(Z,SRZ(SRZ))=$P(Y,"^",2)_"^"_SRFLD,SREXT=SRY(130,SRTN,SRFLD,"E")
19 .W:M>1 ! W $J(SRZ,2)_". "_$P(Z,"^")_": " D EXT
20 D CHCK W ! F K=1:1:80 W "-"
21 D SEL G:SRR=1 EDIT
22 G START
23 Q
24CHCK ; compare admission and discharge dates to each other
25 N SRADM,SRDIS,SROUT,SRDICU,SREXT
26 S SROUT=SRY(130,SRTN,.232,"I"),SRDICU=SRY(130,SRTN,471,"I"),SREXT=SRY(130,SRTN,470,"I")
27 S SRADM=SRY(130,SRTN,418,"I"),SRDIS=SRY(130,SRTN,419,"I") W !
28 I SRADM,SRDIS,SRADM'<SRDIS W !,"*** NOTE: Discharge Date precedes Admission Date!! Please check. ***"
29 I SREXT,SROUT,SREXT'>SROUT W !,"*** NOTE: D/Time Pt Extubated should be later than the D/Time Pt Out of OR. ***"
30 I SREXT,SRDICU,SREXT'<SRDICU W !,"*** NOTE: D/Time Pt Extubated should be < the ICU Discharge D/Time. ***"
31 I SRDICU,SREXT,SRDICU'>SREXT W !,"*** NOTE: D/Time Discharged from ICU should be > the Extubation D/Time. ***"
32 I SRDICU,SRDIS,SRDICU>SRDIS W !,"*** NOTE: D/Time Discharged from ICU should be <= the Hospital Discharge D/Time*"
33 Q
34EXT I SRFLD=440&(SREXT="NS") S SREXT=SREXT_"-"_$S(SREXT="NS":"No Study",1:SREXT)
35 I SRFLD=470,(SREXT="NS"!(SREXT="RI")) S SREXT=SREXT_"-"_$S(SREXT="NS":"Unable to determine",SREXT="RI":"Remains intubated at 30 days",1:SREXT)
36 I SRFLD=471,(SREXT="NS"!(SREXT="RI")) S SREXT=SREXT_"-"_$S(SREXT="NS":"Unable to determine",SREXT="RI":"Remains in ICU at 30 days",1:SREXT)
37 I $L(SREXT)<41 W ?39,SREXT W:SRFLD=247 $S(SREXT="":"",SREXT=1:" Day",SREXT=0:" Days",SREXT>1:" Days",1:"") Q
38 I SRFLD=431 D
39 .I $L(SREXT)<52 W ?28,SREXT Q
40 .N I,J,X,Y S X=SREXT F D W:$L(X) ! I $L(X)<52!($L(X)>51&(X'[" ")) W ?28,X Q
41 ..F I=0:1:50 S J=51-I,Y=$E(X,J) I Y=" " W ?28,$E(X,1,J-1) S X=$E(X,J+1,$L(X)) Q
42 Q
43SEL S SRSOUT=0 W !!,"Select number of item to edit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
44 Q:X="" S:X="a" X="A" I '$D(SRFLG),'$D(SRZ(X)),(X'?1.2N1":"1.2N),X'="A" D HELP S SRR=1 Q
45 I X?1.2N1":"1.2N S Y=$P(X,":"),Z=$P(X,":",2) I Y<1!(Z>SRZ)!(Y>Z) D HELP S SRR=1 Q
46 I X="A" S X="1:"_SRZ
47 I X?1.2N1":"1.2N D RANGE S SRR=1 Q
48 I $D(SRZ(X)),+X=X S EMILY=X D S SRR=1
49 .I $$LOCK^SROUTL(SRTN) D ONE,UNLOCK^SROUTL(SRTN)
50 Q
51PIMS ; get update from PIMS records
52 W ! K DIR S DIR("A")="Are you sure you want to retrieve information from PIMS records ? ",DIR("B")="YES",DIR(0)="YOA" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
53 W ! D WAIT^DICD D ^SROAPIMS
54 Q
55HELP W @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below."
56 W !!,"1. Enter 'A' to update all items.",!!,"2. Enter a number (1-"_SRZ_") to update an individual item. (For example,",!," enter '1' to update "_$P(SRZ(1),"^")_".)"
57 W !!,"3. Enter a range of numbers (1-"_SRZ_") separated by a ':' to enter a range",!," of items. (For example, enter '1:4' to update items 1, 2, 3 and 4.)",!
58 I $D(SRFLG) W !,"4. Enter 'N' or 'NO' to enter negative response for all items.",!!,"5. Enter '@' to delete information from all items.",!
59PRESS 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
60 Q
61RANGE ; range of numbers
62 I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
63 .S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) F EMILY=SHEMP:1:CURLEY Q:SRSOUT D ONE
64 Q
65ONE ; edit one item
66 I EMILY=7 D LIST
67 K DR,DA,DIE S DR=$P(SRZ(EMILY),"^",2)_"T",DA=SRTN,DIE=130,SRDT=$P(SRZ(EMILY),"^",3) S:SRDT DR=DR_";"_SRDT_"T" D ^DIE K DR,DA I $D(Y) S SRSOUT=1
68 I 'SRSOUT,EMILY=1!(EMILY=2) D OK
69 Q
70OK ; compare admission date to discharge date
71 N SRADM,SRDIS S X=$G(^SRF(SRTN,208)),SRADM=$P(X,"^",14),SRDIS=$P(X,"^",15)
72 I SRADM,SRDIS,SRADM'<SRDIS W !!," *** NOTE: Discharge Date precedes Admission Date!! Please check. ***",! D PRESS W !
73 Q
74LIST ; display list of patient movements
75 N CNT,SRADM,SRLOC,SRMOVE,SRMVMT,SRT,SRTYPE,SRZ,SRY
76 S DFN=$P(^SRF(SRTN,0),"^"),SRZ=$P($G(^SRF(SRTN,.2)),"^",12)
77 S SRADM=0 D ADM Q:'SRZ
78 S CNT=0 F Q:'SRZ D MVMT
79 Q:CNT=0
80 W !!,?5,"To identify the date and time the patient was discharged from intensive",!,?5,"care following surgery, see the following list of patient movements"
81 W !,?5,"that occurred during the inpatient stay associated with this surgery.",!
82 S CNT=0 F S CNT=$O(SRMVMT(CNT)) Q:'CNT S X=SRMVMT(CNT),SRT=$P(X,"^",2) W !,?5,$P($P(X,"^"),":",1,2),?25,$P(X,"^",3),?37,$S(SRT=3:"From",1:"To")_": "_$P(X,"^",4)
83 W !
84 Q
85MVMT S VAIP("D")=SRZ D IN5^VADPT S SRY=$P(VAIP(3),"^")
86 I SRY S CNT=CNT+1 D
87 .S SRMOVE=$P(VAIP(3),"^",2),SRTYPE=$P(VAIP(2),"^",1,2),SRLOC=$P(VAIP(5),"^",2)
88 .S SRMVMT(CNT)=SRMOVE_"^"_SRTYPE_"^"_SRLOC
89 I 'SRY S SRZ="" Q
90 I VAIP(1)=VAIP(17) S SRZ="" Q
91 I VAIP(16),VAIP(16)=VAIP(17) S CNT=CNT+1,SRMOVE=$P(VAIP(16,1),"^",2),SRTYPE=$P(VAIP(16,2),"^",1,2),SRLOC=$P(VAIP(16,4),"^",2),SRMVMT(CNT)=SRMOVE_"^"_SRTYPE_"^"_SRLOC,SRZ="" Q
92 S SRZ=$P(VAIP(16,1),"^")
93 Q
94ADM N SR24 S VAIP("D")=SRZ D IN5^VADPT
95 I 'VAIP(13) S X1=SRZ,X2=1 D C^%DTC S SR24=X,SRDT=$O(^DGPM("APTT1",DFN,SRZ)) Q:'SRDT!(SRDT>SR24) S VAIP("D")=SRDT D IN5^VADPT I 'VAIP(13) S SRZ="" Q
96 I VAIP(13) S SRZ=$P(VAIP(13,1),"^")+.000001
97 Q
98TR S J=I,J=$TR(J,"1234567890.","ABCDEFGHIJP")
99 Q
100GET S X=$T(@J)
101 Q
102END W @IOF D ^SRSKILL
103 Q
104DAH ;;418^Hospital Admission Date
105DAI ;;419^Hospital Discharge Date
106DDJ ;;440^Cardiac Catheterization Date
107PBJE ;;.205^Time Patient In OR
108PBCB ;;.232^Time Patient Out OR
109DGJ ;;470^Date/Time Patient Extubated
110DGA ;;471^Date/Time Discharged from ICU
111DDB ;;442^Employment Status Preoperatively
112DCA ;;431^Resource Data Comments
113DGC ;;473^Homeless
114DGB ;;472^Surg Performed at Non-VA Facility
115EAC ;;513^CT Surgery Consult Date
Note: See TracBrowser for help on using the repository browser.