Changeset 426 for ccr


Ignore:
Timestamp:
Mar 29, 2009, 7:58:12 PM (16 years ago)
Author:
Sam Habiel
Message:

Implemented Flags in VA Meds

Location:
ccr/trunk/p
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CMED.m

    r425 r426  
    4141        ;
    4242        ; --Get parameters for meds
     43        S @MEDOUTXML@(0)=0 ; By default, empty.
    4344        N C0CMFLAG
    4445        S C0CMFLAG=$$GET^C0CPARMS("MEDALL")_"^"_$$GET^C0CPARMS("MEDLIMIT")_"^"_$$GET^C0CPARMS("MEDACTIVE")_"^"_$$GET^C0CPARMS("MEDPENDING")
     
    5657VISTA   
    5758        N MEDCOUNT S MEDCOUNT=0
     59        K ^TMP($J,"MED")
    5860        N HIST S HIST=$NA(^TMP($J,"MED","HIST")) ; Meds already dispensed
    5961        N PEND S PEND=$NA(^TMP($J,"MED","PEND")) ; Pending Meds
    6062        N NVA S NVA=$NA(^TMP($J,"MED","NVA")) ; non-VA Meds
     63        S @HIST@(0)=0,@PEND@(0)=0,@NVA@(0)=0 ; At first, they are all empty... (prevent undefined errors)
    6164        ; N IPIV ; Inpatient IV Meds
    6265        ; N IPUD ; Inpatient UD Meds
    63         K ^TMP($J,"MED")
    64         D EXTRACT^C0CMED1(MEDXML,DFN,HIST,.MEDCOUNT) ; Historical OP Meds
    65         D EXTRACT^C0CMED2(MEDXML,DFN,PEND,.MEDCOUNT) ; Pending Meds
    66         D EXTRACT^C0CMED3(MEDXML,DFN,NVA,.MEDCOUNT) ; non-VA Meds
     66        D EXTRACT^C0CMED1(MEDXML,DFN,HIST,.MEDCOUNT,C0CMFLAG) ; Historical OP Meds
     67        D:$P(C0CMFLAG,U,4) EXTRACT^C0CMED2(MEDXML,DFN,PEND,.MEDCOUNT) ; Pending Meds
     68        D:+C0CMFLAG EXTRACT^C0CMED3(MEDXML,DFN,NVA,.MEDCOUNT) ; non-VA Meds
    6769        I @HIST@(0)>0 D 
    6870        . D CP^C0CXPATH(HIST,MEDOUTXML)
  • ccr/trunk/p/C0CMED1.m

    r421 r426  
    2222        Q
    2323        ;
    24 EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT)      ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
     24EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT,FLAGS)       ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
    2525        ;
    2626        ; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
     
    3131        ; MED is holds each array element from MEDS(J), one medicine
    3232        ; MEDCOUNT is a counter passed by Reference.
     33        ; FLAGS are: MEDALL(bool)^MEDLIMIT(int)^MEDACTIVE(bool)^MEDPENDING(bool)
     34        ; FLAGS are set-up in C0CMED.
    3335        ;
    3436        ; RX^PSO52API is a Pharmacy Re-Enginnering (PRE) API to get all
     
    3941        N MEDS,MAP
    4042        K ^TMP($J,"CCDCCR") ; PLEASE DON'T KILL ALL OF ^TMP($J) HERE!!!!
    41         D RX^PSO52API(DFN,"CCDCCR")
     43        N ALL S ALL=+FLAGS
     44        N ACTIVE S ACTIVE=$P(FLAGS,U,3)
     45        ; Below, X1 is today; X2 is the number of days we want to go back
     46        ; X is the result of this calculation using C^%DTC.
     47        N X,X1,X2
     48        S X1=DT
     49        S X2=-$P($P(FLAGS,U,2),"-",2)
     50        D C^%DTC
     51        ; I discovered that I shouldn't put an ending date (last parameter)
     52        ; because it seems that it will get meds whose beginning is after X but
     53        ; whose exipriation is before the ending date.
     54        D RX^PSO52API(DFN,"CCDCCR","","","",X,"")
    4255        M MEDS=^TMP($J,"CCDCCR",DFN)
    4356        ; @(0) contains the number of meds or -1^NO DATA FOUND
     
    4760        N RXIEN S RXIEN=0
    4861        F  S RXIEN=$O(MEDS(RXIEN)) Q:RXIEN=""  D  ; FOR EACH MEDICATION IN THE LIST
     62        . N MED M MED=MEDS(RXIEN)
     63        . I 'ALL,ACTIVE,$P(MED(100),U,2)'="ACTIVE" QUIT
    4964        . S MEDCOUNT=MEDCOUNT+1
    5065        . W:$G(DEBUG) "RXIEN IS ",RXIEN,!
     
    5267        . ; K @MAP DO NOT KILL HERE, WAS CLEARED IN C0CMED
    5368        . W:$G(DEBUG) "MAP= ",MAP,!
    54         . N MED M MED=MEDS(RXIEN) ; PULL OUT MEDICATION FROM
    5569        . S @MAP@("MEDOBJECTID")="MED"_MEDCOUNT ; MEDCOUNT FOR ID
    5670        . ; S @MAP@("MEDOBJECTID")="MED"_MED(.01) ;Rx Number
Note: See TracChangeset for help on using the changeset viewer.