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

LRAPBR5.m

Go to the documentation of this file.
LRAPBR5 ;DALOI/WTY;AUTOPSY BROWSER DISPLAY/TIU STORAGE;6/5/2001
 ;;5.2;LAB SERVICE;**259**;Sep 27, 1994
 ;
 ;This routine was copied from ^LRAPT2.  It was updated with FileMan
 ;DBS calls and modified to be used for browser display and storage
 ;of the SF515 in TIU.
 ;
MAIN ;
 N LRLLOC,LRDTDIED,LRTMP,LRNUM,LRINC,LRINC1
 S LRQUIT=0
 S:'$D(LRIENS) LRIENS=LRDFN_","
 D HEADER
 Q:LRQUIT
 D WEIGHTS
 D SPCSTD
 D JRNLREF
 D:'LRAU DIAGS
 Q
 D GLENTRY("","",1)
 D GLENTRY(LRP,"",1)
 D GLENTRY(SSN,32)
 D GLENTRY("DOB: "_DOB,52)
 S LR("F")=1
 I 'LRTIU,'+$$GET1^DIQ(63,LRIENS,14.7,"I") D  Q
 .D GLENTRY("","",1)
 .D GLENTRY("Autopsy protocol report not verified.","",1)
 .S LRQUIT=1
 S LRLLOC=$$GET1^DIQ(63,LRIENS,14.5,"E")
 S DA=LRDFN D D^LRAUAW S Y=LR(63,12) D D^LRU S LRDTDIED=Y
 D GLENTRY("Acc: "_$$GET1^DIQ(63,LRIENS,14),"",1)
 D GLENTRY("AUTOPSY DATA",32)
 D GLENTRY("Age: "_$J($$GET1^DIQ(63,LRIENS,12.5),3),52)
 D GLENTRY("Date/time Died","",1)
 D GLENTRY("Date/time of Autopsy",52)
 D GLENTRY(LRDTDIED,"",1)
 D GLENTRY($E($$GET1^DIQ(63,LRIENS,13.7,"E"),1,18),32)
 D GLENTRY($$GET1^DIQ(63,LRIENS,11,"E"),52)
 D GLENTRY("Resident: "_$$GET1^DIQ(63,LRIENS,13.5,"E"),"",1)
 D GLENTRY("Senior: "_$E($$GET1^DIQ(63,LRIENS,13.6,"E"),1,19),52)
 Q
WEIGHTS ;Display/Store Weights & Measures
 D GLENTRY("","",1)
 I $D(^LR(LRDFN,"AW")) D
 .S LRTMP="Rt--Lung--Lt  Liver Spleen  Rt--Kidney--Lt  Brain  Body "
 .S LRTMP=LRTMP_"Wt(lb)    Ht(in)"
 .D GLENTRY(LRTMP,"",1)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,18),4),"",1)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,19),4),8)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,20),5),14)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,21),5),21)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,22),4),28)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,23),4),38)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,25),4),45)
 .D GLENTRY($$GET1^DIQ(63,LRIENS,17),55)
 .D GLENTRY($$GET1^DIQ(63,LRIENS,16),68)
 F LRINC=1:1:2 D GLENTRY("","",1)
 D:$D(^LR(LRDFN,"AW")) GLENTRY("Heart(gm)",BTAB)
 I $D(^LR(LRDFN,"AV")) D
 .D GLENTRY("TV(cm)  PV(cm)  MV(cm)  AV(cm)  RV(cm)  LV(cm)",12)
 D GLENTRY("","",1)
 D GLENTRY($J($$GET1^DIQ(63,LRIENS,24),5),BTAB)
 I $D(^LR(LRDFN,"AV")) D
 .S LRNUM=12
 .F LRINC=26:1:31 D
 ..D GLENTRY($J($$GET1^DIQ(63,LRIENS,LRINC),4),LRNUM)
 ..S LRNUM=LRNUM+8
 .D GLENTRY("","",1)
 .S LRTMP="Cavities(ml): Rt--Pleural--Lt  Pericardial  Peritoneal"
 .D GLENTRY(LRTMP,"",1)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,31.2),4),14,1)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,31.1),4),25)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,31.3),4),33)
 .D GLENTRY($J($$GET1^DIQ(63,LRIENS,31.4),4),45)
 I $D(^LR(LRDFN,"AW")) D
 .D GLENTRY("","",1)
 .F LRINC=1:1:8 D
 ..S LRTMP=$$GET1^DIQ(63,LRIENS,"25."_LRINC)
 ..Q:LRTMP=""
 ..D GLENTRY($$GET1^DID(63,"25."_LRINC,"","LABEL")_": "_LRTMP,"",1)
 I $D(^LR(LRDFN,"AWI")) D
 .D GLENTRY("","",1)
 .F LRINC=1:1:5 D
 ..S LRNUM=$S(LRINC=1:25.9,1:25.9_(LRINC-1))
 ..S LRTMP=$$GET1^DIQ(63,LRIENS,LRNUM)
 ..Q:LRTMP=""
 ..D GLENTRY($$GET1^DID(63,LRNUM,"","LABEL")_": "_LRTMP,"",1)
 Q
