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

LRVRMI2A.m

Go to the documentation of this file.
LRVRMI2A ;DALOI/STAFF - LAH/TMP TO FILE #63 ;02/22/17  08:07
 ;;5.2;LAB SERVICE;**350,427,474,480**;Sep 27, 1994;Build 7
 ;
 ; Continuation of LRVRMI4 and is used for extracting results from the LAH global and storing it into LAB DATA FILE (#63).
 ;
 Q
 ;
N9 ; Process Fungus/Yeast
 N DATA,DIERR,IEN,IEN2,IEN3,ISOID,LRCMT,LRFDA,LRIEN,LRIENS,LRMSG,LRN9,LRX,R6337,STAT
 ;
 ;ZEXCEPT: LRDFN,LRDUZ,LRIDT,LRINTYPE,LRLL,LRNOW,LRPROF,LRRPTAPP,LRSTATUS
 ;
 S (IEN,IEN2,IEN3)=0
 F  S IEN=$O(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN)) Q:IEN<1  D N9A
 ;
 K LRFDA,LRMSG,LRIENS,DIERR
 S LRIEN=LRIDT_","_LRDFN_","
 I LRINTYPE=10 S LRFDA(9,63.05,LRIEN,18)=LRNOW
 S LRFDA(9,63.05,LRIEN,19.5)=$S($G(LRDUZ):LRDUZ,1:$G(DUZ))
 D FILE^DIE("","LRFDA(9)","LRMSG")
 S LRRPTAPP=1
 Q
 ;
 ;
