source: ccr/trunk/p/C0CMED.m@ 418

Last change on this file since 418 was 418, checked in by Sam Habiel, 15 years ago

Refactoring C0CMED
Updated C0CUTIL with checks on whether we are in RPMS, Vista, WorldVista, or OpenVista

File size: 3.0 KB
Line 
1C0CMED ; WV/CCDCCR/GPL/SMH - CCR/CCD Medications Driver; Mar 23 2009
2 ;;0.5;CCDCCR;;JUL 16,2008;
3 ; Copyright 2008,2009 George Lilly, University of Minnesota and Sam Habiel.
4 ; Licensed under the terms of the GNU General Public License.
5 ; See attached copy of the License.
6 ;
7 ; This program is free software; you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation; either version 2 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License along
18 ; with this program; if not, write to the Free Software Foundation, Inc.,
19 ; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 ;
21 ; --Revision History
22 ; July 2008 - Initial Version/GPL
23 ; July 2008 - March 2009 various revisions
24 ; March 2009 - Reconstruction of routine as driver for other med routines/SMH
25 ;
26 Q
27EXTRACT(MEDXML,DFN,MEDOUTXML) ; Private; Extract medications into provided XML template
28 ; DFN passed by reference
29 ; MEDXML and MEDOUTXML are passed by Name
30 ; MEDXML is the input template
31 ; MEDOUTXML is the output template
32 ; Both of them refer to ^TMP globals where the XML documents are stored
33 ;
34 ; -- This ep is the driver for extracting medications into the provided XML template
35 ; 1. VA Outpatient Meds are in C0CMED1
36 ; 2. VA Pending Meds are in C0CMED2
37 ; 3. VA non-VA Meds are in C0CMED3
38 ; 4. VA Inpatient IV Meds are in C0CMED4 (not functional)
39 ; 5. VA Inpatient UD Meds are in C0CMED5 (doesn't exist yet)--March 2009
40 ; 6. RPMS Meds are in C0CMED6. Need to create other routines for subdivisions of RPMS Meds is not known at this time.
41 ;
42 ; --Prep variables
43 D:$$RPMS^C0CUTIL() RPMS QUIT
44 D:($$VISTA^C0CUTIL())!($$WV^C0CUTIL()) VISTA QUIT
45 D EXTRACT^C0CMED1(MEDXML,DFN,MEDOUTXML) ; FIRST EXTRACT OUTPATIENT MEDS
46 I @MEDOUTXML@(0)>0 D ; C0CMED FOUND ACTIVE OP MEDS
47 . W "HAS ACTIVE OP MEDS",!
48 N PENDINGXML
49 S PENDINGXML="MEDPENDING" ;NAME FOR ARRAY
50 D EXTRACT^C0CMED2(MEDXML,DFN,PENDINGXML) ; FIRST EXTRACT OUTPATIENT MEDS
51 I @PENDINGXML@(0)>0 D ; C0CMED FOUND PENDING OP MEDS
52 . I @MEDOUTXML@(0)>0 D ; IF WE NEED TO COMBINE MEDS
53 . . D INSINNER^C0CXPATH(MEDOUTXML,PENDINGXML) ;ADD PENDING TO ACTIVE
54 . E D CP^C0CXPATH(PENDINGXML,MEDOUTXML) ; NO ACTIVE MEDS, JUST COPY
55 . W "HAS OP PENDING MEDS",!
56 N PENDINGXML
57 S PENDINGXML="MEDPENDING" ;NAME FOR ARRAY
58 D EXTRACT^C0CMED3(MEDXML,DFN,PENDINGXML) ; FIRST EXTRACT OUTPATIENT MEDS
59 I @PENDINGXML@(0)>0 D ; C0CMED FOUND PENDING OP MEDS
60 . I @MEDOUTXML@(0)>0 D ; IF WE NEED TO COMBINE MEDS
61 . . D INSINNER^C0CXPATH(MEDOUTXML,PENDINGXML) ;ADD NON-VA TO MEDS
62 . E D CP^C0CXPATH(PENDINGXML,MEDOUTXML) ; NO PREVIOUS MEDS, JUST COPY
63 . W:$G(DEBUG) "HAS NON-VA MEDS",!
64 Q
65 ; Extraction Sections
66RPMS
67 D EXTRACT^C0CMED6(MEDXML,DFN,MEDOUTXML) QUIT
68VISTA
69
Note: See TracBrowser for help on using the repository browser.