source: FOIAVistA/trunk/r/SURGERY-SR/SROAPM.m@ 1611

Last change on this file since 1611 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.5 KB
Line 
1SROAPM ;BIR/ADM - PATIENT DEMOGRAPHIC INFO ;03/03/08
2 ;;3.0; Surgery ;**47,81,111,107,100,125,142,160,166**;24 Jun 93;Build 6
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 S SRSOUT=0,SRSUPCPT=1 D ^SROAUTL
5START G:SRSOUT END D HDR^SROAUTL
6 S DIR("A",1)="Enter/Edit Patient Demographic Information",DIR("A",2)=" ",DIR("A",3)="1. Capture Information from PIMS Records",DIR("A",4)="2. Enter, Edit, or Review Information",DIR("A",5)=" "
7 S DIR("?",1)="Enter '1' if you want to capture patient movement information from PIMS",DIR("?",2)="records. Enter '2' if you want to enter, edit, or review patient",DIR("?")="movement and other information on this screen."
8 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
9 I Y=1 D PIMS G START
10EDIT S SRR=0 D HDR^SROAUTL K DR S SRQ=0,(DR,SRDR)="413;452;453;454;418;419;420;421;247;.011"
11 K DA,DIC,DIQ,SRY S DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="E",DR=SRDR D EN^DIQ1 K DA,DIC,DIQ,DR
12 K SRZ S SRZ=0 F M=1:1 S I=$P(SRDR,";",M) Q:'I D
13 .D TR,GET
14 .S SRZ=SRZ+1,Y=$P(X,";;",2),SRFLD=$P(Y,"^"),(Z,SRZ(SRZ))=$P(Y,"^",2)_"^"_SRFLD,SREXT=SRY(130,SRTN,SRFLD,"E")
15 .W !,$S($L(SRZ)<2:" "_SRZ,1:SRZ)_". "_$P(Z,"^")_":" D EXT
16 ;
17 D DEM^VADPT
18 ;Find patient's ethnicity and list it on the display
19 W !,"11. Patient's Ethnicity:" S SRZ(11)="" D
20 .I $G(VADM(11)) W ?40,$P(VADM(11,1),U,2)
21 .I '$G(VADM(11)) W ?40,"UNANSWERED"
22 ;
23 ;Find all race entries and place into a string with commas inbetween
24 S SRORC=0,C=1,SRORACE="",SROLINE="",N=1,SROL=""
25 F S SRORC=$O(VADM(12,SRORC)) Q:SRORC="" Q:C=11 D
26 .I $G(VADM(12,SRORC)) S SRORACE(C)=$P(VADM(12,SRORC),U,2)
27 .I SROLINE'="" S SROLINE=SROLINE_", "_SRORACE(C)
28 .I SROLINE="" S SROLINE=SRORACE(C)
29 .S C=C+1
30 ;
31 ;Find total length of 'race' string and wrap the text if necessary
32 I $L(SROLINE)=40!$L(SROLINE)<40 S SROL(N)=SROLINE,SRNUM1=2
33 I $L(SROLINE)>40 D WRAP
34 ;
35 W !,"12. Patient's Race:" S SRZ(12)=""
36 I $G(VADM(12)) F D=1:1:SRNUM1-1 D
37 .W:D=1 ?40,SROL(D)
38 .W:D'=1 !,?40,SROL(D)
39 ;
40 I '$G(VADM(12)) W ?40,"UNANSWERED"
41 ;
42 K DA,DIC,DIQ,DR,SRY S (DR,SRDR)="342;516;513",DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="E",DR=SRDR D EN^DIQ1 K DA,DIC,DIQ,DR
43 S SRZ=12 F M=1:1 S I=$P(SRDR,";",M) Q:'I D
44 .D TR,GET
45 .S SRZ=SRZ+1,Y=$P(X,";;",2),SRFLD=$P(Y,"^"),(Z,SRZ(SRZ))=$P(Y,"^",2)_"^"_SRFLD,SREXT=SRY(130,SRTN,SRFLD,"E")
46 .W !,$S($L(SRZ)<2:" "_SRZ,1:SRZ)_". "_$P(Z,"^")_":" D EXT
47 ;S SRZ=15,SRZ(13)="Date of Death^342",SREXT=SRY(130,SRTN,342,"E") W !,"13. Date/Time of Death:",?40,SREXT
48 ;S SRZ(14)="Surgery Consult Date^513",SREXT=SRY(130,SRTN,513,"E") W !,"14. Surgery Consult Date:",?40,SREXT
49 ;S SRZ(15)="Date Surgery Consult Requested^516",SREXT=SRY(130,SRTN,516,"E") W !,"15. Date Surgery Consult Requested:",?40,SREXT
50 K SROL,SROLINE,SRORC,SRORACE,SROLN,SROLN1,SROWRAP,SRNUM1
51 ;
52 W !! F K=1:1:80 W "-"
53 D SEL G:SRR=1 EDIT
54 S SROERR=SRTN D ^SROERR0
55 G START
56 Q
57 ;
58WRAP ;Wrap multiple race entries so that wrapped line
59 ;does not break in the middle of a word
60 ;
61 N SROLNGTH S SROLNGTH=$L(SROLINE),E=40,SROWRAP="",SROLN="",SROLN1="",SROL=""
62 F I=1:40:SROLNGTH S SROLN(I)=SROWRAP_$E(SROLINE,I,E) D
63 .F K=40:-1:1 I $E(SROLN(I),K)[" " D Q ;Break lines at space
64 ..S SROLN1(I)=$E(SROLN(I),1,K-1)
65 ..S SROWRAP=$E(SROLN(I),K+1,E)
66 .S E=E+40
67 ;
68 S:'$D(SROLN1(I)) SROLN1(I)=SROLN(I),SROWRAP=""
69 I $L(SROLN1(I))+$L(SROWRAP)>39 S SROLN1(I+1)=SROWRAP ;Last line
70 I $L(SROLN1(I))+$L(SROWRAP)'>39 S SROLN1(I)=SROLN1(I)_" "_SROWRAP
71 ;
72 ;Renumber the SROLN1 array to be in numeric order
73 S SRNUM=0,SRNUM1=1
74 F S SRNUM=$O(SROLN1(SRNUM)) Q:SRNUM="" D
75 .S SROL(SRNUM1)=SROLN1(SRNUM)
76 .S SRNUM1=SRNUM1+1
77 Q
78 ;
79EXT I $L(SREXT)<40 W ?40,SREXT W:SRFLD=247 $S(SREXT="":"",SREXT=1:" Day",SREXT=0:" Days",SREXT>1:" Days",1:"") Q
80 N I,J,X,Y S X=SREXT F D W:$L(X) ! I $L(X)<40!(X'[" ") W ?40,X Q
81 .F I=0:1:38 S J=39-I,Y=$E(X,J) I Y=" " W ?40,$E(X,1,J-1) S X=$E(X,J+1,$L(X)) Q
82 Q
83SEL W !!,"Select Patient Demographics Information to Edit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
84 I (X=11)!(X=12) S SRR=1 W !!,"The Patient's Race and Ethnicity information cannot be updated through the" D Q
85 .W !,"Surgery package options."
86 .W !!,"Press RETURN to continue " R X:DTIME
87 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
88 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
89 I X="A" S X="1:"_SRZ
90 I X?1.2N1":"1.2N D RANGE S SRR=1 Q
91 I $D(SRZ(X)),+X=X S EMILY=X D S SRR=1
92 .I $$LOCK^SROUTL(SRTN) D ONE,UNLOCK^SROUTL(SRTN)
93 Q
94PIMS ; get update from PIMS records
95 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
96 I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
97 .W ! D WAIT^DICD D ^SROAPIMS
98 Q
99HELP W @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below.",!!,"NOTE: Items 11 and 12 cannot be updated through the surgery package options."
100 W !!,"1. Enter 'A' to update items 1 through 10 and items 13 through 15.",!!,"2. Enter a number (1-"_SRZ_") to update an individual item. (For example,",!," enter '1' to update "_$P(SRZ(1),"^")_")"
101 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.)",!
102 I $D(SRFLG) W !,"4. Enter 'N' or 'NO' to enter negative response for all items.",!!,"5. Enter '@' to delete information from all items.",!
103PRESS 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
104 Q
105RANGE ; range of numbers
106 I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
107 .S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) D
108 ..I SHEMP<13 F EMILY=SHEMP:1:10,13:1:15 Q:SRSOUT D ONE
109 ..I SHEMP>12 F EMILY=SHEMP:1:15 Q:SRSOUT D ONE
110 Q
111ONE ; edit one item
112 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
113 Q
114TR S J=I,J=$TR(J,"1234567890.","ABCDEFGHIJP")
115 Q
116GET S X=$T(@J)
117 Q
118END W @IOF D ^SRSKILL
119 Q
120PJAA ;;.011^In/Out-Patient Status
121BDG ;;247^Length of Postop Hospital Stay
122CDB ;;342^Date of Death
123DAC ;;413^Transfer Status
124DAG ;;417^Patient's Race
125DAH ;;418^Hospital Admission Date/Time
126DAI ;;419^Hospital Discharge Date/Time
127DBJ ;;420^Admit/Transfer to Surgical Svc.
128DBA ;;421^Discharge/Transfer to Chronic Care
129DEB ;;452^Observation Admission Date/Time
130DEC ;;453^Observation Discharge Date/Time
131DED ;;454^Observation Treating Specialty
132EAC ;;513^Surgery Consult Date
133EAF ;;516^Date Surgery Consult Requested
Note: See TracBrowser for help on using the repository browser.