source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORRHCQ1.m@ 1535

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1ORRHCQ1 ; SLC/SRM - CPRS Query Tools - Utilities ;6/10/03 15:11
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**174,248**;Dec 17, 1997;Build 1
3 ;
4QRYSITR(VAL,ORRITR) ; Do query for the standard Iterator, saving off the sensitive patients
5 ; VAL=PtSearched^RecordsFound^Iterator
6 S VAL=$$SSCREEN($P(ORRITR,";",2))
7 I VAL S VAL=$$PTSCRN^ORRHCQ($P(ORRITR,";",2))
8 I VAL S $P(VAL,U,2)=$$QRYPT^ORRHCQ($P(ORRITR,";",2))
9 S $P(VAL,U,3)=$$NXTITER^ORRHCQ(ORRITR)
10 Q
11 ;
12QSITR(VAL,SITR) ; Do query for the current sensitive patient iterator
13 ; VAL=PtSearched^RecordsFound^Iterator
14 N LEVEL,RET
15 I $G(SITR)="" S SITR=0
16 S SITR=$O(^TMP("ORRHCQ",$J,"DFN","S",SITR))
17 I +SITR<1 S VAL=0_U_0_U Q
18 ;
19 ; Sensitive notifications, exclusions
20 ;
21 S LEVEL=+$G(^TMP("ORRHCQ",$J,"DFN","S",SITR))
22 I LEVEL=2 D
23 .D NOTICE^DGSEC4(.RET,SITR,"ORRCMP QUERY TOOL^ORRCM CLIENT",1)
24 .I +$G(RET)=0 D ERROR("Error logging sensitive patient use.") S VAL=0_U_0_U Q
25 S VAL=0
26 I LEVEL<3 D
27 .S VAL=$$PTSCRN^ORRHCQ(SITR)
28 ;
29 I +VAL S $P(VAL,U,2)=$$QRYPT^ORRHCQ(SITR)
30 S $P(VAL,U,3)=SITR
31 Q
32 ;
33GETSPT(RES,START,LEN) ;Returns a list of DFN^Patient Name^Level given a start position and a length. The START
34 ;parameter should be in the form "NAME!DFN" (a 'bang' between name and DFN.)
35 N I,X S I=START,X=1
36 I +$G(LEN)<1 Q
37 F S I=$O(^TMP("ORRHCQ",$J,"DFN","S","B",I)) Q:X>+$G(LEN)!(I="") D
38 .S RES(X)=$P(I,"!",2)_U_$P(I,"!",1)_U_$G(^TMP("ORRHCQ",$J,"DFN","S","B",I)),X=X+1
39 Q
40 ;
41GETSLN(RES,DFN) ;Returns the sensitive patient message text lines for the given patient.
42 N I,CODE S RES="",I=0
43 I $D(^TMP("ORRHCQ",$J,"DFN","S",DFN)) D
44 .S CODE=^TMP("ORRHCQ",$J,"DFN","S",DFN)
45 .M RES=^TMP("ORRHCQ",$J,"DFN","S","MESSAGE",CODE)
46 Q
47 ;
48DELSEN(RES,DFN) ;Removes Sensitive Patient from list
49 S RES=0
50 I $D(^TMP("ORRHCQ",$J,"DFN","S",DFN)) D
51 .S RES=1 K ^TMP("ORRHCQ",$J,"DFN","S",DFN),^TMP("ORRHCQ",$J,"DFN","S","B",$$PTNAME(DFN)_"!"_DFN)
52 Q
53 ;
54GETCNT(LEN) ; Returns the count of sensitive patients
55 S LEN=0
56 I $D(^TMP("ORRHCQ",$J,"DFN","S")) D
57 .N I S I=0
58 .F S I=$O(^TMP("ORRHCQ",$J,"DFN","S",I)) Q:I'>0 S LEN=LEN+1
59 Q
60 ;
61SSCREEN(PATID) ; Screen sensitive patients - returns 1 if not a sensitive patient; returns 0 if is a sensitive patient or has error
62 ; check for sensitive pt level here and store in "DFN","S",DFN)=LEVEL??
63 N RESULT,CODE
64 D PTSEC^DGSEC4(.RESULT,PATID,0,"ORRCMP QUERY TOOL^ORRCM CLIENT")
65 I $D(RESULT)<1 D ERROR("PTSEC^DGSEC4 did not return expected values.") Q 0
66 I $G(RESULT(1))<0 D ERROR("PTSEC^DGSEC4 returned an error code of:"_RESULT(1)) Q 0
67 I $G(RESULT(1))>0 D Q 0
68 .S ^TMP("ORRHCQ",$J,"DFN","S",PATID)=RESULT(1),^TMP("ORRHCQ",$J,"DFN","S","B",$$PTNAME(PATID)_"!"_PATID)=RESULT(1)
69 .S CODE=RESULT(1) K RESULT(1)
70 .M ^TMP("ORRHCQ",$J,"DFN","S","MESSAGE",CODE)=RESULT
71 Q 1
72 ;
73ERROR(MESSAGE) ;Log an error searching for sensitive patient information
74 Q
75 ;
76PTNAME(DFN) ; Returns patient name
77 N VADM,VA,VAERR
78 D DEM^VADPT
79 Q VADM(1)
80 ;
Note: See TracBrowser for help on using the repository browser.