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

BEHOVMC.m

Go to the documentation of this file.
BEHOVMC ;IHS/MSC/MGH - CUMULATIVE VITALS/MEASUREMENTS FOR PATIENT OVER GIVEN DATE RANGE ;07-Jun-2010 09:17;MGH
 ;;1.1;BEH COMPONENTS;**001004,001005**;March 20,2007
DEV ;S %ZIS="Q",%ZIS("B")="" D ^%ZIS K %ZIS G:POP Q3 I $E(IOST)="P",'$D(IO("Q")),'$D(IO("S")) D ^%ZISC W !,?3,"PRINTED REPORTS MUST BE QUEUED!!",$C(7) G DEV
 ;I $D(IO("Q")) S (ZTSAVE("^TMP($J,"),ZTSAVE("GMRVSDT"),ZTSAVE("GMRVFDT"))="",ZTIO=ION,ZTDESC="Cumulative vital/measurement report",ZTRTN="START^GMRVSC0" D ^%ZTLOAD K IO("Q"),ZTSK,ZTIO G Q3
 ;W !!,"*** (E) - Error entry",
 W !! W:VADM(1)'="" ?$X-3,$E(VADM(1),1,15) W:VADM(2)'="" ?17,$P(VADM(2),"^",2) W:VADM(3)'="" ?30,$P(VADM(3),"^",2) W:VADM(4)'="" ?43,$P(VADM(4),"^")_" YRS"
 W:VADM(5)'="" ?51,$P(VADM(5),"^",2)
 W ?65,"VAF 10-7987j" W !,"Unit: "_$S($P(VAIN(4),"^",2)'="":$P(VAIN(4),"^",2),1:"     "),?32,"Room: "_$S($P(VAIN(5),"^")'="":$P(VAIN(5),"^"),1:"   "),!
 I '$D(BEHVHLOC) S BEHVHLOC=$P($G(^DIC(42,+$G(VAIN(4)),44)),"^")
 W "Division: "_$S(BEHVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+BEHVHLOC,3,"I"),.01,"I"),1:""),!
 Q
WRT ;
 S GMR1ST=1 K GMRSITE D DEM^VADPT,INP^VADPT S GWARD=$S($P(VAIN(4),"^",2)'="":$P(VAIN(4),"^",2),1:"   "),GBED=$S(VAIN(5)'="":$P(VAIN(5),"^"),1:"   ") D HDR^BEHOVMC2
 Q
EN3(DFN,BEHVSDT,BEHVFDT) ; APPLICATION PROGRAM INTERFACE FOR PATIENT CUMULATIVE VITALS REPORT
 ; INPUT VARIABLES:    DFN=PATIENT NUMBER
 ;                     BEHVSDT=START DATE
 ;                     BEHVFDT=FINISH DATE OF REPORT
 S BEHVOR=1