N9A ; Process fungus yeast organism
 ;
 N DIERR,IEN2,ISOID,LRCMT,LRFDA,LRFDAIEN,LRI,LRIEN,LRIENS,LRMSG,LRN9,LRX,R6337,STAT
 ;
 ;ZEXCEPT: IEN,LRDFN,LRIDT,LRINTYPE,LRLL,LRPROF,LRSTATUS
 ;
 S LRN9=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,0))
 Q:LRN9=""
 S ISOID=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,.1))
 Q:ISOID=""
 ;
 ; Delete ISOID entry if it exists on LEDI (LRINTYPE=10) interfaces
 ; On UI interfaces update fungus/yeast for this isolate id.
 S R6337=$O(^LR(LRDFN,"MI",LRIDT,9,"C",ISOID,0))
 I R6337 D
 . K LRFDA,LRMSG,LRIENS,DIERR
 . S LRIEN=R6337_","_LRIDT_","_LRDFN_","
 . I LRINTYPE=10 D
 . . S LRFDA(9,63.37,LRIEN,.01)="@"
 . . S R6337=""
 . E  D
 . . S LRFDA(9,63.37,LRIEN,.01)=$P(LRN9,U) ; fungus/yeast
 . . I $P(LRN9,U,2)'="" S LRFDA(9,63.37,LRIEN,1)=$P(LRN9,U,2) ; quantity
 . D FILE^DIE("","LRFDA(9)","LRMSG")
 ;
 ; On LEDI (LRINTYPE=10) interfaces existing ISOID was deleted above so always add record
 I 'R6337 D
 . K LRFDA,LRMSG,LRIENS,DIERR
 . S LRIEN="+1,"_LRIDT_","_LRDFN_","
 . S LRFDA(9,63.37,LRIEN,.01)=$P(LRN9,"^") ; fungus/yeast
 . S LRFDA(9,63.37,LRIEN,.1)=ISOID
 . S LRFDA(9,63.37,LRIEN,1)=$P(LRN9,"^",2) ; quantity
 . D UPDATE^DIE("","LRFDA(9)","LRIENS","LRMSG")
 . S R6337=$G(LRIENS(1))
 ;
 Q:'R6337
 ;
 ; Store code system references for fungus
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,0,.01))
 F LRI=1:1:3 I $P(LRX,"^",LRI) D
 . N LRDATA
 . S LRDATA(.01)=LRDFN_",MI,"_LRIDT_",9,"_R6337_",0;1"
 . S LRDATA(.02)=$S(LRI<3:2,1:3),LRDATA(.03)=$P(LRX,"^",LRI),LRDATA(.04)=$P("LN^NLT^SCT","^",LRI)
 . D SETREF^LRUCSR(LRDFN,LRDATA(.01),.LRDATA,1)
 ;
 ; Store code system references for yeast quantity
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,0,.02))
 F LRI=1,2 I $P(LRX,"^",LRI) D
 . N LRDATA
 . S LRDATA(.01)=LRDFN_",MI,"_LRIDT_",9,"_R6337_"0;2"
 . S LRDATA(.02)=2,LRDATA(.03)=$P(LRX,"^",LRI),LRDATA(.04)=$P("LN^NLT","^",LRI)
 . D SETREF^LRUCSR(LRDFN,LRDATA(.01),.LRDATA,1)
 ;
 ; Store performing lab
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,0,.01,1))
 I $P(LRX,"^") D SETPL^LRRPLUA(LRDFN_",MI,"_LRIDT_",9,"_R6337_",0",$P(LRX,"^"))
 ;
 S STAT=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,0,.01,0))
 D BLDSTAT^LRVRMI4A(63.05,19,STAT,.LRSTATUS)
 ;
 ; fungus/yeast comments - comments don't have status
 K LRFDA,LRFDAIEN,LRMSG,LRIENS,DIERR
 M LRCMT=^LR(LRDFN,"MI",LRIDT,9,IEN,1)
 S IEN2=0
 F  S IEN2=$O(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,1,IEN2)) Q:IEN2<1  D
 . S LRX=^TMP("LRMI",$J,LRDFN,"MI",LRIDT,9,IEN,1,IEN2,0),LRX=$S(LRX'="":LRX,1:" ")
 . I LRX'=" ",$$DUPCHK^LRVRMI3(LRLL,LRPROF,.LRCMT,LRX) Q
 . S LRIEN="+"_IEN2_","_R6337_","_LRIDT_","_LRDFN_","
 . S LRFDA(9,63.372,LRIEN,.01)=LRX
 ;
 I $D(LRFDA) D UPDATE^DIE("","LRFDA(9)","","LRMSG")
 ;
 Q
 ;
 ;
N11 ; Process Acid Fast
 N AFS,DIERR,LRFDA,LRIEN,LRIENS,LRMSG,LRX,QTY
 ;
 ;ZEXCEPT: LRDFN,LRDUZ,LRI,LRIDT,LRINTYPE,LRNOW,LRRPTAPP
 ;
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,11))
 D BLDSTAT^LRVRMI4A(63.05,23,$P(LRX,"^",2),.LRSTATUS)
 ;
 S LRIEN=LRIDT_","_LRDFN_","
 I LRINTYPE=10 S LRFDA(11,63.05,LRIEN,22)=LRNOW
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,11,0))
 S AFS=$P(LRX,"^",3),QTY=$P(LRX,U,4)
 S LRFDA(11,63.05,LRIEN,24)=AFS ; Acid Fast Stain
 ;I $L(QTY)>68 S QTY=$E(QTY,1,65)_"..."
 S LRFDA(11,63.05,LRIEN,25)=QTY ; Quantity
 S LRFDA(11,63.05,LRIEN,25.5)=$S($G(LRDUZ):LRDUZ,1:$G(DUZ))
 ; derive status
 I AFS'="" D
 . S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,11,0,.01,0))
 . D BLDSTAT^LRVRMI4A(63.05,23,$P(LRX,"^"),.LRSTATUS)
 I QTY'="" D
 . S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,11,0,.02,0))
 . D BLDSTAT^LRVRMI4A(63.05,23,$P(LRX,"^"),.LRSTATUS)
 ;
 D FILE^DIE("","LRFDA(11)","LRMSG")
 S LRRPTAPP=1
 ;
 ; Store code system references for AFB Stain
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,11,0,.01))
 F LRI=1,2 I $P(LRX,"^",LRI) D
 . N LRDATA
 . S LRDATA(.01)=LRDFN_",MI,"_LRIDT_",11,0;3"
 . S LRDATA(.02)=2,LRDATA(.03)=$P(LRX,"^",LRI),LRDATA(.04)=$P("LN^NLT","^",LRI)
 . D SETREF^LRUCSR(LRDFN,LRDATA(.01),.LRDATA,1)
 ;
 ; Store code system references for AFB quantity
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,11,0,.02))
 F LRI=1,2 I $P(LRX,"^",LRI) D
 . N LRDATA
 . S LRDATA(.01)=LRDFN_",MI,"_LRIDT_",11,0;4"
 . S LRDATA(.02)=2,LRDATA(.03)=$P(LRX,"^",LRI),LRDATA(.04)=$P("LN^NLT","^",LRI)
 . D SETREF^LRUCSR(LRDFN,LRDATA(.01),.LRDATA,1)
 ;
 Q
 ;
 ;
N12 ; Process Mycobacteria
 ;
 N DATA,DIERR,DNFLDS,FLD,IEN,IEN2,ISOID,LRCMT,LRFDA,LRIEN,LRIENS,LRMSG,LRN12,LRX,R6339,STAT
 ;
 ;ZEXCEPT: LRDFN,LRIDT,LRLL,LRPROF,LRSTATUS
 ;
 S IEN=0
 F  S IEN=$O(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN)) Q:IEN<1  D N12A
 ;
 Q
 ;
 ;
