80 lines
2.4 KiB
Mathematica
80 lines
2.4 KiB
Mathematica
C0CRPMS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR RPMS ;1/14/09 14:33
|
|
;;0.1;CCDCCR;;JUL 16,2008;Build 7
|
|
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
|
|
;General Public License See attached copy of the License.
|
|
;
|
|
;This program is free software; you can redistribute it and/or modify
|
|
;it under the terms of the GNU General Public License as published by
|
|
;the Free Software Foundation; either version 2 of the License, or
|
|
;(at your option) any later version.
|
|
;
|
|
;This program is distributed in the hope that it will be useful,
|
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;GNU General Public License for more details.
|
|
;
|
|
;You should have received a copy of the GNU General Public License along
|
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
;
|
|
W "NO ENTRY FROM TOP",!
|
|
Q
|
|
;
|
|
DISPLAY ; RUN THE PCC DISPLAY ROUTINE
|
|
D ^APCDDISP
|
|
Q
|
|
;
|
|
VISITS(C0CDFN,C0CCNT) ;LIST VISIT DATES FOR PATIENT DFN
|
|
; C0CCNT IS A LIMIT ON HOW MANY VISITS TO DISPLAY ; DEFAULTS TO ALL
|
|
I '$D(C0CCNT) S C0CCNT=999999999
|
|
N G,GN
|
|
S G="" S GN=0
|
|
F S G=$O(^AUPNVSIT("AA",C0CDFN,G)) Q:(G="")!(GN>C0CCNT) D ;
|
|
. S GN=GN+1
|
|
. W $$FMDTOUTC^CCRUTIL(9999999-G),!
|
|
Q
|
|
;
|
|
VISITS2(C0CDFN,C0CCNT) ;SECOND VERSION USING NEXTV
|
|
;
|
|
N C0CG,GN
|
|
S C0CG=""
|
|
S GN=0
|
|
I '$D(C0CCNT) S C0CCNT=99999999
|
|
F S C0CG=$$NEXTV(C0CDFN,C0CG) Q:(C0CG="")!(GN'<C0CCNT) D ;
|
|
. S GN=GN+1
|
|
. W $$FMDTOUTC^CCRUTIL(C0CG),!
|
|
Q
|
|
;
|
|
NEXTV(C0CDFN,C0CVDT) ;EXTRINSIC WHICH RETURNS THE NEXT VISIT DATE
|
|
;FOR PATIENT C0CDFN IN REVERSE TIME ORDER; PASS "" TO GET THE MOST
|
|
; RECENT VISIT
|
|
N G
|
|
S G=C0CVDT
|
|
I G'="" S G=9999999-C0CVDT ;INVERT FOR INDEX
|
|
S G=$O(^AUPNVSIT("AA",C0CDFN,G))
|
|
I G="" Q ""
|
|
E Q 9999999-G
|
|
;
|
|
GETV(C0CDFN,C0CVDT) ; GET VISIT USING DATE C0CVDT . IF C0CVDT IS NULL,
|
|
; GET MOST RECENT VISIT
|
|
N C0CG
|
|
I '$D(C0CVDT) S C0CVDT=$$NEXTV(C0CDFN,"")
|
|
S APCDVLDT=C0CVDT
|
|
S APCDPAT=C0CDFN
|
|
D ^APCDVLK
|
|
D ^APCDVD
|
|
;K APCDCLN,APCDCAT,APCDDATE,APCDLOC,APCDVSIT,APCDLOOK,APCDTYPE
|
|
Q
|
|
;
|
|
GETNV(C0CDFN) ;GET MANY VISITS
|
|
;
|
|
S APCDPAT=C0CDFN ;
|
|
N C0CG S C0CG=""
|
|
F S C0CG=$$NEXTV(C0CDFN,C0CG) Q:C0CG="" D ; LOOP BACKWARD THROUGH VISITS
|
|
. W C0CG," ",$$FMDTOUTC^CCRUTIL(C0CG),!
|
|
. S APCDVLDT=C0CG
|
|
. D ^APCDVLK
|
|
. D ^APCDVD
|
|
. K APCDCLN,APCDCAT,APCDDATE,APCDLOC,APCDVSIT,APCDLOOK,APCDTYPE
|
|
Q
|
|
; |