source: WorldVistAEHR/trunk/r/PATIENT_REPRESENTATIVE-QAC/QACVKHLD.m@ 724

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1QACVKHLD ; OAKOIFO/TKW - DATA MIGRATION - VISTALINK RPC CODE ;5/5/06 12:56
2 ;;2.0;Patient Representative;**19**;07/25/1995;Build 55
3EN(PATSLIST,PATSROWS,PATSFRM0,PATSFRM1) ; Called from ^QACVEMPX
4 ; Read list of Security Key Names in PATSLIST, return a list
5 ; of all people in NEW PERSON file who hold that key.
6 N PATSKI,PATSKEY,KEYSCR,LSTNAME,LSTIEN,CURRDT,I,J,X,Y,Z
7 S CURRDT=$$DT^XLFDT()
8 I '$G(PATSROWS) S PATSROWS=10
9 S PATSFRM0=$G(PATSFRM0),PATSFRM1=$G(PATSFRM1)
10 K ^TMP("QACKHLD",$J)
11 ; Build the list of people who hold one or more of the keys. The
12 ; screen prevents us from looking up same person holding more than
13 ; one of the keys in the list, and screens out terminated users.
14 ; IA #10060
15 S KEYSCR="I ($P(^(0),""^"",11)=""""!(CURRDT<$P(^(0),""^"",11))),'$D(^TMP(""QACKHLD"",$J,""IEN"",Y))"
16 F PATSKI=0:0 S PATSKI=$O(PATSLIST(PATSKI)) Q:'PATSKI!($G(DIERR)) S PATSKEY=PATSLIST(PATSKI) D:PATSKEY]""
17 . D FIND^DIC(200,,"@;.01I;8;28","X",PATSKEY,,"AB",.KEYSCR)
18 . F I=0:0 S I=$O(^TMP("DILIST",$J,2,I)) Q:'I S X=^(I) D
19 .. S Y=$G(^TMP("DILIST",$J,"ID",I,.01))
20 .. Q:'X!(Y="")
21 .. ; Build list of IENs to use in FIND^DIC screen
22 .. S ^TMP("QACKHLD",$J,"IEN",X)=""
23 .. ; Build list of person data, ordered by name, IEN.
24 .. S Z=X_"^"_$G(^TMP("DILIST",$J,"ID",I,8))_"^"_$G(^(28))
25 .. S ^TMP("QACKHLD",$J,"NAME",Y,X)=Z
26 .. Q
27 . Q
28 ; Now build output as if this came from a lister call. Sort the
29 ; output by person NAME then IEN. PATSFRM0 is the ending name from
30 ; the last call, PATSFRM1 is the last IEN (if the ending name in
31 ; the previous call matches the first name in this one).
32 K ^TMP("DILIST",$J)
33 S Y=PATSFRM0,I=0,(LSTNAME,LSTIEN)=""
34 I PATSFRM1 S Y=$O(^TMP("QACKHLD",$J,"NAME",PATSFRM0),-1)
35 F S Y=$O(^TMP("QACKHLD",$J,"NAME",Y)) Q:Y=""!(I>PATSROWS) D
36 . F X=+PATSFRM1:0 S X=$O(^TMP("QACKHLD",$J,"NAME",Y,X)) Q:'X!(I>PATSROWS) S Z=^(X) D
37 .. S I=I+1
38 .. ; If we exceed the total number of rows to be output this time,
39 .. ; set FROM values as if we came from a LIST^DIC call.
40 .. I I>PATSROWS D Q
41 ... S PATSFRM0=LSTNAME
42 ... S PATSFRM1=$S(Y=LSTNAME:LSTIEN,1:"")
43 .. S ^TMP("DILIST",$J,I,0)=Z
44 .. S LSTNAME=Y,LSTIEN=X,(PATSFRM0,PATSFRM1)=""
45 .. Q
46 . Q
47 K ^TMP("QACKHLD",$J)
48 Q
49 ;
50 ;
Note: See TracBrowser for help on using the repository browser.