changed issue date to report as date/time instead of just date

added medcount variable so it can be chained with C0CMED3
This commit is contained in:
cje 2010-01-27 17:15:00 +00:00
parent 5690056ee3
commit 1d98cebe9e
1 changed files with 331 additions and 331 deletions

View File

@ -1,4 +1,4 @@
C0CMED6 ; WV/CCDCCR/SMH - Meds from RPMS: Outpatient Meds;01/10/09 C0CMED6 ; WV/CCDCCR/SMH - Meds from RPMS: Outpatient Meds;01/10/09
;;1.0;C0C;;May 19, 2009; ;;1.0;C0C;;May 19, 2009;
; Copyright 2008 WorldVistA. Licensed under the terms of the GNU ; Copyright 2008 WorldVistA. Licensed under the terms of the GNU
; General Public License See attached copy of the License. ; General Public License See attached copy of the License.
@ -20,10 +20,11 @@ C0CMED6 ; WV/CCDCCR/SMH - Meds from RPMS: Outpatient Meds;01/10/09
W "NO ENTRY FROM TOP",! W "NO ENTRY FROM TOP",!
Q Q
; ;
EXTRACT(MINXML,DFN,OUTXML,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
; ;
; MINXML and OUTXML are passed by name so globals can be used ; MINXML and OUTXML are passed by name so globals can be used
; MINXML will contain only the medications skeleton of the overall template ; MINXML will contain only the medications skeleton of the overall template
; MEDCOUNT is a counter passed by Reference.
; FLAGS are: MEDALL(bool)^MEDLIMIT(int)^MEDACTIVE(bool)^MEDPENDING(bool) ; FLAGS are: MEDALL(bool)^MEDLIMIT(int)^MEDACTIVE(bool)^MEDPENDING(bool)
; FLAGS are set-up in C0CMED. ; FLAGS are set-up in C0CMED.
; ;
@ -41,11 +42,9 @@ EXTRACT(MINXML,DFN,OUTXML,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLA
; -- DAYS is passed by value (optional; if not passed defaults to 365) ; -- DAYS is passed by value (optional; if not passed defaults to 365)
; ;
; Return: ; Return:
; ~Type(1)^PharmID(2)^Drug(3)^InfRate(4)^StopDt(5)^RefRem(6)^ ; ~Type^PharmID^Drug^InfRate^StopDt^RefRem^TotDose^UnitDose^OrderID
; TotDose(7)^UnitDose(8)^OrderID(9)^Status(10)^LastFill(11)^ ; ^Status^LastFill^Chronic^Issued^Rx #^Provider^
; Days Supply(12)^Quantity(13)^Chronic(14)^Issued(15)^ ; Status Reason^DEA Handling
; Rx #(16)^Provider(17)^Status Reason(18)^DEA Handling(19)^
; Pharmacy Site(20)
; ;
N MEDS,MEDS1,MAP N MEDS,MEDS1,MAP
D GETRXS^BEHORXFN("MEDS1",DFN,$P($P(FLAGS,U,2),"-",2)) ; 2nd piece of FLAGS is # of days to retrieve, which comes in the form "T-360" D GETRXS^BEHORXFN("MEDS1",DFN,$P($P(FLAGS,U,2),"-",2)) ; 2nd piece of FLAGS is # of days to retrieve, which comes in the form "T-360"
@ -75,11 +74,11 @@ EXTRACT(MINXML,DFN,OUTXML,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLA
. I DEBUG W "MAP= ",MAP,! . I DEBUG W "MAP= ",MAP,!
. S @MAP@("MEDOBJECTID")="MED"_MEDCNT ; MEDCNT FOR ID . S @MAP@("MEDOBJECTID")="MED"_MEDCNT ; MEDCNT FOR ID
. S @MAP@("MEDISSUEDATETXT")="Issue Date" . S @MAP@("MEDISSUEDATETXT")="Issue Date"
. S @MAP@("MEDISSUEDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,15)) . S @MAP@("MEDISSUEDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,15),"DT")
. S @MAP@("MEDLASTFILLDATETXT")="Last Fill Date" . S @MAP@("MEDLASTFILLDATETXT")="Last Fill Date"
. S @MAP@("MEDLASTFILLDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,11)) . S @MAP@("MEDLASTFILLDATE")=$$FMDTOUTC^C0CUTIL($P(MEDS(MEDCNT),U,11),"DT")
. S @MAP@("MEDRXNOTXT")="Prescription Number" . S @MAP@("MEDRXNOTXT")="Prescription Number"
. S @MAP@("MEDRXNO")=$P(MEDS(MEDCNT),U,16) . S @MAP@("MEDRXNO")=$P(MEDS(MEDCNT),U,14)
. S @MAP@("MEDTYPETEXT")="Medication" . S @MAP@("MEDTYPETEXT")="Medication"
. S @MAP@("MEDDETAILUNADORNED")="" ; Leave blank, field has its uses . S @MAP@("MEDDETAILUNADORNED")="" ; Leave blank, field has its uses
. S @MAP@("MEDSTATUSTEXT")=$P(MEDS(MEDCNT),U,10) . S @MAP@("MEDSTATUSTEXT")=$P(MEDS(MEDCNT),U,10)
@ -298,6 +297,7 @@ EXTRACT(MINXML,DFN,OUTXML,FLAGS) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLA
. . . D INSERT^C0CXPATH(RESULT,DIRXML2,"//Medications/Medication") . . . D INSERT^C0CXPATH(RESULT,DIRXML2,"//Medications/Medication")
. D:MEDCNT=1 CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy . D:MEDCNT=1 CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
. D:MEDCNT>1 INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML . D:MEDCNT>1 INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
. S MEDCOUNT=MEDCNT
N MEDTMP,MEDI N MEDTMP,MEDI
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@ I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@