routine to look up SNOMED codes for drug allergies in the lexicon

This commit is contained in:
george 2008-10-13 03:36:54 +00:00
parent fb99fa2685
commit d06ae46075
1 changed files with 23 additions and 0 deletions

View File

@ -78,3 +78,26 @@ SORTDT(V1,V2,ORDR) ; DATE SORT ARRAY AND RETURN INDEX IN V1 AND COUNT
. D CP^GPLXPATH("ZG2","V1") ; COPY OVER THE NEW ARRAY
Q ZCNT
;
DA2SNO(RTN,DNAME) ; LOOK UP DRUG ALLERGY CODE IN ^LEX
; RETURNS AN ARRAY RTN PASSED BY REFERENCE
; THIS ROUTINE CAN BE USED AS AN RPC
; RTN(0) IS THE NUMBER OF ELEMENTS IN THE ARRAY
; RTN(1) IS THE SNOMED CODE FOR THE DRUG ALLERGY
;
N LEXIEN
I $O(^LEX(757.21,"ADIS",DNAME))'="" D ; IEN FOUND FOR THIS DRUG
. S LEXIEN=$O(^LEX(757.21,"ADIS",DNAME)) ; GET THE IEN IN THE LEXICON
. S RTN(1)=$P(^LEX(757.02,LEXIEN,0),"^",2) ; SNOMED CODE IN P2
. S RTN(0)=1 ; ONE THING RETURNED
E S RTN(0)=0 ; NOT FOUND
Q
;
DASNO(DANAME) ; PRINTS THE SNOMED CODE FOR ALLERGY TO DRUG DANAME
;
N DARTN
D DA2SNO(.DARTN,DANAME) ; CALL THE LOOKUP ROUTINE
I DARTN(0)>0 D ; GOT RESULTS
. W !,RTN(1) ;PRINT THE SNOMED CODE
E W !,"NOT FOUND",!
Q
;