source: FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMRDI.m@ 1751

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1PXRMRDI ; SLC/PKR - Routines to support RDI list building. ;07/27/2006
2 ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
3 ;=========================================================
4APPERR(TYPE) ;Handle errors getting appointment data.
5 N ECODE,NL,TIME,USER
6 S USER=$S($D(ZTQUEUED):DBDUZ,1:DUZ)
7 S TIME=$$NOW^XLFDT
8 S TIME=$$FMTE^XLFDT(TIME)
9 K ^TMP("PXRMXMZ",$J)
10 S ^TMP("PXRMXMZ",$J,1,0)="The "_TYPE_" requested by "_$$GET1^DIQ(200,USER,.01)_" on "
11 S ^TMP("PXRMXMZ",$J,2,0)=TIME_" requires appointment data which could not be obtained"
12 S ^TMP("PXRMXMZ",$J,3,0)="from the Scheduling database due to the following error(s):"
13 S ECODE=0,NL=3
14 F S ECODE=$O(^TMP($J,"SDAMA301",ECODE)) Q:ECODE="" D
15 . S NL=NL+1,^TMP("PXRMXMZ",$J,NL,0)=" "_^TMP($J,"SDAMA301",ECODE)
16 D SEND^PXRMMSG("Scheduling database error(s)",1)
17 K ^TMP($J,"SDAMA301")
18 Q
19 ;
20 ;=========================================================
21APPL(NGET,BDT,EDT,PLIST,PARAM) ;List type computed finding that returns
22 ;a list of patients with appointments in the date range BDT to EDT.
23 N FILTER,FLDS,RESULT
24 K ^TMP($J,PLIST),^TMP($J,"SDAMA301")
25 I BDT<2000000 S BDT=2000101
26 S FILTER(1)=BDT_";"_EDT
27 S FILTER("SORT")="P"
28 ;Set the rest of the filter nodes.
29 D SFILTER(PARAM,.FILTER,.FLDS)
30 ;DBIA #4433
31 S RESULT=$$SDAPI^SDAMA301(.FILTER)
32 I RESULT=-1 D APPERR("Patient List build") Q
33 N COUNT,DATE,DFN,DONE,ITEM
34 S DFN=""
35 F S DFN=$O(^TMP($J,"SDAMA301",DFN)) Q:DFN="" D
36 . S (COUNT,DONE)=0,DATE=""
37 . F S DATE=$O(^TMP($J,"SDAMA301",DFN,DATE),-1) Q:(DONE)!(DATE="") D
38 .. S COUNT=COUNT+1
39 .. S ITEM=$P(^TMP($J,"SDAMA301",DFN,DATE),U,2)
40 .. S ^TMP($J,PLIST,DFN,COUNT)=U_DATE_U_44_U_$P(ITEM,";",1)_U_$P(ITEM,";",2)
41 .. I COUNT=NGET S DONE=1
42 K ^TMP($J,"SDAMA301"),^TMP($J,"HLOCL")
43 Q
44 ;
45 ;=========================================================
46PAPPL(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,VALUE,TEXT) ;Multiple type computed
47 ;finding that returns a list appointments for a patient.
48 N FILTER,FLDS,PARAM,RESULT
49 K ^TMP($J,"SDAMA301")
50 S PARAM=TEST K TEST
51 S NFOUND=0
52 I BDT<2000000 S BDT=2000101
53 S FILTER(1)=BDT_";"_EDT
54 S FILTER(4)=DFN
55 S FILTER("SORT")="P"
56 ;Set the rest of the filter nodes.
57 D SFILTER(PARAM,.FILTER,.FLDS)
58 ;DBIA #4433
59 S RESULT=$$SDAPI^SDAMA301(.FILTER)
60 I RESULT=-1 D APPERR("Computed finding evaluation") Q
61 N APPDATE,IND,DONE,IND,ITEM
62 S APPDATE="",DONE=0
63 F S APPDATE=$O(^TMP($J,"SDAMA301",DFN,APPDATE),-1) Q:(DONE)!(APPDATE="") D
64 . S NFOUND=NFOUND+1
65 . S TEST(NFOUND)=1,DATE(NFOUND)=APPDATE
66 . S VALUE(NFOUND,"VALUE")=^TMP($J,"SDAMA301",DFN,APPDATE)
67 . I NFOUND=NGET S DONE=1
68 K ^TMP($J,"SDAMA301"),^TMP($J,"HLOCL")
69 Q
70 ;
71 ;=========================================================
72SFILTER(PARAM,FILTER,FLDS) ;Parse the PARMETER and set the appropriate
73 ;fields.
74 N IND,LL,P1,P2,STATUS,TEMP
75 S (FLDS,LL,STATUS)=""
76 F IND=1:1:$L(PARAM,U) D
77 . S TEMP=$P(PARAM,U,IND)
78 . S P1=$P(TEMP,":",1),P2=$P(TEMP,":",2)
79 . I P1="FLDS" S FLDS=$TR(P2,",",";") Q
80 . I P1="LL" S LL=P2 Q
81 . I P1="STATUS" S STATUS=$TR(P2,",",";") Q
82 S FILTER("FLDS")=$S(FLDS="":"1;2",1:FLDS)
83 S FILTER(3)=$S(STATUS="":"I;R",1:STATUS)
84 I LL="" Q
85 S LL=$O(^PXRMD(810.9,"B",LL,""))
86 D LOCLIST^PXRMLOCF(LL,"HLOCL")
87 S FILTER(2)="^TMP($J,""HLOCL"","
88 Q
89 ;
90 ;=========================================================
91TFL(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,VALUE,TEXT) ;Multiple type computed
92 ;finding for a patient's treating facility list.
93 N DONE,IND,NOW,SDIR,TDATE,TFL,TFLD
94 S NFOUND=0
95 ;DBIA #2990
96 D TFL^VAFCTFU1(.TFL,DFN)
97 I +TFL(1)=-1 Q
98 S NOW=$$NOW^PXRMDATE
99 S (DONE,IND)=0
100 F S IND=$O(TFL(IND)) Q:(DONE)!(IND="") D
101 . S NFOUND=NFOUND+1
102 . S TEST(NFOUND)=1,DATE(NFOUND)=NOW
103 . S VALUE(NFOUND,"VALUE")=TFL(IND)
104 . I NFOUND=NGET S DONE=1 Q
105 F IND=1:1:NFOUND S VALUE(IND,"NUM FACILITIES")=NFOUND
106 Q
107 ;
Note: See TracBrowser for help on using the repository browser.