source: FOIAVistA/tag/r/SURGERY-SR/SROAPM.m@ 1251

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

WorldVistAEHR overlayed on FOIAVistA

File size: 5.9 KB
Line 
1SROAPM ;BIR/ADM - PATIENT DEMOGRAPHIC INFO ;01/23/07
2 ;;3.0; Surgery ;**47,81,111,107,100,125,142,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 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",DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="E",DR=SRDR D EN^DIQ1 K DA,DIC,DIQ,DR
43 S SRZ=13,SRZ(13)="Date of Death^342",SREXT=SRY(130,SRTN,342,"E")
44 W !,"13. Date/Time of Death:",?40,SREXT
45 K SROL,SROLINE,SRORC,SRORACE,SROLN,SROLN1,SROWRAP,SRNUM1
46 ;
47 W !! F K=1:1:80 W "-"
48 D SEL G:SRR=1 EDIT
49 S SROERR=SRTN D ^SROERR0
50 G START
51 Q
52 ;
53WRAP ;Wrap multiple race entries so that wrapped line
54 ;does not break in the middle of a word
55 ;
56 N SROLNGTH S SROLNGTH=$L(SROLINE),E=40,SROWRAP="",SROLN="",SROLN1="",SROL=""
57 F I=1:40:SROLNGTH S SROLN(I)=SROWRAP_$E(SROLINE,I,E) D
58 .F K=40:-1:1 I $E(SROLN(I),K)[" " D Q ;Break lines at space
59 ..S SROLN1(I)=$E(SROLN(I),1,K-1)
60 ..S SROWRAP=$E(SROLN(I),K+1,E)
61 .S E=E+40
62 ;
63 S:'$D(SROLN1(I)) SROLN1(I)=SROLN(I),SROWRAP=""
64 I $L(SROLN1(I))+$L(SROWRAP)>39 S SROLN1(I+1)=SROWRAP ;Last line
65 I $L(SROLN1(I))+$L(SROWRAP)'>39 S SROLN1(I)=SROLN1(I)_" "_SROWRAP
66 ;
67 ;Renumber the SROLN1 array to be in numeric order
68 S SRNUM=0,SRNUM1=1
69 F S SRNUM=$O(SROLN1(SRNUM)) Q:SRNUM="" D
70 .S SROL(SRNUM1)=SROLN1(SRNUM)
71 .S SRNUM1=SRNUM1+1
72 Q
73 ;
74EXT I $L(SREXT)<40 W ?40,SREXT W:SRFLD=247 $S(SREXT="":"",SREXT=1:" Day",SREXT=0:" Days",SREXT>1:" Days",1:"") Q
75 N I,J,X,Y S X=SREXT F D W:$L(X) ! I $L(X)<40!(X'[" ") W ?40,X Q
76 .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
77 Q
78SEL W !!,"Select number of item to edit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
79 I (X=11)!(X=12) S SRR=1 W !!,"The Patient's Race and Ethnicity information cannot be updated through the" D Q
80 .W !,"Surgery package options."
81 .W !!,"Press RETURN to continue " R X:DTIME
82 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
83 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
84 I X="A" S X="1:"_SRZ
85 I X?1.2N1":"1.2N D RANGE S SRR=1 Q
86 I $D(SRZ(X)),+X=X S EMILY=X D S SRR=1
87 .I $$LOCK^SROUTL(SRTN) D ONE,UNLOCK^SROUTL(SRTN)
88 Q
89PIMS ; get update from PIMS records
90 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
91 I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
92 .W ! D WAIT^DICD D ^SROAPIMS
93 Q
94HELP 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."
95 W !!,"1. Enter 'A' to update items 1 through 10 and item 13.",!!,"2. Enter a number (1-"_SRZ_") to update an individual item. (For example,",!," enter '1' to update "_$P(SRZ(1),"^")_")"
96 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.)",!
97 I $D(SRFLG) W !,"4. Enter 'N' or 'NO' to enter negative response for all items.",!!,"5. Enter '@' to delete information from all items.",!
98PRESS 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
99 Q
100RANGE ; range of numbers
101 I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
102 .S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) F EMILY=SHEMP:1:10,13 Q:SRSOUT D ONE
103 Q
104ONE ; edit one item
105 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
106 Q
107TR S J=I,J=$TR(J,"1234567890.","ABCDEFGHIJP")
108 Q
109GET S X=$T(@J)
110 Q
111END W @IOF D ^SRSKILL
112 Q
113PJAA ;;.011^In/Out-Patient Status
114BDG ;;247^Length of Postop Hospital Stay
115CDB ;;342^Date of Death
116DAC ;;413^Transfer Status
117DAG ;;417^Patient's Race
118DAH ;;418^Hospital Admission Date/Time
119DAI ;;419^Hospital Discharge Date/Time
120DBJ ;;420^Admit/Transfer to Surgical Svc.
121DBA ;;421^Discharge/Transfer to Chronic Care
122DEB ;;452^Observation Admission Date/Time
123DEC ;;453^Observation Discharge Date/Time
124DED ;;454^Observation Treating Specialty
Note: See TracBrowser for help on using the repository browser.