Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SROAPM

SROAPM.m

Go to the documentation of this file.
  1. SROAPM ;BIR/ADM - PATIENT DEMOGRAPHIC INFO ;05/28/10
  1. ;;3.0;Surgery;**47,81,111,107,100,125,142,160,166,174,175,182,184**;24 Jun 93;Build 35
  1. 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
  1. S SRSOUT=0,SRSUPCPT=1 D ^SROAUTL
  1. START G:SRSOUT END D HDR^SROAUTL
  1. 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)=" "
  1. 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."
  1. 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
  1. I Y=1 D PIMS G START
  1. EDIT S SRR=0 D HDR^SROAUTL K DR S SRQ=0,(DR,SRDR)="413;452;453;454;418;419;420;421;685;247;.011"
  1. 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
  1. K SRZ S SRZ=0 F M=1:1 S I=$P(SRDR,";",M) Q:'I D
  1. .D TR,GET
  1. .S SRZ=SRZ+1,Y=$P(X,";;",2),SRFLD=$P(Y,"^"),(Z,SRZ(SRZ))=$P(Y,"^",2)_"^"_SRFLD,SREXT=SRY(130,SRTN,SRFLD,"E")
  1. .W !,$S($L(SRZ)<2:" "_SRZ,1:SRZ)_". "_$P(Z,"^")_":" D EXT
  1. ;
  1. D DEM^VADPT
  1. ;Find patient's ethnicity and list it on the display
  1. W !,"12. *Patient's Ethnicity:" S SRZ(12)="" D
  1. .I $G(VADM(11)) W ?40,$P(VADM(11,1),U,2)
  1. .I '$G(VADM(11)) W ?40,"UNANSWERED"
  1. ;
  1. ;Find all race entries and place into a string with commas inbetween
  1. S SRORC=0,C=1,SRORACE="",SROLINE="",N=1,SROL=""
  1. F S SRORC=$O(VADM(12,SRORC)) Q:SRORC="" Q:C=11 D
  1. .I $G(VADM(12,SRORC)) S SRORACE(C)=$P(VADM(12,SRORC),U,2)
  1. .I SROLINE'="" S SROLINE=SROLINE_", "_SRORACE(C)
  1. .I SROLINE="" S SROLINE=SRORACE(C)
  1. .S C=C+1
  1. ;
  1. ;Find total length of 'race' string and wrap the text if necessary
  1. I $L(SROLINE)=40!$L(SROLINE)<40 S SROL(N)=SROLINE,SRNUM1=2
  1. I $L(SROLINE)>40 D WRAP
  1. ;
  1. W !,"13. *Patient's Race:" S SRZ(13)=""
  1. I $G(VADM(12)) F D=1:1:SRNUM1-1 D
  1. .W:D=1 ?40,SROL(D)
  1. .W:D'=1 !,?40,SROL(D)
  1. ;
  1. I '$G(VADM(12)) W ?40,"UNANSWERED"
  1. ;
  1. K DA,DIC,DIQ,DR,SRY S (DR,SRDR)="342;342.1",DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="E",DR=SRDR D EN^DIQ1 K DA,DIC,DIQ,DR
  1. S SRZ=13 F M=1:1 S I=$P(SRDR,";",M) Q:'I D
  1. .D TR,GET
  1. .S SRZ=SRZ+1,Y=$P(X,";;",2),SRFLD=$P(Y,"^"),(Z,SRZ(SRZ))=$P(Y,"^",2)_"^"_SRFLD,SREXT=SRY(130,SRTN,SRFLD,"E")
  1. .W !,$S($L(SRZ)<2:" "_SRZ,1:SRZ)_". "_$P(Z,"^")_":" D EXT
  1. K SROL,SROLINE,SRORC,SRORACE,SROLN,SROLN1,SROWRAP,SRNUM1
  1. ;
  1. W !! F K=1:1:80 W "-"
  1. D SEL G:SRR=1 EDIT
  1. S SROERR=SRTN D ^SROERR0
  1. G START
  1. Q
  1. ;
  1. WRAP ;Wrap multiple race entries so that wrapped line
  1. ;does not break in the middle of a word
  1. ;
  1. N SROLNGTH S SROLNGTH=$L(SROLINE),E=40,SROWRAP="",SROLN="",SROLN1="",SROL=""
  1. F I=1:40:SROLNGTH S SROLN(I)=SROWRAP_$E(SROLINE,I,E) D
  1. .F K=40:-1:1 I $E(SROLN(I),K)[" " D Q ;Break lines at space
  1. ..S SROLN1(I)=$E(SROLN(I),1,K-1)
  1. ..S SROWRAP=$E(SROLN(I),K+1,E)
  1. .S E=E+40
  1. ;
  1. S:'$D(SROLN1(I)) SROLN1(I)=SROLN(I),SROWRAP=""
  1. I $L(SROLN1(I))+$L(SROWRAP)>39 S SROLN1(I+1)=SROWRAP ;Last line
  1. I $L(SROLN1(I))+$L(SROWRAP)'>39 S SROLN1(I)=SROLN1(I)_" "_SROWRAP
  1. ;
  1. ;Renumber the SROLN1 array to be in numeric order
  1. S SRNUM=0,SRNUM1=1
  1. F S SRNUM=$O(SROLN1(SRNUM)) Q:SRNUM="" D
  1. .S SROL(SRNUM1)=SROLN1(SRNUM)
  1. .S SRNUM1=SRNUM1+1
  1. Q
  1. ;
  1. EXT I $L(SREXT)<40 W ?40,SREXT W:SRFLD=247 $S(SREXT="":"",SREXT=1:" Day",SREXT=0:" Days",SREXT>1:" Days",1:"") Q
  1. N I,J,X,Y S X=SREXT F D W:$L(X) ! I $L(X)<40!(X'[" ") W ?40,X Q
  1. .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
  1. Q
  1. SEL W !,"Select Patient Demographics Information to Edit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
  1. I (X=12)!(X=13) S SRR=1 W !!,"The Patient's Race and Ethnicity information cannot be updated through the" D Q
  1. .W !,"Surgery package options."
  1. .W !!,"Press RETURN to continue " R X:DTIME
  1. 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
  1. 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
  1. I X="A" S X="1:"_SRZ
  1. I X?1.2N1":"1.2N D RANGE S SRR=1 Q
  1. I $D(SRZ(X)),+X=X S EMILY=X D S SRR=1
  1. .I $$LOCK^SROUTL(SRTN) D ONE,UNLOCK^SROUTL(SRTN)
  1. Q
  1. PIMS ; get update from PIMS records
  1. 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
  1. I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
  1. .W ! D WAIT^DICD D ^SROAPIMS
  1. Q
  1. HELP W @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below.",!!,"NOTE: Items 12 and 13 cannot be updated through the surgery package options."
  1. W !!,"1. Enter 'A' to update items 1 through 11 and item 14.",!!,"2. Enter a number (1-"_SRZ_") to update an individual item. (For example,",!," enter '1' to update "_$P(SRZ(1),"^")_")"
  1. 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.)",!
  1. I $D(SRFLG) W !,"4. Enter 'N' or 'NO' to enter negative response for all items.",!!,"5. Enter '@' to delete information from all items.",!
  1. 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
  1. Q
  1. RANGE ; range of numbers
  1. I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
  1. .S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) D
  1. ..F EMILY=SHEMP:1:CURLEY Q:SRSOUT D ONE
  1. Q
  1. ONE ; edit one item
  1. Q:(EMILY=12!(EMILY=13))
  1. 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
  1. Q
  1. TR S J=I,J=$TR(J,"1234567890.","ABCDEFGHIJP")
  1. Q
  1. GET S X=$T(@J)
  1. Q
  1. END W @IOF D ^SRSKILL
  1. Q
  1. PJAA ;;.011^Hospital Admission Status
  1. BDG ;;247^Length of Postop Hospital Stay
  1. DAC ;;413^Transfer Status
  1. DAG ;;417^Patient's Race
  1. DAH ;;418^Hospital Admission Date/Time
  1. DAI ;;419^Hospital Discharge Date/Time
  1. DBJ ;;420^Admit/Transfer to Surgical Svc.
  1. DBA ;;421^Discharge/Transfer to Chronic Care
  1. FHE ;;685^DC/REL Destination
  1. DEB ;;452^Observation Admission Date/Time
  1. DEC ;;453^Observation Discharge Date/Time
  1. DED ;;454^Observation Treating Specialty
  1. CDB ;;342^Date of Death
  1. CDBPA ;;342.1^30-Day Death