source: ccr/trunk/p/C0CRPMS.m@ 335

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

utility routines to access RPMS PCC files

File size: 2.4 KB
Line 
1C0CRPMS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR RPMS ;1/14/09 14:33
2 ;;0.1;CCDCCR;;JUL 16,2008;Build 7
3 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 W "NO ENTRY FROM TOP",!
21 Q
22 ;
23DISPLAY ; RUN THE PCC DISPLAY ROUTINE
24 D ^APCDDISP
25 Q
26 ;
27VISITS(C0CDFN,C0CCNT) ;LIST VISIT DATES FOR PATIENT DFN
28 ; C0CCNT IS A LIMIT ON HOW MANY VISITS TO DISPLAY ; DEFAULTS TO ALL
29 I '$D(C0CCNT) S C0CCNT=999999999
30 N G,GN
31 S G="" S GN=0
32 F S G=$O(^AUPNVSIT("AA",C0CDFN,G)) Q:(G="")!(GN>C0CCNT) D ;
33 . S GN=GN+1
34 . W $$FMDTOUTC^CCRUTIL(9999999-G),!
35 Q
36 ;
37VISITS2(C0CDFN,C0CCNT) ;SECOND VERSION USING NEXTV
38 ;
39 N C0CG,GN
40 S C0CG=""
41 S GN=0
42 I '$D(C0CCNT) S C0CCNT=99999999
43 F S C0CG=$$NEXTV(C0CDFN,C0CG) Q:(C0CG="")!(GN'<C0CCNT) D ;
44 . S GN=GN+1
45 . W $$FMDTOUTC^CCRUTIL(C0CG),!
46 Q
47 ;
48NEXTV(C0CDFN,C0CVDT) ;EXTRINSIC WHICH RETURNS THE NEXT VISIT DATE
49 ;FOR PATIENT C0CDFN IN REVERSE TIME ORDER; PASS "" TO GET THE MOST
50 ; RECENT VISIT
51 N G
52 S G=C0CVDT
53 I G'="" S G=9999999-C0CVDT ;INVERT FOR INDEX
54 S G=$O(^AUPNVSIT("AA",C0CDFN,G))
55 I G="" Q ""
56 E Q 9999999-G
57 ;
58GETV(C0CDFN,C0CVDT) ; GET VISIT USING DATE C0CVDT . IF C0CVDT IS NULL,
59 ; GET MOST RECENT VISIT
60 N C0CG
61 I '$D(C0CVDT) S C0CVDT=$$NEXTV(C0CDFN,"")
62 S APCDVLDT=C0CVDT
63 S APCDPAT=C0CDFN
64 D ^APCDVLK
65 D ^APCDVD
66 ;K APCDCLN,APCDCAT,APCDDATE,APCDLOC,APCDVSIT,APCDLOOK,APCDTYPE
67 Q
68 ;
69GETNV(C0CDFN) ;GET MANY VISITS
70 ;
71 S APCDPAT=C0CDFN ;
72 N C0CG S C0CG=""
73 F S C0CG=$$NEXTV(C0CDFN,C0CG) Q:C0CG="" D ; LOOP BACKWARD THROUGH VISITS
74 . W C0CG," ",$$FMDTOUTC^CCRUTIL(C0CG),!
75 . S APCDVLDT=C0CG
76 . D ^APCDVLK
77 . D ^APCDVD
78 . K APCDCLN,APCDCAT,APCDDATE,APCDLOC,APCDVSIT,APCDLOOK,APCDTYPE
79 Q
80 ;
Note: See TracBrowser for help on using the repository browser.