Changeset 295 for ccr/trunk/p


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

Corrected bugs in CCRMEDS3 and refactored CCRMEDS2

Location:
ccr/trunk/p
Files:
2 edited

Legend:

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

    r281 r295  
    7979 . ; MED(11) piece 1 has the IEN of the drug (file 50)
    8080 . ; IEN is field 31 in the drug file.
     81 . ;
     82 . ; MEDIEN (node 11 in the returned output) might not necessarily be defined
     83 . ; It is not defined when a dose in not chosen in CPRS. There is a long
     84 . ; series of fields that depend on it. We will use If and Else to deal
     85 . ; with that
    8186 . N MEDIEN S MEDIEN=$P(MED(11),U)
    82  . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
    83  . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
    84  . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
    85  . S @MAP@("MEDBRANDNAMETEXT")=""
    86  . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
    87  . I $D(^TMP($J,"DOSE",MEDIEN)) D  ; GPL ; CALL SUCCESSFUL
     87 . I +MEDIEN>0 D
     88 . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=$$GET1^DIQ(50,MEDIEN,31,"E")
     89 . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC"
     90 . . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none"
     91 . . S @MAP@("MEDBRANDNAMETEXT")=""
     92 . . D DOSE^PSS50(MEDIEN,,,,,"DOSE")
    8893 . . N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
    8994 . . S @MAP@("MEDSTRENGTHVALUE")=DOSEDATA(901)
    9095 . . S @MAP@("MEDSTRENGTHUNIT")=$P(DOSEDATA(902),U,2)
    91  . E  D  ; GPL CALL UNSUCCESSUFL
    92  . . S @MAP@("MEDSTRENGTHVALUE")="" ; NO DOSE INFORMATION AVAILABLE
    93  . . S @MAP@("MEDSTRENGTHUNIT")="" ;
    94  . ; Units, concentration, etc, come from another call
    95  . ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
    96  . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
    97  . ; NDF Entry IEN, and VA Product Name
    98  . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
    99  . ; Documented in the same manual.
    100  . D NDF^PSS50(MEDIEN,,,,,"CONC")
    101  . N NDFDATA M NDFDATA=^TMP($J,"CONC",MEDIEN)
    102  . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
    103  . N VAPROD S VAPROD=$P(NDFDATA(22),U)
    104  . N CONCDATA
    105  . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
    106  . ; and this will crash the call. So...
    107  . I NDFIEN="" S CONCDATA=""
    108  . E  S CONCDATA=$$CPRS^PSNAPIS(NDFIEN,VAPROD)
    109  . S @MAP@("MEDFORMTEXT")=$P(CONCDATA,U,1)
    110  . S @MAP@("MEDCONCVALUE")=$P(CONCDATA,U,3)
    111  . S @MAP@("MEDCONCUNIT")=$P(CONCDATA,U,4)
    112  . S @MAP@("MEDSIZETEXT")=$P(NDFDATA(23),U,2)_" "_$P(NDFDATA(24),U,2)
    113  . S @MAP@("MEDQUANTITYVALUE")=$$GET1^DIQ(52.41,RXIEN,12)
    114  . ; Oddly, there is no easy place to find the dispense unit.
    115  . ; It's not included in the original call, so we have to go to the drug file.
    116  . ; That would be DATA^PSS50(IEN,,,,,"SUBSCRIPT")
    117  . ; Node 14.5 is the Dispense Unit
    118  . D DATA^PSS50(MEDIEN,,,,,"QTY")
    119  . N QTYDATA M QTYDATA=^TMP($J,"QTY",MEDIEN)
    120  . S @MAP@("MEDQUANTITYUNIT")=QTYDATA(14.5)
     96 . . ; Units, concentration, etc, come from another call
     97 . . ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
     98 . . ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
     99 . . ; NDF Entry IEN, and VA Product Name
     100 . . ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
     101 . . ; Documented in the same manual.
     102 . . D NDF^PSS50(MEDIEN,,,,,"CONC")
     103 . . N NDFDATA M NDFDATA=^TMP($J,"CONC",MEDIEN)
     104 . . N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
     105 . . N VAPROD S VAPROD=$P(NDFDATA(22),U)
     106 . . N CONCDATA
     107 . . ; If a drug was not matched to NDF, then the NDFIEN is gonna be ""
     108 . . ; and this will crash the call. So...
     109 . . I NDFIEN="" S CONCDATA=""
     110 . . E  S CONCDATA=$$CPRS^PSNAPIS(NDFIEN,VAPROD)
     111 . . S @MAP@("MEDFORMTEXT")=$P(CONCDATA,U,1)
     112 . . S @MAP@("MEDCONCVALUE")=$P(CONCDATA,U,3)
     113 . . S @MAP@("MEDCONCUNIT")=$P(CONCDATA,U,4)
     114 . . S @MAP@("MEDSIZETEXT")=$P(NDFDATA(23),U,2)_" "_$P(NDFDATA(24),U,2)
     115 . . S @MAP@("MEDQUANTITYVALUE")=$$GET1^DIQ(52.41,RXIEN,12)
     116 . . ; Oddly, there is no easy place to find the dispense unit.
     117 . . ; It's not included in the original call, so we have to go to the drug file.
     118 . . ; That would be DATA^PSS50(IEN,,,,,"SUBSCRIPT")
     119 . . ; Node 14.5 is the Dispense Unit
     120 . . D DATA^PSS50(MEDIEN,,,,,"QTY")
     121 . . N QTYDATA M QTYDATA=^TMP($J,"QTY",MEDIEN)
     122 . . S @MAP@("MEDQUANTITYUNIT")=QTYDATA(14.5)
     123 . E  D
     124 . . S @MAP@("MEDPRODUCTNAMECODEVALUE")=""
     125 . . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=""
     126 . . S @MAP@("MEDPRODUCTNAMECODEVERSION")=""
     127 . . S @MAP@("MEDBRANDNAMETEXT")=""
     128 . . S @MAP@("MEDSTRENGTHVALUE")=""
     129 . . S @MAP@("MEDSTRENGTHUNIT")=""
     130 . . S @MAP@("MEDFORMTEXT")=""
     131 . . S @MAP@("MEDCONCVALUE")=""
     132 . . S @MAP@("MEDCONCUNIT")=""
     133 . . S @MAP@("MEDSIZETEXT")=""
     134 . . S @MAP@("MEDQUANTITYVALUE")=""
     135 . . S @MAP@("MEDQUANTITYUNIT")=""
     136 . ;
    121137 . ;
    122138 . ; --- START OF DIRECTIONS ---
  • 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.