Changeset 295 for ccr/trunk/p/CCRMEDS3.m


Ignore:
Timestamp:
Nov 23, 2008, 4:27:27 PM (15 years ago)
Author:
Sam Habiel
Message:

Corrected bugs in CCRMEDS3 and refactored CCRMEDS2

File:
1 edited

Legend:

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

    r245 r295  
    7575 . S @MAP@("MEDPRODUCTNAMETEXT")=MED(.01,"E")
    7676 . ; NDC is field 31 in the drug file.
    77  . ; The actual drug entry in the drug file is not necessarily supplied.
     77 . ; The actual drug entry in the drug file (MEDIEN) is not necessarily supplied.
    7878 . ; It' node 1, internal form.
    7979 . N MEDIEN S MEDIEN=MED(1,"I")
    80  . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$S($L(MEDIEN):$$GET1^DIQ(50,MEDIEN,31,"E"),1:"")
    81  . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=$S($L(MEDIEN):"NDC",1:"")
    82  . S @MAP@("MEDPRODUCTNAMECODEVERSION")=$S($L(MEDIEN):"none",1:"")
    83  . S @MAP@("MEDBRANDNAMETEXT")=""
    84  . I $L(MEDIEN) D DOSE^PSS50(MEDIEN,,,,,"DOSE")
    85  . I $L(MEDIEN) N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
    86  . S @MAP@("MEDSTRENGTHVALUE")=$S($L(MEDIEN):DOSEDATA(901),1:"")
    87  . S @MAP@("MEDSTRENGTHUNIT")=$S($L(DOSEDATA(902))>0:$P(DOSEDATA(902),U,2),1:"") ; SAM PLEASE CHECK
    88  . ; Units, concentration, etc, come from another call
    89  . ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
    90  . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
    91  . ; NDF Entry IEN, and VA Product Name
    92  . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
    93  . ; Documented in the same manual.
    94  . N NDFDATA,CONCDATA
    95  . I $L(MEDIEN) D
     80 . I +MEDIEN D
     81 . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
     82 . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
     83 . . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
     84 . . S @MAP@("MEDBRANDNAMETEXT")=""
     85 . . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
     86 . . N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
     87 . . S @MAP@("MEDSTRENGTHVALUE")=DOSEDATA(901)
     88 . . S @MAP@("MEDSTRENGTHUNIT")=$P(DOSEDATA(902),U,2)
     89 . . ; Units, concentration, etc, come from another call
     90 . . ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
     91 . . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
     92 . . ; NDF Entry IEN, and VA Product Name
     93 . . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
     94 . . ; Documented in the same manual.
     95 . . ;
     96 . . ; If the drug is not matched to the National Drug File
     97 . . ; there will be no NDF Data.
     98 . . N NDFDATA,CONCDATA
    9699 . . D NDF^PSS50(MEDIEN,,,,,"CONC")
    97100 . . M NDFDATA=^TMP($J,"CONC",MEDIEN)
     
    102105 . . I NDFIEN="" S CONCDATA=""
    103106 . . E  S CONCDATA=$$CPRS^PSNAPIS(NDFIEN,VAPROD)
    104  . E  S (NDFDATA,CONCDATA)="" ; This line is defensive programming to prevent undef errors.
    105  . S @MAP@("MEDFORMTEXT")=$S($L(MEDIEN):$P(CONCDATA,U,1),1:"")
    106  . S @MAP@("MEDCONCVALUE")=$S($L(MEDIEN):$P(CONCDATA,U,3),1:"")
    107  . S @MAP@("MEDCONCUNIT")=$S($L(MEDIEN):$P(CONCDATA,U,4),1:"")
    108  . S @MAP@("MEDSIZETEXT")=$S($L(MEDIEN):$P(NDFDATA(23),U,2)_" "_$P(NDFDATA(24),U,2),1:"")
    109  . S @MAP@("MEDQUANTITYVALUE")=""  ; not provided for in Non-VA meds.
    110  . ; Oddly, there is no easy place to find the dispense unit.
    111  . ; It's not included in the original call, so we have to go to the drug file.
    112  . ; That would be DATA^PSS50(IEN,,,,,"SUBSCRIPT")
    113  . ; Node 14.5 is the Dispense Unit
    114  . I $L(MEDIEN) D
     107 . . S @MAP@("MEDFORMTEXT")=$P(CONCDATA,U,1)
     108 . . S @MAP@("MEDCONCVALUE")=$P(CONCDATA,U,3)
     109 . . S @MAP@("MEDCONCUNIT")=$P(CONCDATA,U,4)
     110 . . S @MAP@("MEDSIZETEXT")=$P(NDFDATA(23),U,2)_" "_$P(NDFDATA(24),U,2)
     111 . . S @MAP@("MEDQUANTITYVALUE")=""  ; not provided for in Non-VA meds.
     112 . . ; Oddly, there is no easy place to find the dispense unit.
     113 . . ; It's not included in the original call, so we have to go to the drug file.
     114 . . ; That would be DATA^PSS50(IEN,,,,,"SUBSCRIPT")
     115 . . ; Node 14.5 is the Dispense Unit
    115116 . . D DATA^PSS50(MEDIEN,,,,,"QTY")
    116117 . . N QTYDATA M QTYDATA=^TMP($J,"QTY",MEDIEN)
    117118 . . S @MAP@("MEDQUANTITYUNIT")=QTYDATA(14.5)
    118  . E  S @MAP@("MEDQUANTITYUNIT")=""
     119 . E  D
     120 . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=""
     121 . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=""
     122 . . S @MAP@("MEDPRODUCTNAMECODEVERSION")=""
     123 . . S @MAP@("MEDBRANDNAMETEXT")=""
     124 . . S @MAP@("MEDSTRENGTHVALUE")=""
     125 . . S @MAP@("MEDSTRENGTHUNIT")=""
     126 . . S @MAP@("MEDFORMTEXT")=""
     127 . . S @MAP@("MEDCONCVALUE")=""
     128 . . S @MAP@("MEDCONCUNIT")=""
     129 . . S @MAP@("MEDSIZETEXT")=""
     130 . . S @MAP@("MEDQUANTITYVALUE")=""
     131 . . S @MAP@("MEDQUANTITYUNIT")=""
    119132 . ;
    120133 . ; --- START OF DIRECTIONS ---
Note: See TracChangeset for help on using the changeset viewer.