Changeset 373
- Timestamp:
- Feb 22, 2009, 4:17:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/p/CCRMEDS6.m
r359 r373 96 96 . ; We obviously need the NDC. That is easily obtained from the prescription. 97 97 . ; Field 27 in file 52 98 . ; N NDC S NDC=$$GET1^DIQ(52,RXIEN,27,"I") 99 . ; S NDC=$TR(NDC,"-") ; Remove dashes 100 . ; NDC="0"_NDC ; Add an extra zero to front; don't ask, that's how RxNorm has it 101 . N NDC S NDC=0 ; TODO:Remove this line after I fix the RxNorm 176.002 file. 102 . N RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER 98 . N NDC S NDC=$$GET1^DIQ(52,RXIEN,27,"I") 99 . S NDC=$TR(NDC,"-") ; Remove dashes 100 . ; I discovered that file 176.002 might give you two codes for the NDC 101 . ; One for the Clinical Drug, and one for the ingredient. 102 . ; So the plan is to get the two RxNorm codes, and then find from 103 . ; file 176.001 which one is the Clinical Drug. 104 . N C0CZRXN,DIERR 105 . N RXNORM,SRCIEN,RXNNAME,RXNVER 103 106 . I +NDC,$D(^C0CRXN) D ; $Data is for Systems that don't have our RxNorm file yet. 104 . . S RXNIEN=$$FIND1^DIC(176.002,,,NDC,"NDC") 105 . . S RXNORM=$$GET1^DIQ(176.002,RXNIEN,.01) 107 . . D FIND^DIC(176.002,,"@;.01","PX",NDC,"*","NDC",,,"C0CZRXN","DIERR") 108 . . B:$D(DIERR) 109 . . S RXNORM(0)=+C0CZRXN("DILIST",0) ; RxNorm(0) will be # of entries 110 . . N I S I=0 111 . . F S I=$O(C0CZRXN("DILIST",I)) Q:I="" S RXNORM(I)=$P(C0CZRXN("DILIST",I,0),U,2) 112 . . ; At this point, RxNorm(0) is # of entries; RxNorm(1...) are the entries 113 . . ; If RxNorm(0) is 1, then we only have one entry, and that's it. 114 . . I RXNORM(0)=1 S RXNORM=RXNORM(1) 115 . . ; Otherwise, we need to find out which is the clinical drug 116 . . I RXNORM(0)>1 D 117 . . . S I=0 118 . . . F S I=$O(RXNORM(I)) Q:I="" Q:$L($G(RXNORM)) D 119 . . . . N RXNIEN S RXNIEN=$$FIND1^DIC(176.001,,,RXNORM(I),"B") 120 . . . . N RXNTTY S RXNTTY=$$GET1^DIQ(176.001,RXNIEN,3) 121 . . . . I RXNTTY="CD" S RXNORM=RXNORM(I) QUIT 122 . . I $L($G(RXNORM))=0 S RXNORM="" 106 123 . . S SRCIEN=$$FIND1^DIC(176.003,,,"RXNORM","B") 107 124 . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6) … … 178 195 . ; 179 196 . N RAWDATA 180 . D GETS^DIQ(52,RXIEN,"113*",,"RAWDATA") 197 . D GETS^DIQ(52,RXIEN,"113*",,"RAWDATA","DIERR") 198 . D:$D(DIERR) ^%ZTER ; Log if there's an error in retrieving sig field 199 . ; none the less, continue; some parts are retrievable. 181 200 . N FMSIG M FMSIG=RAWDATA(52.0113) ; Merge into subfile... 182 201 . K RAWDATA … … 190 209 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRECTIONDESCRIPTIONTEXT")="" ; This is reserved for systems not able to generate the sig in components. 191 210 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEINDICATOR")="1" ; means that we are specifying it. See E2369-05. 192 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDELIVERYMETHOD")= SIGDATA(8)193 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEVALUE")= SIGDATA(.01)194 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEUNIT")= SIGDATA(2)211 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDELIVERYMETHOD")=$G(SIGDATA(8)) 212 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEVALUE")=$G(SIGDATA(.01)) 213 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDOSEUNIT")=$G(SIGDATA(2)) 195 214 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDRATEVALUE")="" ; For inpatient 196 215 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDRATEUNIT")="" ; For inpatient 197 216 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDVEHICLETEXT")="" ; For inpatient 198 217 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRECTIONROUTETEXT")=$G(SIGDATA(6)) 199 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDFREQUENCYVALUE")= SIGDATA(7)218 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDFREQUENCYVALUE")=$G(SIGDATA(7)) 200 219 . . ; Invervals... again another call. 201 220 . . ; In the wisdom of the original programmers, the schedule is a free text field … … 206 225 . . ; First, remove "PRN" if it exists (don't ask, that's how the file 207 226 . . ; works; I wouldn't do it that way). 208 . . N SCHNOPRN S SCHNOPRN= SIGDATA(7)227 . . N SCHNOPRN S SCHNOPRN=$G(SIGDATA(7)) 209 228 . . I SCHNOPRN["PRN" S SCHNOPRN=$E(SCHNOPRN,1,$F(SCHNOPRN,"PRN")-5) 210 229 . . ; Super call below: … … 226 245 . . ; 10W for weeks, 10L for months. I smell $Select 227 246 . . ; But we don't need to do that if there isn't a duration 228 . . I + SIGDATA(4) D247 . . I +$G(SIGDATA(4)) D 229 248 . . . N DURUNIT S DURUNIT=$E(SIGDATA(4),$L(SIGDATA(4))) ; get last char 230 249 . . . N DURTXT S DURTXT=$S(DURUNIT="M":"Minutes",DURUNIT="H":"Hours",DURUNIT="D":"Days",DURUNIT="W":"Weeks",DURUNIT="L":"Months",1:"Days") … … 234 253 . . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDURATIONVALUE")="" 235 254 . . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDURATIONUNIT")="" 236 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPRNFLAG")= SIGDATA(4)["PRN"255 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPRNFLAG")=$G(SIGDATA(4))["PRN" 237 256 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMOBJECTID")="" ; when avail 238 257 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDPROBLEMTYPETXT")="" … … 248 267 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRSEQ")="" ; Default 249 268 . . S:+$O(FMSIG(FMSIGNUM)) @MAP@("M","DIRECTIONS",DIRCNT,"MEDDIRSEQ")=DIRCNT 250 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDMULDIRMOD")= SIGDATA(5)269 . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDMULDIRMOD")=$G(SIGDATA(5)) 251 270 . ; 252 271 . ; --- END OF DIRECTIONS ---
Note:
See TracChangeset
for help on using the changeset viewer.