N12A ; Process mycobacteria organism
 ;
 N DATA,DIERR,DNFLDS,FLD,I,IEN2,ISOID,LRCMT,LRCSR,LRFDA,LRI,LRIEN,LRIENS,LRMSG,LRN12,LRX,R6339,STAT
 ;
 ;ZEXCEPT: IEN,LRDFN,LRIDT,LRINTYPE,LRLL,LRPROF,LRSTATUS
 ;
 S LRN12=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,0))
 Q:LRN12=""
 S ISOID=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,.1))
 Q:ISOID=""
 ;
 ; Delete ISOID entry if it exists on LEDI (LRINTYPE=10) interfaces
 ; On UI interfaces update mycobacteria for this isolate id.
 S R6339=$O(^LR(LRDFN,"MI",LRIDT,12,"C",ISOID,0))
 I R6339 D
 . K LRFDA,LRMSG,LRIENS,DIERR
 . S LRIEN=R6339_","_LRIDT_","_LRDFN_","
 . I LRINTYPE=10 D
 . . S LRFDA(12,63.39,LRIEN,.01)="@"
 . . S R6339=""
 . E  D
 . . S LRFDA(12,63.39,LRIEN,.01)=$P(LRN12,U) ; mycobacteria
 . . I $P(LRN12,U,2)'="" S LRFDA(12,63.39,LRIEN,1)=$P(LRN12,U,2) ; quantity
 . D FILE^DIE("","LRFDA(12)","LRMSG")
 ;
 ; On LEDI (LRINTYPE=10) interfaces existing ISOID was deleted above so always add record
 I 'R6339 D
 . K LRFDA,LRMSG,LRIENS,DIERR
 . S LRIEN="+1,"_LRIDT_","_LRDFN_","
 . S LRFDA(12,63.39,LRIEN,.01)=$P(LRN12,"^") ; fungus/yeast
 . S LRFDA(12,63.39,LRIEN,.1)=ISOID
 . S LRFDA(12,63.39,LRIEN,1)=$P(LRN12,"^",2) ; quantity
 . D UPDATE^DIE("","LRFDA(12)","LRIENS","LRMSG")
 . S R6339=$G(LRIENS(1))
 ;
 Q:'R6339
 ;
 ; Store code system references
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,0,.01))
 F LRI=1:1:3 I $P(LRX,"^",LRI) D
 . N LRDATA
 . S LRDATA(.01)=LRDFN_",MI,"_LRIDT_",12,"_R6339_",0"
 . S LRDATA(.02)=$S(LRI<3:2,1:3),LRDATA(.03)=$P(LRX,"^",LRI),LRDATA(.04)=$P("LN^NLT^SCT","^",LRI)
 . D SETREF^LRUCSR(LRDFN,LRDATA(.01),.LRDATA,1)
 ;
 ; Store performing lab
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,0,.01,1))
 I $P(LRX,"^") D SETPL^LRRPLUA(LRDFN_",MI,"_LRIDT_",12,"_R6339_",0",$P(LRX,"^"))
 ;
 S STAT=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,0,.01,0))
 D BLDSTAT^LRVRMI4A(63.05,23,STAT,.LRSTATUS)
 ;
 ; Process comments
 K LRFDA,LRIENS,LRMSG,DIERR
 M LRCMT=^LR(LRDFN,"MI",LRIDT,12,IEN,1)
 S IEN2=0
 F  S IEN2=$O(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,1,IEN2)) Q:'IEN2  D
 . S LRX=^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,1,IEN2,0),LRX=$S(LRX'="":LRX,1:" ")
 . I LRX'=" ",$$DUPCHK^LRVRMI3(LRLL,LRPROF,.LRCMT,LRX) Q
 . S LRIEN="+"_IEN2_","_R6339_","_LRIDT_","_LRDFN_","
 . S LRFDA(12,63.4,LRIEN,.01)=LRX
 I $D(LRFDA) D UPDATE^DIE("","LRFDA(12)","","LRMSG")
 ;
 ; Add drug susceptibilities
 S IEN2=1.999999999,IEN2=2
 K LRFDA,LRIENS,LRMSG,DIERR
 F  S IEN2=$O(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,IEN2)) Q:'IEN2  D  ;
 . S STAT=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,IEN2,.01,0))
 . D BLDSTAT^LRVRMI4A(63.05,23,STAT,.LRSTATUS)
 . S LRIEN=R6339_","_LRIDT_","_LRDFN_","
 . S DATA=^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,IEN2)
 . S DNFLDS=$$DN2FLDS^LRVRMI4A(IEN2,,12)
 . S FLD=$P(DNFLDS,"^",1)
 . I FLD S LRFDA(12,63.39,LRIEN,FLD)=DATA
 . S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,12,IEN,IEN2,.01))
 . F I=1:1:3 I $P(LRX,"^",I) S LRCSR(IEN2_";1",$S(I<3:2,1:3),$P("LN^NLT^SCT","^",I))=$P(LRX,"^",I)
 ;
 ; File susceptibilities
 I $D(LRFDA) D FILE^DIE("","LRFDA(12)","LRMSG")
 ;
 ; Store code system references
 I $D(LRCSR) D CSR^LRVRMI4A(.LRCSR,LRDFN_",MI,"_LRIDT_",12,"_IEN_",")
 ;
 Q
 ;
 ;
