Changeset 426 for ccr/trunk/p/C0CMED1.m


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

Implemented Flags in VA Meds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.