Changeset 636 for FOIAVistA/tag/r/PATIENT_REPRESENTATIVE-QAC
- Timestamp:
- Dec 4, 2009, 8:26:01 PM (15 years ago)
- Location:
- FOIAVistA/tag/r
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
FOIAVistA/tag/r/PATIENT_REPRESENTATIVE-QAC/QACVEMPX.m
r628 r636 1 QACVEMPX ; OAKOIFO/TKW - Return Person Data, called by RPC ;9/25/07 14:142 ;;2.0;Patient Representative;**19 ,21**;07/25/1995;Build51 QACVEMPX ; Return Person Data using Value List Handler Pattern to update Patient Advocate PatsPerson table ;5/8/06 10:36 2 ;;2.0;Patient Representative;**19**;07/25/1995;Build 55 3 3 EN(PATSBY,LKUPVAL,PATSROWS,PATSFRM0,PATSFRM1) ; Lookup Employee by Name, then 4 4 ; Output XML formatted data from NEW PERSON file. … … 7 7 ; an array of Security Keys. 8 8 ; PATSROWS=Number of rows to return in each call 9 ; PATSFRM0=Employee Name value from previous call (empty on first call , pass by ref)10 ; PATSFRM1=Employee IEN from previous call (empty on first call , pass by ref)9 ; PATSFRM0=Employee Name value from previous call (empty on first call) 10 ; PATSFRM1=Employee IEN from previous call (empty on first call) 11 11 K ^TMP("DILIST",$J),^TMP("PatsPersonXml",$J) 12 N STDNAME,ULASTNM,NAMECOMP,IENS,PIECE,OUTCNT,TAGLIST,FROM,PART,SRVIEN,MAILCODE,TITLE,SRVRSTA,PATSMORE,PATSERR,DIERR,I,J,X,Y 13 ; If LKUPVAL exists, it contains an employee name, find partial matches. 14 I $G(LKUPVAL)]"" D 15 . S ULASTNM=$P(LKUPVAL,",") 16 . D LOOKUP1 17 . I (ULASTNM[" ")!(ULASTNM["'") D LOOKUP2 18 . Q 19 ; Else, it contains an array of Security Key values, find all 20 ; holders of those keys. 12 N STDNAME,NAMECOMP,IENS,PIECE,OUTCNT,TAGLIST,FROM,PART,SRVIEN,MAILCODE,TITLE,SRVRSTA,PATSMORE,PATSERR,DIERR,I,J,X,Y 13 ; If LKUPVAL exists, it contains an employee name. Else, it is 14 ; an array of Security Key values and we want to find all holders 15 ; of those keys. 16 ; Standardize the name, parse out last name and first name. 17 I $G(LKUPVAL)]"" S STDNAME=LKUPVAL D BYNAME 21 18 I $G(LKUPVAL)="" D 22 19 . D EN^QACVKHLD(.LKUPVAL,PATSROWS,.PATSFRM0,.PATSFRM1) … … 37 34 ; 38 35 ; 39 LOOKUP1 ; Use current routine to standardize the name (IA #3065) 40 ; (name may contain spaces or apostrophes). 41 S STDNAME=LKUPVAL 42 I '$G(PATSROWS) S PATSROWS=10 43 S PATSMORE=0 44 I STDNAME["," S STDNAME=$$FORMAT^XLFNAME7(.STDNAME,1,35,,,,,1) 45 E S STDNAME=$$FORMAT^XLFNAME7(.STDNAME,1,35,,0,,1,1) 46 ; If we've already found all matches to current standard, get out. 47 N QOUT S QOUT=0 48 I (ULASTNM[" ")!(ULASTNM["'") D Q:QOUT 49 . S X=$P($G(PATSFRM0),",") 50 . Q:X="" 51 . I (X[" ")!(X["'") Q 52 . S QOUT=1 Q 53 ; Get list of matching names. 54 D GETLIST(STDNAME,PATSROWS,.PATSFRM0,.PATSFRM1,.PATSMORE,.FROM) 55 Q 56 LOOKUP2 ; Use old routine to standardize the name (no punctuation 57 ; except hyphens).) 58 ; Quit if the maximum number of names has been found. 59 Q:PATSMORE 60 ; Convert user input using old standardization routine 61 S STDNAME=LKUPVAL 36 BYNAME ; Standardize the name, parse out last name and first name. (IA #3065) 62 37 D STDNAME^XLFNAME(.STDNAME,"FG") 63 ; Find enough names to fill the list64 N NEWROWS65 S NEWROWS=PATSROWS-$P($G(^TMP("DILIST",$J,0)),"^")66 ; If list is already full, see whether there are more names67 ; using the old standardization, then quit.68 I NEWROWS'>0 D Q69 . I $D(^VA(200,"B",STDNAME)) S NEWROWS=170 . E S X=$O(^VA(200,"B",STDNAME)) I $E(X,1,$L(STDNAME))=STDNAME S NEWROWS=171 . I NEWROWS=1 S PATSMORE=1,FROM(1)=STDNAME,FROM(2)=""72 . Q73 ; Save off names found using current name standardization.74 K ^TMP("QACOLD",$J)75 I $D(^TMP("DILIST",$J)) D76 . M ^TMP("QACOLD",$J)=^TMP("DILIST",$J)77 . K ^TMP("QACOLD",$J,0) Q78 K ^TMP("DILIST",$J)79 ; Get new list of matching names.80 D GETLIST(STDNAME,NEWROWS,.PATSFRM0,.PATSFRM1,.PATSMORE,.FROM)81 ; Merge the two lists into ^TMP("DILIST",$J).82 S I=$O(^TMP("QACOLD",$J,PATSROWS+1),-1)83 I I D84 . S X=$P($G(^TMP("DILIST",$J,0)),"^")85 . I X F J=1:1:X I $D(^TMP("DILIST",$J,J,0)) S ^TMP("QACOLD",$J,(I+J),0)=^TMP("DILIST",$J,J,0) K ^TMP("DILIST",$J,J,0)86 . M ^TMP("DILIST",$J)=^TMP("QACOLD",$J)87 . S $P(^TMP("DILIST",$J,0),"^")=X+I88 . K ^TMP("QACOLD",$J)89 . Q90 Q91 GETLIST(STDNAME,PATSROWS,PATSFRM0,PATSFRM1,PATSMORE,FROM) ; Get a list of names matching STDNAME92 38 N FIRST,LAST,LEN,SCR,CURRDT 93 39 S LAST=$P(STDNAME,","),FIRST=$P(STDNAME,",",2,99) … … 101 47 E S FROM(1)=PATSFRM0,FROM(2)=$G(PATSFRM1) 102 48 S PART(1)=LAST 49 I '$G(PATSROWS) S PATSROWS=10 103 50 ; Return list of standard name pointer, title and mail code (IA #10060) 104 51 D LIST^DIC(200,,"@;8;28","MP",PATSROWS,.FROM,.PART,"B",SCR) … … 121 68 . S ^TMP("PatsPersonXml",$J,OUTCNT)="<PatsPerson>" 122 69 . S IENS=$P(X,"^") Q:IENS="" S IENS=IENS_"," 123 . ; NOTE: removesreserved XML characters (see $$SYMENC^MXMLUTL, IA#4153)124 . S TITLE=$ $SYMENC^MXMLUTL($E($P(X,"^",2),1,30))125 . S MAILCODE=$ $SYMENC^MXMLUTL($E($P(X,"^",3),1,30))70 . ; NOTE: does not remove reserved XML characters (see $$SYMENC^MXMLUTL, IA#4153) 71 . S TITLE=$E($P(X,"^",2),1,30) 72 . S MAILCODE=$E($P(X,"^",3),1,30) 126 73 . ; Get the individual name components and add them to the output (IA #3065) 127 . K NAMECOMP 128 . S NAMECOMP=$P($G(^VA(200,+IENS,0)),"^") 129 . ; If name contains apostrophes or spaces, use current standardization 130 . I ($P(NAMECOMP,",")["'")!($P(NAMECOMP,",")[" ") D 131 .. S NAMECOMP=$$FORMAT^XLFNAME7(.NAMECOMP,1,35,,,,,2) 132 .. S NAMECOMP=NAMECOMP("FAMILY")_"^"_NAMECOMP("GIVEN")_"^"_NAMECOMP("MIDDLE")_"^"_NAMECOMP("SUFFIX") 133 .. Q 134 . ; Else, use old standardization routine. 135 . E D 136 .. K NAMECOMP S NAMECOMP("FILE")=200,NAMECOMP("FIELD")=.01,NAMECOMP("IENS")=IENS 137 .. S NAMECOMP=$$HLNAME^XLFNAME(.NAMECOMP,"S") 74 . K NAMECOMP S NAMECOMP("FILE")=200,NAMECOMP("FIELD")=.01,NAMECOMP("IENS")=IENS 75 . S NAMECOMP=$$HLNAME^XLFNAME(.NAMECOMP,"S") 138 76 . F J=1:1:6 D 139 77 .. S OUTCNT=OUTCNT+1
Note:
See TracChangeset
for help on using the changeset viewer.