N17 ; Process Virology
 N DIERR,IEN,IEN2,IEN3,LRFDA,LRIEN,LRMSG
 ;
 ;ZEXCEPT: LRDFN,LRDUZ,LRIDT,LRINTYPE,LRNOW,LRRPTAPP
 ;
 S (IEN,IEN2,IEN3)=0
 F  S IEN=$O(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,17,IEN)) Q:IEN<1  D N17A
 ;
 S LRIEN=LRIDT_","_LRDFN_","
 I LRINTYPE=10 S LRFDA(17,63.05,LRIEN,33)=LRNOW
 S LRFDA(17,63.05,LRIEN,35)=$S($G(LRDUZ):LRDUZ,1:$G(DUZ))
 D FILE^DIE("","LRFDA(17)","LRMSG")
 S LRRPTAPP=1
 Q
 ;
 ;
N17A ; Process virus
 ;
 N DIERR,ISOID,LRFDA,LRI,LRIEN,LRMSG,LRN17,LRX,R6343
 ;
 ;ZEXCEPT: IEN,LRDFN,LRIDT,LRIENS,LRINTYPE
 ;
 S LRN17=^TMP("LRMI",$J,LRDFN,"MI",LRIDT,17,IEN,0)
 Q:LRN17=""
 S ISOID=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,17,IEN,.1))
 Q:ISOID=""
 ;
 ; Delete ISOID entry if it exists on LEDI (LRINTYPE=10) interfaces
 ; On UI interfaces update virus for this isolate id.
 S R6343=$O(^LR(LRDFN,"MI",LRIDT,17,"C",ISOID,0))
 I R6343 D
 . K LRFDA,LRMSG,LRIENS,DIERR
 . S LRIEN=R6343_","_LRIDT_","_LRDFN_","
 . I LRINTYPE=10 D
 . . S LRFDA(17,63.43,LRIEN,.01)="@"
 . . S R6343=""
 . E  S LRFDA(17,63.43,LRIEN,.01)=LRN17 ; virus
 . D FILE^DIE("","LRFDA(17)","LRMSG")
 ;
 ; On LEDI (LRINTYPE=10) interfaces existing ISOID was deleted above so always add record
 I 'R6343 D
 . K LRFDA,LRMSG,LRIENS,DIERR
 . S LRIEN="+1,"_LRIDT_","_LRDFN_","
 . S LRFDA(17,63.43,LRIEN,.01)=LRN17 ; virus
 . S LRFDA(17,63.43,LRIEN,.1)=ISOID
 . D UPDATE^DIE("","LRFDA(17)","LRIENS","LRMSG")
 . S R6343=$G(LRIENS(1))
 ;
 ; Store code system references
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,17,IEN,0,.01))
 F LRI=1:1:3 I $P(LRX,"^",LRI) D
 . N LRDATA
 . S LRDATA(.01)=LRDFN_",MI,"_LRIDT_",17,"_R6343_",0"
 . S LRDATA(.02)=$S(LRI<3:2,1:3),LRDATA(.03)=$P(LRX,"^",LRI),LRDATA(.04)=$P("LN^NLT^SCT","^",LRI)
 . D SETREF^LRUCSR(LRDFN,LRDATA(.01),.LRDATA,1)
 ;
 ; Store performing lab
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,17,IEN,0,.01,1))
 I $P(LRX,"^") D SETPL^LRRPLUA(LRDFN_",MI,"_LRIDT_",17,"_R6343_",0",$P(LRX,"^"))
 ;
 S LRX=$G(^TMP("LRMI",$J,LRDFN,"MI",LRIDT,17,IEN,0,.01,0))
 D BLDSTAT^LRVRMI4A(63.05,34,$P(LRX,"^"),.LRSTATUS)
 ;
 Q