EN5 S (BEHOUT,BEHPG)=0 D DEM^VADPT,INP^VADPT S GBED=$S(VAIN(5)'="":VAIN(5),1:"   "),GWARD=$S($P(VAIN(4),"^",2)="":"   ",1:$P(VAIN(4),"^",2))
 S BEH1ST=1,BEHDATE(0)=0 D NOW^%DTC S Y=% D D^DIQ S BEHPDT=$P(Y,"@")_" ("_$P($P(Y,"@",2),":",1,2)_")",$P(BEHDSH,"-",81)=""
 N GPEDIS S GPEDIS=$O(^GMRD(120.52,"B","DORSALIS PEDIS",0)) Q:GPEDIS'>0
 K ^TMP("BEHV",$J)
 ;Find the vitals from the parameter
 S PRM="BEHOVM VITAL LIST"
 N ENT,DATA
 S ENT=$$ENT^CIAVMRPC(PRM)
 D GETLST^XPAR(.DATA,ENT,PRM,"I")
 ;F I=1:1:DATA S BEHVTYP=$G(DATA(I)) D
 S I="" F  S I=$O(DATA(I)) Q:I=""  D
 .;Get the abbreviation
 .S BEHVTYP=$G(DATA(I))
 .Q:BEHVTYP=""
 .S BEHVITY=$P($G(^BEHOVM(90460.01,BEHVTYP,0)),U,7)
 .D SETVAR
 U IO D HDR^BEHOVMC2
 I $O(^TMP("BEHV",$J,0))'>0 W !!,"No cumulative vitals data for "_$S($D(OPSPNM):ORSPNM,1:"this patient"),! S:$D(ORSPNM) BEHOUT=1 G Q3
 F BEHDATE=0:0 S BEHDATE=$O(BEHVDT(BEHDATE)) Q:BEHDATE'>0!BEHOUT  I $D(^TMP("BEHV",$J,BEHDATE)) D PRT
Q3 I IOSL'<($Y+10) F X=1:1 W ! Q:IOSL<($Y+10)
 I 'BEHOUT W ! D FOOTER^BEHOVMC
 D KVAR^VADPT K BEHVOR,VA,GBED,GWARD,^TMP("BEHV",$J),BEH1ST,BEHVTY,BEHVITY,BEHVDATE,BEHSITE,BEHDSH,BEHQUAL,BEHVX,GMRX,GX,BEHDAT,GMRLN,GMRPDT,GMRSP,GMRVDA,GMRY,%,BEHDATE
 K BEHDT,BEHPDT,BEHPG,BEHVDA,BEHVDT,BEHVHLOC,BEHVTYP,GMR1ST,GPRT,I,PRM,X,Y,AGE
 I $D(ORSPNM) K GMRPG,BEHVSDT,BEHVFDT S:$D(ZTQUEUED) ZTREQ="@" D ^%ZISC
 Q
SETVAR ;Get the vital data
 S BEHDT="" F  S BEHDT=$O(^AUPNVMSR("AE",DFN,BEHVTYP,BEHDT)) Q:BEHDT'>0  S BEHDATE=9999999-BEHDT I '(BEHDATE>BEHVFDT!(BEHDATE<BEHVSDT)) D SETND
 Q
SETND ;
 S BEHVDA="" F  S BEHVDA=$O(^AUPNVMSR("AE",DFN,BEHVTYP,BEHDT,BEHVDA)) Q:BEHVDA'>0  D SETUT
 Q
SETUT N STIM
 ;S STIM=$P($G(^AUPNVMSR(BEHVDA,0)),U,7)
 S STIM=$P($G(^AUPNVMSR(BEHVDA,12)),U,1)
 I STIM="" S STIM=BEHDATE
 S ^TMP("BEHV",$J,+$E(STIM,1,12),BEHVITY,BEHVDA)=$S('$D(^AUPNVMSR(BEHVDA,2)):0,1:+$P(^(2),"^"))
 S BEHVDT(+$E(STIM,1,12))="" Q
 Q
PRT ;PRINT V/M BY DATE/TIME
 D:IOSL<($Y+9) HDR^BEHOVMC2 Q:BEHOUT
 S Y=BEHDATE X ^DD("DD") I $P(BEHDATE,".")'=BEHDATE(0) W !,$E(BEHDATE,4,5)_"/"_$E(BEHDATE,6,7)_"/"_$E(BEHDATE,2,3) S BEHDATE(0)=$P(BEHDATE,".")
 D:IOSL<($Y+9) HDR^BEHOVMC2 Q:BEHOUT  W !,?2,$P($P(Y,"@",2),":",1,2)
 I $D(^TMP("BEHV",$J,BEHDATE)) D
 .K BEHLN,GERROR S BEHVTY="" F  S BEHVTY=$O(^TMP("BEHV",$J,BEHDATE,BEHVTY)) Q:BEHVTY=""  D
 ..S GPRT(BEHVTY)=0 I $D(^TMP("BEHV",$J,BEHDATE,BEHVTY)) D
 ...F BEHVDA=0:0 S BEHVDA=$O(^TMP("BEHV",$J,BEHDATE,BEHVTY,BEHVDA)) Q:BEHVDA'>0!BEHOUT  D SETLN^BEHOVMC2
 Q