BEHOVMIN ;MSC/IND/DKM - Installation Support ;16-Jul-2014 10:21;MGH
;;1.1;BEH COMPONENTS;**001002,001005,001006,001010**;Mar 20, 2007
;=================================================================
PREINIT ;EP - Preinitialization
;D BEHMSR("02 SATURATION","O2 SATURATION")
Q
POSTINIT ;EP - Postinitialization
;N LP,CLS
;F LP=0:1 S CLS=$P($T(CANENTER+LP),";;",2) Q:'$L(CLS) D
;.D ADD^XPAR("CLS."_CLS,"BEHOVM DATA ENTRY",,"YES")
;D ADD^XPAR("PKG","BEHOVM USE VMSR",,$G(DUZ("AG"))="I")
;D REGMENU^BEHUTIL("BEHOVM MAIN",,"VIT")
N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,DIR
S ZTRTN="BMI^BEHOVMIN",ZTIO="",ZTSAVE("DUZ")=""
S ZTDESC="Store BMI on historical wts."
D ^%ZTLOAD
I $G(ZTSK) D
.K ^XTMP("BEHVMBMI")
.N X,X1,X2 S X1=DT,X2=30
.D C^%DTC
.S ^XTMP("BEHVMBMI",0)=X_"^"_DT_"^"
.S ^XTMP("BEHVMBMI","COUNT")=0
.W !!,"A task has been queued in the background."
.W !," The task number is "_$G(ZTSK)_"."
.W !," To check on the status of the task, in programmer mode "
.W !," type D STATUS^BEHOVMIN"
Q
; Rename .01 field of BEH Measurement file
BEHMSR(X,Y) ;
N IEN,FDA
S IEN=$O(^BEHOVM(90460.01,"B",X,0))
Q:'IEN
S FDA(90460.01,IEN_",",.01)=Y
D FILE^DIE(,"FDA")
Q
BMI ;EP-
;Loop through all Wt measurements for all patients. Get the visit IEN
;check for a BMI already on that visit. If not, calculate and store
N VTWT,IEN,NODE,VSIT,WT,VTBMI,OK,PT,WTDT,RET,CNT
S OK=0
S ^XTMP("BEHVMBMI","STARTDT")=$$NOW^XLFDT
S VTWT=$$VTYPE^BEHOVM("WT"),VTBMI=$$VTYPE^BEHOVM("BMI")
S IEN="",CNT=0
F S IEN=$O(^AUPNVMSR("B",VTWT,IEN)) Q:IEN="" D
.S NODE=$G(^AUPNVMSR(IEN,0))
.S VSIT=$P(NODE,U,3)
.Q:'VSIT
.S WT=$P(NODE,U,4)
.S PT=$P(NODE,U,2)
.S WTDT=$$GET1^DIQ(9000010.01,IEN,1201,"I")
.I WTDT="" S WTDT=$$GET1^DIQ(9000010,VSIT,.01,"I")
.Q:'WTDT
.;Check if BMI already exists on this visit; quit if true
.S OK=$$CHECK(VSIT)
.Q:+OK
.S RET=""
.D BMISAVE^BEHOVM4(.RET,PT,WT,WTDT,VSIT)
.I RET'="" D
..S CNT=CNT+1
..S ^XTMP("BEHVMBMI","COUNT")=CNT
.K RET
S ^XTMP("BEHVMBMI","ENDDT")=$$NOW^XLFDT
Q
;
CHECK(VSIT) ;See if BMI already exists
N I,RET
S RET=0
S I="" F S I=$O(^AUPNVMSR("AD",VSIT,I)) Q:'+I!(+RET) D
.I $P($G(^AUPNVMSR(I,0)),U,1)=VTBMI S RET=1
Q RET
STATUS ;check on status of VS xref indexing
I $G(^XTMP("BEHVMBMI","ENDDT")) D
. N START,END,X,Y
. W !,"Data update completed!"
. S Y=$G(^XTMP("BEHVMBMI","STARTDT")) D DD^%DT
. W !,"Task started: "_Y
. S Y=$G(^XTMP("BEHVMBMI","ENDDT")) D DD^%DT
. W !,"Task ended: "_Y
. S Y=$G(^XTMP("BEHVMBMI","COUNT"))
. W !,"Items Stored: "_Y
I '$G(^XTMP("BEHVMBMI","ENDDT")) D
. W !,"Still working on the update."
. I $G(^XTMP("BEHVMBMI","COUNT"))=0 W !,"You must have tasked it!"
Q
; List of user classes that can enter vitals by default
CANENTER ;;PROVIDER
;;NURSE
;;NURSE PRACTITIONER
;;NURSE LICENSED PRACTICAL
;;NURSING ASSISTANT
;;NURSING SUPERVISOR
;;NURSE CLINICAL SPECIALIST
;;
BEHOVMIN ;MSC/IND/DKM - Installation Support ;16-Jul-2014 10:21;MGH
+1 ;;1.1;BEH COMPONENTS;**001002,001005,001006,001010**;Mar 20, 2007
+2 ;=================================================================
PREINIT ;EP - Preinitialization
+1 ;D BEHMSR("02 SATURATION","O2 SATURATION")
+2 QUIT
POSTINIT ;EP - Postinitialization
+1 ;N LP,CLS
+2 ;F LP=0:1 S CLS=$P($T(CANENTER+LP),";;",2) Q:'$L(CLS) D
+3 ;.D ADD^XPAR("CLS."_CLS,"BEHOVM DATA ENTRY",,"YES")
+4 ;D ADD^XPAR("PKG","BEHOVM USE VMSR",,$G(DUZ("AG"))="I")
+5 ;D REGMENU^BEHUTIL("BEHOVM MAIN",,"VIT")
+6 NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,DIR
+7 SET ZTRTN="BMI^BEHOVMIN"
SET ZTIO=""
SET ZTSAVE("DUZ")=""
+8 SET ZTDESC="Store BMI on historical wts."
+9 DO ^%ZTLOAD
+10 IF $GET(ZTSK)
Begin DoDot:1
+11 KILL ^XTMP("BEHVMBMI")
+12 NEW X,X1,X2
SET X1=DT
SET X2=30
+13 DO C^%DTC
+14 SET ^XTMP("BEHVMBMI",0)=X_"^"_DT_"^"
+15 SET ^XTMP("BEHVMBMI","COUNT")=0
+16 WRITE !!,"A task has been queued in the background."
+17 WRITE !," The task number is "_$GET(ZTSK)_"."
+18 WRITE !," To check on the status of the task, in programmer mode "
+19 WRITE !," type D STATUS^BEHOVMIN"
End DoDot:1
+20 QUIT
+21 ; Rename .01 field of BEH Measurement file
BEHMSR(X,Y) ;
+1 NEW IEN,FDA
+2 SET IEN=$ORDER(^BEHOVM(90460.01,"B",X,0))
+3 IF 'IEN
QUIT
+4 SET FDA(90460.01,IEN_",",.01)=Y
+5 DO FILE^DIE(,"FDA")
+6 QUIT
BMI ;EP-
+1 ;Loop through all Wt measurements for all patients. Get the visit IEN
+2 ;check for a BMI already on that visit. If not, calculate and store
+3 NEW VTWT,IEN,NODE,VSIT,WT,VTBMI,OK,PT,WTDT,RET,CNT
+4 SET OK=0
+5 SET ^XTMP("BEHVMBMI","STARTDT")=$$NOW^XLFDT
+6 SET VTWT=$$VTYPE^BEHOVM("WT")
SET VTBMI=$$VTYPE^BEHOVM("BMI")
+7 SET IEN=""
SET CNT=0
+8 FOR
SET IEN=$ORDER(^AUPNVMSR("B",VTWT,IEN))
IF IEN=""
QUIT
Begin DoDot:1
+9 SET NODE=$GET(^AUPNVMSR(IEN,0))
+10 SET VSIT=$PIECE(NODE,U,3)
+11 IF 'VSIT
QUIT
+12 SET WT=$PIECE(NODE,U,4)
+13 SET PT=$PIECE(NODE,U,2)
+14 SET WTDT=$$GET1^DIQ(9000010.01,IEN,1201,"I")
+15 IF WTDT=""
SET WTDT=$$GET1^DIQ(9000010,VSIT,.01,"I")
+16 IF 'WTDT
QUIT
+17 ;Check if BMI already exists on this visit; quit if true
+18 SET OK=$$CHECK(VSIT)
+19 IF +OK
QUIT
+20 SET RET=""
+21 DO BMISAVE^BEHOVM4(.RET,PT,WT,WTDT,VSIT)
+22 IF RET'=""
Begin DoDot:2
+23 SET CNT=CNT+1
+24 SET ^XTMP("BEHVMBMI","COUNT")=CNT
End DoDot:2
+25 KILL RET
End DoDot:1
+26 SET ^XTMP("BEHVMBMI","ENDDT")=$$NOW^XLFDT
+27 QUIT
+28 ;
CHECK(VSIT) ;See if BMI already exists
+1 NEW I,RET
+2 SET RET=0
+3 SET I=""
FOR
SET I=$ORDER(^AUPNVMSR("AD",VSIT,I))
IF '+I!(+RET)
QUIT
Begin DoDot:1
+4 IF $PIECE($GET(^AUPNVMSR(I,0)),U,1)=VTBMI
SET RET=1
End DoDot:1
+5 QUIT RET
STATUS ;check on status of VS xref indexing
+1 IF $GET(^XTMP("BEHVMBMI","ENDDT"))
Begin DoDot:1
+2 NEW START,END,X,Y
+3 WRITE !,"Data update completed!"
+4 SET Y=$GET(^XTMP("BEHVMBMI","STARTDT"))
DO DD^%DT
+5 WRITE !,"Task started: "_Y
+6 SET Y=$GET(^XTMP("BEHVMBMI","ENDDT"))
DO DD^%DT
+7 WRITE !,"Task ended: "_Y
+8 SET Y=$GET(^XTMP("BEHVMBMI","COUNT"))
+9 WRITE !,"Items Stored: "_Y
End DoDot:1
+10 IF '$GET(^XTMP("BEHVMBMI","ENDDT"))
Begin DoDot:1
+11 WRITE !,"Still working on the update."
+12 IF $GET(^XTMP("BEHVMBMI","COUNT"))=0
WRITE !,"You must have tasked it!"
End DoDot:1
+13 QUIT
+14 ; List of user classes that can enter vitals by default
CANENTER ;;PROVIDER
+1 ;;NURSE
+2 ;;NURSE PRACTITIONER
+3 ;;NURSE LICENSED PRACTICAL
+4 ;;NURSING ASSISTANT
+5 ;;NURSING SUPERVISOR
+6 ;;NURSE CLINICAL SPECIALIST
+7 ;;