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

Last change on this file since 1736 was 1586, checked in by Sam Habiel, 12 years ago

Changed license to AGPL. Some clean-up for XINDEX

  • Property svn:mergeinfo set to (toggle deleted branches)
    /ccr/branches/ohum/o-old/p/C0CRPMS.m1290
    /ccr/branches/ohum/p/C0CRPMS.m1291-1543
    /ccr/branches/ohum/p/p/C0CRPMS.m1287-1289
File size: 3.9 KB
Line 
1C0CRPMS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR RPMS ;1/14/09 14:33
2 ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
3 ;
4 ; This program is free software: you can redistribute it and/or modify
5 ; it under the terms of the GNU Affero General Public License as
6 ; published by the Free Software Foundation, either version 3 of the
7 ; License, or (at your option) any later version.
8 ;
9 ; This program is distributed in the hope that it will be useful,
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ; GNU Affero General Public License for more details.
13 ;
14 ; You should have received a copy of the GNU Affero General Public License
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ;
17 W "NO ENTRY FROM TOP",!
18 Q
19 ;
20DISPLAY ; RUN THE PCC DISPLAY ROUTINE
21 D ^APCDDISP
22 Q
23 ;
24VTYPES ;
25 D GETN2^C0CRNF("G1",9999999.07)
26 ; ZWR G1
27 Q
28 ;
29VISITS(C0CDFN,C0CCNT) ;LIST VISIT DATES FOR PATIENT DFN
30 ; C0CCNT IS A LIMIT ON HOW MANY VISITS TO DISPLAY ; DEFAULTS TO ALL
31 I '$D(C0CCNT) S C0CCNT=999999999
32 N G,GN
33 S G="" S GN=0
34 F S G=$O(^AUPNVSIT("AA",C0CDFN,G)) Q:(G="")!(GN>C0CCNT) D ;
35 . S GN=GN+1
36 . W $$FMDTOUTC^C0CUTIL(9999999-G),!
37 Q
38 ;
39VISITS2(C0CDFN,C0CCNT) ;SECOND VERSION USING NEXTV
40 ;
41 N C0CG,GN
42 S C0CG=""
43 S GN=0
44 I '$D(C0CCNT) S C0CCNT=99999999
45 F S C0CG=$$NEXTV(C0CDFN,C0CG) Q:(C0CG="")!(GN'<C0CCNT) D ;
46 . S GN=GN+1
47 . W $$FMDTOUTC^C0CUTIL(C0CG),!
48 Q
49 ;
50NEXTV(C0CDFN,C0CVDT) ;EXTRINSIC WHICH RETURNS THE NEXT VISIT DATE
51 ;FOR PATIENT C0CDFN IN REVERSE TIME ORDER; PASS "" TO GET THE MOST
52 ; RECENT VISIT
53 N G
54 S G=C0CVDT
55 I G'="" S G=9999999-C0CVDT ;INVERT FOR INDEX
56 S G=$O(^AUPNVSIT("AA",C0CDFN,G))
57 I G="" Q ""
58 E Q 9999999-G
59 ;
60GETV(C0CDFN,C0CVDT) ; GET VISIT USING DATE C0CVDT . IF C0CVDT IS NULL,
61 ; GET MOST RECENT VISIT
62 N C0CG
63 I '$D(C0CVDT) S C0CVDT=$$NEXTV(C0CDFN,"")
64 S APCDVLDT=C0CVDT
65 S APCDPAT=C0CDFN
66 D ^APCDVLK
67 D ^APCDVD
68 ;K APCDCLN,APCDCAT,APCDDATE,APCDLOC,APCDVSIT,APCDLOOK,APCDTYPE
69 Q
70 ;
71GETNV(C0CDFN) ;GET MANY VISITS
72 ;
73 S APCDPAT=C0CDFN ;
74 N C0CG S C0CG=""
75 F S C0CG=$$NEXTV(C0CDFN,C0CG) Q:C0CG="" D ; LOOP BACKWARD THROUGH VISITS
76 . W C0CG," ",$$FMDTOUTC^C0CUTIL(C0CG),!
77 . S APCDVLDT=C0CG
78 . D ^APCDVLK
79 . D ^APCDVD
80 . K APCDCLN,APCDCAT,APCDDATE,APCDLOC,APCDVSIT,APCDLOOK,APCDTYPE
81 Q
82 ;
83GETTBL(C0CTBL) ; SCAN FOR AND DISPLAY PATIENTS IN A RIMTBL, PASSED BY VALUE
84 ;
85 N ZG S ZG=$NA(^TMP("GPLRIM","RIMTBL","PATS",C0CTBL))
86 N C0CG S C0CG=""
87 N C0CQ S C0CQ=0
88 F S C0CG=$O(@ZG@(C0CG),-1) Q:(C0CG="") D ;
89 . W "PAT: ",C0CG,!
90 . D GETNV^C0CRPMS(C0CG)
91 . K X R X:DTIME
92 . I X="Q" S C0CQ=1 ; QUIT IF Q
93 Q
94 ;
95CMPDRG ; COMPARE THE DRUG FILE TO THE VA VUID MAPPING FILE FOR MATCHES
96 ;
97 S C0CZI=0 ;
98 F S C0CZI=$O(^C0CDRUG("V",C0CZI)) Q:C0CZI="" D ;ALL DRUGS IN RPMS DRUG FILE
99 . S C0CZJ="" ; FOR EVERY FIELD AND SUBFIELD IN THE DRUG FILE
100 . ;W "C0CZI:",C0CZI
101 . F S C0CZJ=$O(^C0CDRUG("V",C0CZI,C0CZJ)) Q:C0CZJ="" D ;
102 . . ;W " C0CZJ:",C0CZJ
103 . . N C0CZN,C0CZV ;
104 . . S C0CZN=^C0CDRUG("V",C0CZI,C0CZJ,1) ; EVERY FIELD VALUE
105 . . ;W " C0CZN:",C0CZN,!
106 . . D GETN1^C0CRNF("C0CZV",176.112,C0CZN,"C") ;LOOK IN C XREF
107 . . I $D(C0CZV) D ;FOUND A MATCH
108 . . . S C0CVO="FOUND:^"_C0CZI_"^"_C0CZJ_"^"_C0CZN
109 . . . S C0CVO=C0CVO_"^RXNORM:^"_$$ZVALUE^C0CRNF("MEDIATION CODE","C0CZV")
110 . . . D PUSH^GPLXPATH("^C0CZRX",C0CVO)
111 . . . W C0CVO,!
112 Q
113 ;
114CMPDRG2 ; COMPARE THE DRUG FILE TO THE VA VUID MAPPING FILE FOR MATCHES
115 ;
116 S C0CZI=0 ;
117 F S C0CZI=$O(^C0CDRUG("V",C0CZI)) Q:C0CZI="" D ;ALL DRUGS IN RPMS DRUG FILE
118 . S C0CZJ="" ; FOR EVERY FIELD AND SUBFIELD IN THE DRUG FILE
119 . W "C0CZI:",C0CZI
120 . F S C0CZJ=$O(^C0CDRUG("V",C0CZI,C0CZJ)) Q:C0CZJ="" D ;
121 . . W " C0CZJ:",C0CZJ
122 . . N C0CZN,C0CZV ;
123 . . S C0CZN=^C0CDRUG("V",C0CZI,C0CZJ,1) ; EVERY FIELD VALUE
124 . . W " C0CZN:",C0CZN,!
125 . . D GETN1^C0CRNF("C0CZV",176.112,C0CZN,"C") ;LOOK IN C XREF
126 . . I $D(C0CZV) D ;FOUND A MATCH
127 . . . W "FOUND: ",C0CZI," ",C0CZJ," ",C0CZN
128 . . . W " VUID:",$$ZVALUE^C0CRNF("VUID","C0CZV"),!
129 Q
130 ;
Note: See TracBrowser for help on using the repository browser.