source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCMSPX1.m@ 1267

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

initial load of FOIAVistA 6/30/08 version

File size: 5.3 KB
Line 
1SCMSPX1 ;ALB/JRP - EXPORTED ROUTINE SDM WITH 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;**5,32,38,41,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 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 ;Prompt for RACE if no value is currently on file
30 S DA=DFN,DR=$S($P(^DPT(DFN,0),U,6)="":.06,1:"")
31 I DR]"" S DIE="^DPT(" D ^DIE K DR
32 S DA=DFN,DR=$S('$D(^DPT(DA,.11)):"[SDM1]",$P(^(.11),U)="":"[SDM1]",1:"")
33 S DIE="^DPT(" D ^DIE:DR]"" K DR Q:$D(SDXXX)
34E S Y=$P(SL,U,5)
35 S SDW="" I $D(^DPT(DFN,.1)) S SDW=^(.1) W !,"NOTE - PATIENT IS NOW IN WARD "_SDW
36 Q:$D(SDXXX)
37EN2 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
38 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
39 S Y=$P(^SC(Y,0),U)
40 ; SCRESTA = Array of pt's teams causing restricted consults
41 N SCRESTA
42 S SCREST=$$RESTPT^SCAPMCU4(DFN,DT,"SCRESTA")
43 IF SCREST D
44 .N SCTM
45 . S SCCLNM=Y
46 . W !,?5,"Patient has restricted consults due to team assignment(s):"
47 .S SCTM=0
48 .F S SCTM=$O(SCRESTA(SCTM)) Q:'SCTM W !,?10,SCRESTA(SCTM)
49 IF SCREST&'$G(SCOKCONS) D Q
50 .W !,?5,"This patient may only be given appointments and enrolled in clinics via"
51 .W !,?15,"Make Consult Appointment Option, and"
52 .W !,?15,"Edit Clinic Enrollment Data option"
53ENR 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
54 Q:'DTOUT&(%<0) G:(%-1) ASKC S SDY=Y
55GETED D BEFORE^SCMCEV3(DFN)
56 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
57 S DA=DFN,DR="3///"_SDY,(DIE,DIC)="^DPT(",DP=2,DR(2,2.001)=".01///"_SDY_";1///"_HEY,DR(3,2.011)=".01///"_HEY_";S DIE(""NO^"")="""";1" D ^DIE
58 D MAIL^SCMCCON(DFN,.SCCLNM,1,DT,"SCRESTA")
59 N TMPY
60 I $D(Y) S TMPY=Y
61 K DR,DP,SCCLNM,SCREST
62 D AFTER^SCMCEV3(DFN),INVOKE^SCMCEV3(DFN)
63 I $D(TMPY) S Y=TMPY
64 I '$D(TMPY) K Y
65 K TMPY
66 G ^SDM0:'$D(Y)
67 Q
68 ;
69ASKC S %="" W !,"WANT TO SCHEDULE PATIENT FOR CONSULT" D YN^DICN Q:%<0 I '% W !,"REPLY YES (Y) OR NO (N)" G ASKC
70 Q:(%-1) D:$G(SCREST) MAIL^SCMCCON(DFN,.SCCLNM,2,DT,"SCRESTA") K DR,SCREST,SCCLNM G ^SDM0
71CHKSO 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:"")
72 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")
73 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
74 S Y=HY Q
75END 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
76 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
77 I '$D(SDMLT) K SDMLT1
78 Q
79OERR S XQORQUIT=1 Q:'$D(ORVP) S DFN=+ORVP G SDM
80HELP W !,"YES - TO DISPLAY FUTURE APPOINTMENTS",!,"NO - FUTURE APPOINTMENTS NOT DISPLAYED" G PEND
81WRT 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
82 Q
Note: See TracBrowser for help on using the repository browser.