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

ORDV05X.m

Go to the documentation of this file.
ORDV05X ; slc/jdl - Microbiology Extended Extracts ;6/13/2001  11:59AM
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,208**;Dec 17, 1997
 ;;Called from ORDV05E, return ^TMP("ORM",$J in GCPR format
 ;;For Parasitology,Mycology,Mycobacteriology,Virology in GCPR
PARA ; Get Parasitology Work-up
 N DA,DIC,DIQ,DR,STATUS,PN,SN,RMK,SMEAR,COM,PARAIEN
 I $D(^LR(LRDFN,"MI",IX,5)) D
 . S DIC=63,DA=LRDFN,DA(63.05)=IX,DR=5,DR(63.05)=15,DIQ="STATUS"
 . S DIQ(0)="E" D EN^DIQ1
 . S ^TMP("ORM",$J,RPT,SS)=^TMP("ORM",$J,RPT,SS)_U_$E($P(STATUS(63.05,IX,15,"E")," ",1),1,6)
 S PN=0
 F  S PN=$O(^LR(LRDFN,"MI",IX,6,PN)) Q:+PN'>0  D
 . S PARAIEN=+^LR(LRDFN,"MI",IX,6,PN,0),SN=0
 . D IDPARA
 . F  S SN=$O(^LR(LRDFN,"MI",IX,6,PN,1,SN)) Q:+SN'>0  D IDPARA
 ; Parasitology smear/prep
 S SMEAR=0
 F  S SMEAR=$O(^LR(LRDFN,"MI",IX,24,SMEAR)) Q:SMEAR'>0  S ^TMP("ORM",$J,RPT,SS,"IMP","PARA","SMEAR",SMEAR)=^(SMEAR,0)
 ; remark
 S RMK=0
 F  S RMK=$O(^LR(LRDFN,"MI",IX,7,RMK)) Q:+RMK'>0  S ^TMP("ORM",$J,RPT,SS,"IMP","PARA","RMK",RMK)=^(RMK,0)
 Q
IDPARA ;Get parasite stage, quantity, and comment
 N DA,DIC,DIQ,DR,PARA,STAGE
 I 'SN S PARA=$S($D(EXPAND):PN_";"_$P(^LAB(61.2,PARAIEN,0),U),1:$P(^LAB(61.2,PARAIEN,0),U)),^TMP("ORM",$J,RPT,SS,"RPT",PARAIEN)="P"_U_PARA Q
 S DA=LRDFN,DA(63.05)=IX,DA(63.34)=PN,DA(63.35)=SN,DIC=63,DIQ="STAGE",DIQ(0)="E",DR=5,DR(63.05)=16,DR(63.34)=1,DR(63.35)=".01;1" D EN^DIQ1
 S ^TMP("ORM",$J,RPT,SS,"RPT",PARAIEN,SN)=STAGE(63.35,SN,.01,"E")_U_STAGE(63.35,SN,1,"E")
 ;comment
 S COM=0
 F  S COM=$O(^LR(LRDFN,"MI",IX,6,PN,1,SN,1,COM)) Q:COM'>0  S ^TMP("ORM",$J,RPT,SS,"RPT",PARAIEN,SN,COM)=^(COM,0)
 Q
MYCO ; Get Mycology Work-up
 N DA,DIC,DIQ,DR,DA,STATUS,GMW,ISO,FUN,RMK,COM,SMEAR,MYCOIEN
 I $D(^LR(LRDFN,"MI",IX,8)) D
 . S DIC=63,DA=LRDFN,DA(63.05)=IX,DR=5,DR(63.05)=19,DIQ="STATUS"
 . S DIQ(0)="E" D EN^DIQ1
 . S ^TMP("ORM",$J,RPT,SS)=^TMP("ORM",$J,RPT,SS)_U_$E($P(STATUS(63.05,IX,19,"E")," ",1),1,6)
 S ISO=0
 F  S ISO=$O(^LR(LRDFN,"MI",IX,9,ISO)) Q:+ISO'>0  D
 . S MYCOIEN=+^LR(LRDFN,"MI",IX,9,ISO,0)
 . D FNGS S ^TMP("ORM",$J,RPT,SS,"RPT",MYCOIEN)="M"_U_$S($D(EXPAND):ISO_";"_FUN,1:FUN)
 . ;comment
 . S COM=0
 . F  S COM=$O(^LR(LRDFN,"MI",IX,9,ISO,1,COM)) Q:COM'>0  S ^TMP("ORM",$J,RPT,SS,"RPT",MYCOIEN,"COM",COM)=^(COM,0)
 ; Mycology smear/prep
 S SMEAR=0
 F  S SMEAR=$O(^LR(LRDFN,"MI",IX,15,SMEAR)) Q:SMEAR'>0  S ^TMP("ORM",$J,RPT,SS,"IMP","MYCO","SMEAR",SMEAR)=^(SMEAR,0)
 ; remark
 S RMK=0
 F  S RMK=$O(^LR(LRDFN,"MI",IX,10,RMK)) Q:+RMK'>0  S ^TMP("ORM",$J,RPT,SS,"IMP","MYCO","RMK",RMK)=^(RMK,0)
 Q
FNGS N QTY
 S FUN=+^LR(LRDFN,"MI",IX,9,ISO,0),QTY=$P(^(0),U,2),FUN=$P(^LAB(61.2,FUN,0),U)
 S FUN=FUN_U_QTY
 Q
TB ; Gets Mycobacteriology Work-up
 N DA,DIC,DIQ,DR,STATUS,GMW,ISO,MB,RMK,X,Y,COM,MY,GMTB,GMTBA,TBIEN
 I $D(^LR(LRDFN,"MI",IX,11)) D
 . S DIC=63,DA=LRDFN,DA(63.05)=IX,DR=5,DR(63.05)="23;24;25",DIQ="STATUS"
 . S DIQ(0)="E" D EN^DIQ1
 . ;Status, Acid Fast Stain, Quantity
 . S ^TMP("ORM",$J,RPT,SS)=^TMP("ORM",$J,RPT,SS)_U_$E($P(STATUS(63.05,IX,23,"E")," ",1),1,6)
 . S ^TMP("ORM",$J,RPT,SS,"IMP","TB","ACID FAST STAIN")=STATUS(63.05,IX,24,"E")_U_STATUS(63.05,IX,25,"E")
 S ISO=0
 F  S ISO=$O(^LR(LRDFN,"MI",IX,12,ISO)) Q:+ISO'>0  D
 . S TBIEN=+^LR(LRDFN,"MI",IX,12,ISO,0)
 . D MYCB S ^TMP("ORM",$J,RPT,SS,"RPT",TBIEN)="TB"_U_$S($D(EXPAND):ISO_";"_MB,1:MB)
 . ;comment
 . S COM=0
 . F  S COM=$O(^LR(LRDFN,"MI",IX,12,TBIEN,1,COM)) Q:COM'>0  S ^TMP("ORM",$J,RPT,SS,"RPT",TBIEN,"COM",COM)=^(COM,0)
 . ;Susceptiblities
 . S GMTB=2
 . F  S GMTB=$O(^LR(LRDFN,"MI",IX,12,ISO,GMTB)) Q:GMTB'["2."!(GMTB="")  D
 . . S GMTBA=+$O(^DD(63.39,"GL",GMTB,1,0))
 . . S GMTBA=$$GET1^DID(63.39,GMTBA,"","LABEL")
 . . S ^TMP("ORM",$J,RPT,SS,"RPT",TBIEN,GMTB)=GMTBA_U_$P(^LR(LRDFN,"MI",IX,12,ISO,GMTB),U)
 ; remark
 S RMK=0
 F  S RMK=$O(^LR(LRDFN,"MI",IX,13,RMK)) Q:RMK=""  S ^TMP("ORM",$J,RPT,SS,"IMP","TB","RMK",RMK)=^(RMK,0)
 Q
MYCB N QTY
 S QTY=$P(^(0),U,2),MB=$P(^LAB(61.2,TBIEN,0),U)
 S MB=MB_U_QTY
 Q
VIRO ; Gets Virology Work-up
 N BUG,DA,DIC,DIQ,DR,GMW,ISO,RMK,STATUS,VIROIEN
 I $D(^LR(LRDFN,"MI",IX,16)) D
 . S DIC=63,DA=LRDFN,DA(63.05)=IX,DR=5,DR(63.05)=34,DIQ="STATUS"
 . S DIQ(0)="E" D EN^DIQ1
 . S ^TMP("ORM",$J,RPT,SS)=^TMP("ORM",$J,RPT,SS)_U_$E($P(STATUS(63.05,IX,34,"E")," ",1),1,6)
 S ISO=0
 F  S ISO=$O(^LR(LRDFN,"MI",IX,17,ISO)) Q:+ISO'>0  D
 . S VIROIEN=+^LR(LRDFN,"MI",IX,17,ISO,0)
 . D PHAGE S ^TMP("ORM",$J,RPT,SS,"RPT",VIROIEN)="V"_U_$S($D(EXPAND):ISO_";"_BUG,1:BUG)
 S RMK=0
 F  S RMK=$O(^LR(LRDFN,"MI",IX,18,RMK)) Q:RMK=""  S ^TMP("ORM",$J,RPT,SS,"IMP","VIRO","RMK",RMK)=^(RMK,0)
 Q
PHAGE S BUG=$P(^LAB(61.2,VIROIEN,0),U)
 Q