Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LEXQIP2

LEXQIP2.m

Go to the documentation of this file.
LEXQIP2 ;ISL/KER - Query - ICD Procedure - Extract ;04/21/2014
 ;;2.0;LEXICON UTILITY;**62,80**;Sep 23, 1996;Build 10
 ;               
 ; Global Variables
 ;    None
 ;               
 ; External References
 ;    $$MOR^ICDEX         ICR   5747
 ;    MD^ICDEX            ICR   5747
 ;    $$DT^XLFDT          ICR  10103
 ;    $$UP^XLFSTR         ICR  10104
 ;               
 ; Documented Integration Agreements
 ;               
 ; Local Variables NEWed or KILLed in LEXQIP
 ;     LEXINT
 ;               
 Q
MDCDRG(X,LEXCDT,LEX,LEXLEN) ; Major Diagnostic Category/DRG
 N LEXAI,LEXC,LEXDA,LEXDI,LEXEF,LEXFY,LEXI,LEXIEN,LEXL,LEXLC,LEXMDCC,LEXMDCS,LEXME,LEXMI,LEXN,LEXT
 N LEXT1,LEXT2,LEXUD,LEXUM,LEXVDT S LEXVDT=+($G(LEXCDT)) S:LEXVDT'?7N LEXVDT=$$DT^XLFDT K LEXUM,LEXUD,LEX
 S LEXLC=0,LEXIEN=+($G(X)),LEXCDT=$G(LEXCDT),LEXLEN=+($G(LEXLEN)) S:+LEXLEN'>0 LEXLEN=62 Q:LEXCDT'?7N
 D MD^ICDEX(80.1,+LEXIEN,$G(LEXCDT),.LEXMDCS,"IE")
 S LEXMDCC=0,LEXMI=0,(LEXEF,LEXFY)=$O(LEXMDCS(0)) Q:LEXFY'>0
 S LEXMI=0 F  S LEXMI=$O(LEXMDCS(LEXFY,"E",LEXMI)) Q:+LEXMI'>0  D
 . S LEXME=$G(LEXMDCS(LEXFY,"E",LEXMI)) Q:'$L(LEXME)
 . S LEXI=$O(LEX(" "),-1)+1,LEX(LEXI)=LEXME
 . S LEXDI=0 F  S LEXDI=$O(LEXMDCS(LEXFY,"E",LEXMI,LEXDI)) Q:+LEXDI'>0  D
 . . K LEXDA S LEXDA(1)=$G(LEXMDCS(LEXFY,"E",LEXMI,LEXDI))
 . . D PR^LEXQM(.LEXDA,(LEXLEN-14)) S LEXT1="    DRG "_LEXDI
 . . S LEXT1=LEXT1_$J(" ",(14-$L(LEXT1))),LEXT2=$J(" ",14)
 . . S (LEXC,LEXI)=0 F  S LEXI=$O(LEXDA(LEXI)) Q:+LEXI'>0  D
 . . . N LEXT,LEXL,LEXN,LEXAI S LEXT=$$TM^LEXQM($G(LEXDA(LEXI)))
 . . . Q:'$L(LEXT)  S LEXC=LEXC+1 S:LEXC=1 LEXL=LEXT1_LEXT S:LEXC>1 LEXL=LEXT2_LEXT
 . . . S LEXAI=$O(LEX(" "),-1)+1,LEX(LEXAI)=LEXL
 S:LEXEF?7N&($L(LEX(1))) LEX(0)=$$SD^LEXQM(LEXEF) S LEX=+($O(LEX(" "),-1))
 Q
MAJ(X,LEX) ; Major O.R. Procedures
 N LEXC,LEXCHR,LEXHDR,LEXI,LEXI1,LEXI2,LEXIDI,LEXIEN,LEXPC,LEXSTR,LEXT S LEXIEN=+($G(X)) Q:+LEXIEN'>0
 S LEXSTR=$$MOR^ICDEX(+LEXIEN) Q:'$L(LEXSTR)  D OR(LEXSTR,.LEX)
 Q
OR(X,LEX) ; O.R. Procedures
 K LEX N LEXC,LEXCHR,LEXHDR,LEXI,LEXI1,LEXI2,LEXIDI,LEXPC,LEXSTR,LEXT S LEXSTR=$G(X) Q:'$L(LEXSTR)
 S LEXHDR="Major O.R. ID",LEXPC=0,LEXCHR="" F LEXC=1:1  Q:'$L($E(LEXSTR,LEXC))  D
 . S LEXCHR=$E(LEXSTR,LEXC) Q:LEXCHR=""  F LEXI=1:1 S LEXIDI=$T(MID+LEXI),LEXIDI=$P(LEXIDI,";;",2) Q:LEXIDI="EXIT"  D
 . . S LEXI1=$$TM^LEXQM($P(LEXIDI,"=")),LEXI2=$$TM^LEXQM($P(LEXIDI,"=",2)) Q:$L(LEXI1)'=1  Q:LEXI1'=LEXCHR  Q:'$L(LEXI2)
 . . S LEXT=LEXI2 S:$D(LEXINT) LEXT=LEXT_$J(" ",(22-$L(LEXT)))_"("_LEXI1_")" S LEXPC=LEXPC+1,LEX(1,LEXPC)=$$UP^XLFSTR(LEXT)
 S:+($O(LEX(1," "),-1))>0 LEX(0)=$$UP^XLFSTR(LEXHDR),LEX(1)=$$UP^XLFSTR(LEXSTR),LEX=+($O(LEX(1," "),-1))
 Q
MID ; Major O.R. Procedures Text
 ;;1=Bowel
 ;;2=Chest
 ;;3=Lymphoma/Leukemia
 ;;4=Joint
 ;;5=Pancreas/Liver
 ;;6=Pelvic
 ;;7=Shoulder/Elbow
 ;;8=Thumb/Joint
 ;;9=Head/Neck
 ;;A=Cardio
 ;;M=Musculoskeletal
 ;;EXIT
 Q