source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCMSPX2.m@ 808

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1SCMSPX2 ;ALB/JRP - EXPORTED ROUTINE SDM WITHOUT PATCH 41 APPLIED TO IT;03-JUL-96
2 ;;5.3;Scheduling;**44**;Aug 13, 1993
3SDM ;SF/GFT,ALB/BOK - MAKE AN APPOINTMENT ; 14 SEP 84 9:38 am
4 ;;5.3;Scheduling;**15,32,38,44**;Aug 13, 1993
5 ; If defined...
6 ; appt mgt vars: SDFN := DFN of patient....will not be asked
7 ; SDCLN := ifn of clinic.....will not be asked
8 ; SDAMERR := returned if error occurs
9 ;
10 S:'$D(SDMM) SDMM=0
11EN1 L W !! D I^SDUTL I '$D(SDCLN) S DIC="^SC(",DIC(0)="AEMZQ",DIC("A")="Select CLINIC: ",DIC("S")="I $P(^(0),U,3)=""C""" D ^DIC K DIC G:Y<0!'$D(^("SL")) END
12 K SDAPTYP,SDIN,SDRE,SDXXX S:$D(SDCLN) Y=+SDCLN
13 I $D(^SC(+Y,"I")) S SDIN=+^("I"),SDRE=+$P(^("I"),U,2)
14 K SDINA I $D(SDIN),SDIN S SDINA=SDIN K SDIN
15 I $D(SD),$D(SC),+Y'=+SC K SD
16 S SL=^SC(+Y,"SL"),X=$P(SL,U,3),STARTDAY=$S(X:X,1:8),SC=Y,SB=STARTDAY-1/100,X=$P(SL,U,6),HSI=$S(X=1:X,X:X,1:4),SI=$S(X="":4,X<3:4,X:X,1:4),STR="#@!$* XXWVUTSRQPONMLKJIHGFEDCBA0123456789jklmnopqrstuvwxyz",SDDIF=$S(HSI<3:8/HSI,1:2) K Y
17 I $D(^SC(+SC,"SDPROT")),$P(^("SDPROT"),U)="Y",'$D(^SC(+SC,"SDPRIV",DUZ)) W !,*7,"Access to this clinic is prohibited!!",!,"Only users with a special code may access this clinic",*7 S:$D(SDCLN) SDAMERR="" G END:$D(SDCLN),SDM
18 D CS^SDM1A S SDW="",WY="Y"
19 I '$D(ORACTION),'$D(SDFN) S (DIC,DIE)="^DPT(",DIC(0)="AQZME" D ^DIC S DFN=+Y G:Y<0 END:$D(SDCLN),^SDM0:X[U,SDM
20 S:$D(SDFN) DFN=SDFN
21 I $D(^DPT(DFN,.35)),$P(^(.35),U)]"" W !?10,*7,"PATIENT HAS DIED." S:$D(SDFN) SDAMERR="" G END:$D(SDFN),SDM
22 D ^SDM4 I $S('$D(COLLAT):1,COLLAT=7:1,1:0) G:$D(SDCLN) END G SDM
23 K SDXXX D EN G END:$D(SDCLN),SDM
24EN K SDMLT1 W:$P(VAEL(9),U,2)]"" !!,?15,"MEANS TEST STATUS: ",$P(VAEL(9),U,2),!
25 S Y=DFN,Y(0)=^DPT(DFN,0) I VADM(7)]"" W !?3,*7,VADM(7)
26 I $D(^DGS(41.1,"B",DFN)) F I=0:0 S I=$N(^DGS(41.1,"B",DFN,I)) Q:I'>0 I $P(^DGS(41.1,I,0),U,2)'<DT&('$P(^DGS(41.1,I,0),U,13)) W !,"SCHEDULED FOR ADMISSION ON " S Y=$P(^(0),U,2) D DT^SDM0
27PEND W:$N(^DPT(DFN,"S",DT))'>DT !,"NO PENDING APPOINTMENTS" I $N(^DPT(DFN,"S",DT))>DT R !,"DISPLAY PENDING APPOINTMENTS: NO//",X:DTIME S:X="^" SDMLT1=1 S X=$$UP^XLFSTR(X) G END:X["^",HELP:"YN"'[X I X["Y" W $P("YES",X,2)
28 I F Y=DT:0 S Y=$N(^DPT(DFN,"S",Y)) Q:Y'>0 I "I"[$P(^(Y,0),U,2) D CHKSO W:$X>9 ! W ?11 D DT^SDM0 W ?32 S DA=+SSC W SDLN,$S($D(^SC(DA,0)):$P(^(0),U),1:"DELETED CLINIC "),COV," ",SDAT16
29 S DA=DFN,DR=$S($P(^DPT(DFN,0),U,6)="":.06,1:"")
30 I DR]"" S DIE="^DPT(" D ^DIE K DR
31 S DA=DFN,DR=$S('$D(^DPT(DA,.11)):"[SDM1]",$P(^(.11),U)="":"[SDM1]",1:"")
32 S DIE="^DPT(" D ^DIE:DR]"" K DR Q:$D(SDXXX)
33E S Y=$P(SL,U,5)
34 S SDW="" I $D(^DPT(DFN,.1)) S SDW=^(.1) W !,"NOTE - PATIENT IS NOW IN WARD "_SDW
35 Q:$D(SDXXX)
36EN2 F X=0:0 S X=$N(^DPT(DFN,"DE",X)) Q:'$D(^(X,0)) I ^(0)-SC=0!'(^(0)-Y) F XX=0:0 S XX=$N(^DPT(DFN,"DE",X,1,XX)) Q:XX<1 S SDDIS=$P(^(XX,0),U,3),SDPRCL=Y D WRT S Y=SDPRCL K SDPRCL G ^SDM0:'SDDIS
37 W *7,!?9,"PATIENT NOT ENROLLED IN CLINIC!" S X=$S(VADM(5)["F":"ER",1:"IM") I '$D(^SC(+Y,0)) S Y=+SC
38 N SCP
39 S SCP=Y,Y=$P(^SC(Y,0),U)
40ENR S %="",DTOUT=0 W !?9,"WANT TO ENROLL H"_X_" IN "_Y D YN^DICN I '%,%Y]"" W !,"RESPOND YES (Y) OR NO (N)" G ENR
41 Q:'DTOUT&(%<0) G:(%-1) ASKC S SDY=Y
42GETED R !,?9,"DATE OF ENROLLMENT: NOW// ",X:DTIME Q:X["^" S:X="" X="NOW" S %DT="EXT" D ^%DT G:Y<0 GETED S HEY=Y
43 S DA=DFN,DR="3///`"_+SCP,(DIE,DIC)="^DPT(",DP=2,DR(2,2.001)=".01///`"_+SCP_";1///"_HEY,DR(3,2.011)=".01///"_HEY_";S DIE(""NO^"")="""";1" D ^DIE K DR,DP G ^SDM0:'$D(Y) Q
44 ;
45ASKC S %="" W !,"WANT TO SCHEDULE PATIENT FOR CONSULT" D YN^DICN Q:%<0 I '% W !,"REPLY YES (Y) OR NO (N)" G ASKC
46 Q:(%-1) K DR G ^SDM0
47CHKSO S COV=$S($P(^DPT(DFN,"S",Y,0),U,11)=1:" (COLLATERAL)",1:""),HY=Y,SSC=^(0),SDAT16=$S($D(^SD(409.1,+$P(SSC,U,16),0)):$P(^(0),U),1:"")
48 F SDJ=3,4,5 I $P(^DPT(DFN,"S",HY,0),U,SDJ)]"" S Y=$P(^(0),U,SDJ) W:$X>9 ! W ?10,"*" D DT^SDM0 W ?32,$S(SDJ=3:"LAB",SDJ=4:"XRAY",1:"EKG")
49 S SDLN="" F J=0:0 S J=$N(^SC(+SSC,"S",HY,1,J)) Q:J<0 I $D(^(J,0)),+^(0)=DFN S SDLN="("_$P(^(0),U,2)_" MINUTES) " Q
50 S Y=HY Q
51END D KVAR^VADPT K SDAPTYP,SDSC,%,%DT,ASKC,COV,DA,DIC,DIE,DP,DR,HEY,HSI,HY,J,SB,SC,SDDIF,SDJ,SDLN,SD17,SDMAX,SDU,SDYC,SI,SL,SSC,STARTDAY,STR
52 K WY,X,XX,Y,S,SD,SDAP16,SDEDT,SDTY,SM,SS,ST,ARG,CCX,CCXN,HX,I,PXR,SDINA,SDW,COLLAT,SDDIS I $D(SDMM) K:'SDMM SDMM
53 I '$D(SDMLT) K SDMLT1
54 Q
55OERR S XQORQUIT=1 Q:'$D(ORVP) S DFN=+ORVP G SDM
56HELP W !,"YES - TO DISPLAY FUTURE APPOINTMENTS",!,"NO - FUTURE APPOINTMENTS NOT DISPLAYED" G PEND
57WRT W !,$S('SDDIS:"CURRENT ",1:"PREVIOUS "),"ENROLLMENT: ",$S($P(^DPT(DFN,"DE",X,1,XX,0),U,2)["O":"OPT",1:"AC") I SDDIS W ?41,"DISCHARGED FROM CLINIC: " S Y=SDDIS D DT^DIQ
58 Q
Note: See TracBrowser for help on using the repository browser.