source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORLA1.m@ 1141

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1ORLA1 ; slc/dcm,cla - Order activity alerts ;3/10/05 15:10
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**11,82,215**;Dec 17, 1997
3 ;
4 ; DBIA 3869 GETPLIST^SDAMA202 ^TMP($J,"SDAMA202")
5 ;
6BUILD ;
7 D PARAM^ORU1
8 K:$D(ORDEF) ^XUTL("OR",$J,"ORLP"),^("ORW"),^("ORU"),^("ORV")
9B1 ;
10 D PREF
11 I $D(ORDEF),ORDEF="P"!(ORDEF="T"),$D(^OR(100.21,+$G(ORPRIM),0)) S X=$P(^(0),"^")_" patient list",ORY=ORPRIM_"^"_$P(^(0),"^"),ORTITLE=$S($D(^XUTL("OR",$J,"ORLP",0)):$S('$P(^(0),"^",2):"PATIENT LIST",1:X),1:X),ORCOLW=40-($L(ORTITLE)\2) D P1 Q
12 I $D(ORDEF),ORDEF="W",ORWARD,$D(^DIC(42,ORWARD,0)) S X=$P(^(0),"^")_" ward list",ORY=ORWARD_"^"_$P(^(0),"^"),ORTITLE=$S($D(^XUTL("OR",$J,"ORLP",0)):$S('$P(^(0),"^",2):"PATIENT LIST",1:X),1:X),ORCOLW=40-($L(ORTITLE)\2) D W1 Q
13 I $D(ORDEF),ORDEF="C",ORCLIN,$D(^SC(ORCLIN,0)) S X=$P(^(0),"^")_" clinic list",ORY=ORCLIN_"^"_$P(^(0),"^"),ORTITLE=$S($D(^XUTL("OR",$J,"ORLP",0)):$S('$P(^(0),"^",2):"PATIENT LIST",1:X),1:X),ORCOLW=40-($L(ORTITLE)\2) D C0 Q
14 I $D(ORDEF),ORDEF="V",ORPROV,$D(^VA(200,ORPROV,0)) S X=$P(^(0),"^")_" patient list",ORY=ORPROV_"^"_$P(^(0),"^"),ORTITLE=$S($D(^XUTL("OR",$J,"ORLP",0)):$S('$P(^(0),"^",2):"PATIENT LIST",1:X),1:X),ORCOLW=40-($L(ORTITLE)\2) D V1^ORLA11 Q
15 I $D(ORDEF),ORDEF="S",ORSPEC,$D(^DIC(45.7,ORSPEC,0)) S X=$P(^(0),"^")_" specialty list",ORY=ORSPEC_"^"_$P(^(0),"^"),ORTITLE=$S($D(^XUTL("OR",$J,"ORLP",0)):$S('$P(^(0),"^",2):"PATIENT LIST",1:X),1:X),ORCOLW=40-($L(ORTITLE)\2) D S1^ORLA11 Q
16 Q
17P1 ; Loading the Primary Patient List
18 S (ORCNT,J)=0
19 F S J=$O(^OR(100.21,+ORY,10,J)) Q:J<1 S ORX=^(J,0),ORVP=$P(ORX,"^") D PR1(ORVP,OROPREF)
20 D PR2(OROPREF,ORTITLE,ORDEF)
21 K ORI,ORJ,ORURMBD,ORUVP,ORVP,ORX,ORY
22 Q
23W1 ;
24 W !,"Loading Ward Patient List..."
25 S (ORCNT,ORJ)=0
26 F S ORJ=$O(^DPT("CN",$P(ORY,"^",2),ORJ)) Q:ORJ<1 S ORX="",ORVP=ORJ_";DPT(" D PR1(ORVP,OROPREF)
27 D PR2(OROPREF,ORTITLE,ORDEF)
28 K ORI,ORJ,ORURMBD,ORUVP,ORVP,ORX,ORY
29 Q
30C0 ; DBIA 3869
31 ; SLC/PKS - 5/15/2000: Next line added to fix a reported problem:
32 N %DT,ORI,ORERR
33 W:$L(ORCSTRT) !,"Starting date: "
34 S %DT=$S($L(ORCSTRT):"E",1:"AE"),X=$S($L(ORCSTRT):ORCSTRT,1:"")
35 S:'$L(ORCSTRT) %DT("A")="Patient Appointment STARTING DATE: ",%DT("B")="T"
36 D ^%DT
37 I Y<0 S OREND=1 Q
38 S ORCSTRT=Y
39 D DD^%DT
40 W:$L(ORCEND) !,"Ending date: "
41 S %DT=$S($L(ORCEND):"E",1:"AE"),X=$S($L(ORCEND):ORCEND,1:"")
42 S:'$L(ORCEND) %DT("A")="Patient Appointment ENDING DATE: ",%DT("B")=Y
43 D ^%DT
44 I Y<0 S OREND=1 Q
45 S ORCEND=$P(Y,".")_.5
46 I ORCEND<ORCSTRT S ORCTMP=ORCEND,ORCEND=ORCSTRT,ORCSTRT=ORCTMP K ORCTMP
47 W !,"Loading Clinic Patient List..."
48 K ^TMP($J,"SDAMA202","GETPLIST")
49 S ORCNT=0
50 D GETPLIST^SDAMA202(+ORCLIN,"1;4","",ORCSTRT,ORCEND) ;DBIA 3869
51 S ORERR=$$CLINERR^ORQRY01
52 I $L(ORERR) W !,ORERR Q
53 S ORI=0
54 F S ORI=$O(^TMP($J,"SDAMA202","GETPLIST",ORI)) Q:ORI<1 D ;DBIA 3869
55 . S ORCLDT=+$G(^TMP($J,"SDAMA202","GETPLIST",ORI,1))
56 . S DFN=+$G(^TMP($J,"SDAMA202","GETPLIST",ORI,4))
57 . I DFN,ORCLDT S ORX="" D C1
58 K ORCLDT,ORI,ORURMBD,ORUVP,ORVP,ORX,ORY
59 K ^TMP($J,"SDAMA202","GETPLIST")
60 I '$L($O(^XUTL("OR",$J,"ORLP",0))) W $C(7),!,"No patients found" D READ^ORUTL Q
61 H 1
62 Q
63END ;
64 G END^ORLA11
65 Q
66C1 ;
67 S ORVP=DFN_";DPT("
68 D PR1(ORVP,OROPREF,ORCLDT)
69 I '$D(^XUTL("OR",$J,"ORLP",ORUVP)),$D(^DPT(DFN,0)) S ORCNT=ORCNT+1,ORUPNM=$P(^(0),"^"),ORUSSN=$P(^(0),"^",9) S ^XUTL("OR",$J,"ORLP",ORUVP,0)=ORUPNM_"^"_ORUSSN_"^"_ORVP
70 D PR2(OROPREF,ORTITLE,ORDEF)
71 Q
72PR1(ORVP,OROPREF,ORCLDT) ;from ORLA11
73 Q:'$G(ORVP)
74 I '$D(^DPT(+ORVP)) W !,"Data inconsistency found, no entry for DFN="_+ORVP Q
75 S ORUVP=+ORVP
76 Q:$D(^XUTL("OR",$J,"ORLP",ORUVP))
77 N DFN,RB,VAIN,VADM,X
78 S ORCNT=ORCNT+1
79 S DFN=ORUVP,X=$G(^DPT(ORUVP,0)),ORUPNM=$P(X,U),ORUSSN=$P(X,U,9)
80 D INP^VADPT
81 S ORURMBD=VAIN(5)
82 I ORURMBD']"" S ORURMBD="~"
83 S ORUPNM=$S($L(ORUPNM)'>15:ORUPNM,1:$$NAME^ORU(ORUPNM,"LAST, FI MI"))
84 S:$L(ORUPNM)<16 ORUPNM=ORUPNM_$E(" ",$L(ORUPNM),16)
85 S RB=ORURMBD,ORURMBD=ORURMBD_$E(" ",$L(ORURMBD),8)
86 S ^XUTL("OR",$J,"ORLP",ORUVP,0)=ORUPNM_"^"_ORUSSN_"^"_ORVP_"^"_$P(ORX,"^",2)_"^"_ORURMBD
87 I $D(ORCLDT),ORCLDT S X=ORCLDT D LTIM S ^(0)=^(0)_"^"_X
88 S ^XUTL("OR",$J,"ORLP","B",ORUPNM,ORUVP)=""
89 S:$D(ORCT) ORCT=ORCT+1
90 D KVAR^VADPT
91 ; terminal digit x-ref
92 I OROPREF="T" S S=ORUSSN,S="A"_$E(S,8,9)_$E(S,6,7)_$E(S,1,5)_$E(S,10,11),^XUTL("OR",$J,"ORLP","C",S,ORUVP)="" K S Q
93 ; room bed x-ref
94 I OROPREF="R" S ^XUTL("OR",$J,"ORLP","D",RB,ORUVP)="" Q
95 ; clinic date x-ref
96 I $G(ORCLDT) S ^XUTL("OR",$J,"ORLP","D",ORCLDT,ORUVP)=""
97 Q
98PR2(OROPREF,ORTITLE,ORDEF) ;
99 S:$L($O(^XUTL("OR",$J,"ORLP",0))) ^(0)=$S($L($G(ORTITLE)):ORTITLE,1:"Current PATIENT List")_"^1^"_$S(OROPREF="T":"C",OROPREF="R":"D",OROPREF="C"&($G(ORDEF)="C"):"D",1:"B")_"^"_ORCNT
100 Q
101LTIM ;
102 Q:'$L(X)
103 S X=$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)_$S(X[".":" "_$E(X_"0",9,10)_":"_$E(X_"000",11,12),1:"")
104 Q
105KIL ;
106 Q:'$D(^XUTL("OR",$J,"ORLP"))
107 W !,"The current patient list will be cleared."
108 K ^XUTL("OR",$J,"ORLP"),^("ORV"),^("ORU"),^("ORW")
109 Q
110PREF ;Get a preference
111 N ORSRV
112 S ORSRV=$P($G(^VA(200,DUZ,5)),"^"),OROPREF=$$GET^XPAR("USR^SRV.`"_$G(ORSRV)_"^DIV^SYS^PKG","ORLP DEFAULT LIST ORDER",1,"I")
113 Q
Note: See TracBrowser for help on using the repository browser.