SPCSTD ;Display/store special studies
 N LRARR,LRSPC,LRORGTS,LRIENS1,LRFLG,LRTEXT,LRCNT
 D GLENTRY("","",1)
 S (LRFLG,LRINC)=0
 F  S LRINC=$O(^LR(LRDFN,"AY",LRINC)) Q:'LRINC  D
 .S LRORGTS=$$GET1^DIQ(63.2,LRINC_","_LRIENS,".01:.01")
 .S LRINC1=0
 .F  S LRINC1=$O(^LR(LRDFN,"AY",LRINC,5,LRINC1)) Q:'LRINC1  D
 ..S LRIENS1=LRINC1_","_LRINC_","_LRIENS
 ..D GETS^DIQ(63.26,LRIENS1,".01;.03","","LRARR")
 ..M LRSPC=LRARR(63.26,LRIENS1)
 ..S LRSPC(.02)=$$GET1^DIQ(63.26,LRIENS1,.02,"E")
 ..I 'LRFLG D
 ...D GLENTRY("","",1)
 ...D GLENTRY(LRORGTS,BTAB)
 ...S LRFLG=1
 ..S LRTEXT=LRSPC(.01)_" "_LRSPC(.03)_" Date: "_LRSPC(.02)
 ..D GLENTRY(LRTEXT,"",1)
 ..K ^UTILITY($J,"W"),LRTMP
 ..S X=$$GET1^DIQ(63.26,LRIENS1,1,"","LRTMP")
 ..S DIWR=IOM-10,DIWL=10,DIWF=""
 ..S X=+$$GET1^DID(63.27,1,"","SPECIFIER","LRDBERR")
 ..I $$GET1^DID(X,.01,"","SPECIFIER")["L" S DIWF="N"
 ..S LRCNT=0 F  S LRCNT=$O(LRTMP(LRCNT)) Q:'LRCNT  D
 ...S X=LRTMP(LRCNT) D ^DIWP
 ..S LRCNT=0 F  S LRCNT=$O(^UTILITY($J,"W",DIWL,LRCNT)) Q:'LRCNT  D
 ...D GLENTRY(^UTILITY($J,"W",DIWL,LRCNT,0),DIWL,1)
 ..K ^UTILITY($J,"W")
 ..D GLENTRY("","",1)
 Q
JRNLREF ;Print journal references
 N LRFL,LRM,LRN,LRTP,LRIENS1,LRIENS2,LRIENS3,LRFILE1,LRFILE3,LRFILE4
 D GLENTRY(,,1)
 S LRINC1=0,LRFILE=63.2
 F  S LRINC1=$O(^LR(LRDFN,"AY",LRINC1)) Q:'LRINC1  D
 .S LRIENS1=LRINC1_","_LRIENS
 .S LRTP=$$GET1^DIQ(LRFILE,LRIENS1,.01,"I")
 .;Topography
 .N LRN
 .S LRFL=LRTP,LRFILE1=61 D JREFPRT
 .;Morphology
 .S LRFILE1=61.1,LRFILE3=+$$GET1^DID(LRFILE,4,"","SPECIFIER")
 .S LRM=0 F  S LRM=$O(^LR(LRDFN,"AY",LRINC1,2,LRM)) Q:'LRM  D
 ..S LRIENS2=LRM_","_LRIENS1
 ..S LRFL=$$GET1^DIQ(LRFILE3,LRIENS2,.01,"I")
 ..D JREFPRT
 ..;Etiology
 ..S LRFILE1=61.2,LRFILE4=+$$GET1^DID(LRFILE3,1,"","SPECIFIER")
 ..S LRN=0 F  S LRN=$O(^LR(LRDFN,"AY",LRINC1,2,LRM,1,LRN)) Q:'LRN  D
 ...S LRIENS3=LRN_","_LRIENS2
 ...S LRFL=$$GET1^DIQ(LRFILE4,LRIENS3,.01,"I")
 ...D JREFPRT
 .;Disease
 .S LRFILE1=61.4,LRFILE3=+$$GET1^DID(LRFILE,3,"","SPECIFIER")
 .S LRM=0 F  S LRM=$O(^LR(LRDFN,"AY",LRINC1,1,LRM)) Q:'LRM  D
 ..S LRIENS2=LRM_","_LRIENS1
 ..S LRFL=$$GET1^DIQ(LRFILE3,LRIENS2,.01,"I")
 ..D JREFPRT
 .;Function
 .S LRFILE1=61.3,LRFILE3=+$$GET1^DID(LRFILE,1,"","SPECIFIER")
 .S LRM=0 F  S LRM=$O(^LR(LRDFN,"AY",LRINC1,3,LRM)) Q:'LRM  D
 ..S LRIENS2=LRM_","_LRIENS1
 ..S LRFL=$$GET1^DIQ(LRFILE3,LRIENS2,.01,"I")
 ..D JREFPRT
 .S LRFILE1=61.5,LRFILE3=+$$GET1^DID(LRFILE,1.5,"","SPECIFIER")
 .S LRM=0 F  S LRM=$O(^LR(LRDFN,"AY",LRINC1,4,LRM)) Q:'LRM  D
 ..S LRIENS2=LRM_","_LRIENS1
 ..S LRFL=$$GET1^DIQ(LRFILE3,LRIENS2,.01,"I")
 ..D JREFPRT
 Q
JREFPRT ;
 ; Print journal reference on the patient report if the 
 ; reference is flagged for printing.
 N LRJR,LRINC
 S LRFILE2=+$$GET1^DID(LRFILE1,5,"","SPECIFIER")
 S LRJR=0 F  S LRJR=$O(^LAB(LRFILE1,LRFL,"JR",LRJR)) Q:'LRJR  D
 .S LRJR(.01)=$$GET1^DIQ(LRFILE2,LRJR_","_LRFL_",",.01)
 .F LRINC=1:1:5 D
 ..S LRJR(LRINC)=$$GET1^DIQ(LRFILE2,LRJR_","_LRFL_",",LRINC)
 .S LRJR(6)=$$GET1^DIQ(LRFILE2,LRJR_","_LRFL_",",6,"I")
 .Q:'LRJR(6)
 .D GLENTRY(,,1),GLENTRY("Reference: ",,1)
 .D GLENTRY(LRJR(.01),,1)
 .D GLENTRY(LRJR(1),,1),GLENTRY(,,1)
 .I LRJR(2)'="" D
 ..D GLENTRY(LRJR(2)_"  vol."_LRJR(3),BTAB)
 ..D GLENTRY(" pg."_LRJR(4),BTAB)
 .D GLENTRY("  Date: "_LRJR(5),BTAB)
 Q
DIAGS ;
 N LRV
 D GLENTRY("","",1)
 F LRV=81,82 D
 .D GLENTRY("","",1)
 .D:LRV=81 GLENTRY(LRAU(1),BTAB)
 .D:LRV=82 GLENTRY(LRAU(2),BTAB)
 .S LRFILE=63
 .S LRFIELD=$S(LRV=81:32.2,1:32.3)
 .D WP^LRAPBR4
 .D GLENTRY("","",1)
 Q
GLENTRY(LRPR1,LRPR2,LRPR3) ;Write to global
 ;LRPR1 = Text to be written to global
 ;LRPR2 = Tab position
 ;LRPR3 = 1 means start a new line.  Othewise, write an current line.
 S LRPR1=$G(LRPR1),LRPR2=+$G(LRPR2),LRPR3=+$G(LRPR3)
 D:LRPR3 NEWLN^LRAPUTL(LRPR1,LRPR2)
 D:'LRPR3 GLBWRT^LRAPUTL(LRPR1,LRPR2)
 Q