VistA-WorldVistAEHR/r/GEN_MED_OTHER-GMV/GMVGETD1.m

28 lines
1.1 KiB
Mathematica

GMVGETD1 ;HOIFO/YH-EXTRACT VITALS/MEASUREMENT RECORDS FOR A GIVEN DATE ;8/31/99 15:03
;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
;
; This routine uses the following IAs:
; <None>
;
EN1 ;CALLED FROM GMVGETD ENTRY POINT GETVM
K ^TMP($J,"GMRV")
F GMRVTY="T","P","R","BP","HT","WT","CVP","CG","PO2","PN" S GMRVITY=$O(^GMRD(120.51,"C",GMRVTY,0)) I GMRVITY>0 D SETAR
I $O(^TMP($J,"GMRV",0))'>0 K ^TMP($J,"GMRV") Q
N GJ K ^TMP("GRPC") S GJ=0
S GMRDATE=0 F S GMRDATE=$O(^TMP($J,"GMRV",GMRDATE)) Q:GMRDATE'>0 D PRT
QT ;
K ^TMP($J,"GMRV") Q
SETAR ;
I GMVTYPE'="",GMVTYPE'=GMRVTY Q
F GMRDT=0:0 S GMRDT=$O(^GMR(120.5,"AA",DFN,GMRVITY,GMRDT)) Q:GMRDT'>0 S GMRDATE=9999999-GMRDT I '(GMRDATE>GMRVFDT!(GMRDATE<GMRVSDT)) D SETND
Q
SETND ;
F GMRVDA=0:0 S GMRVDA=$O(^GMR(120.5,"AA",DFN,GMRVITY,GMRDT,GMRVDA)) Q:GMRVDA'>0 D SETUT
Q
SETUT Q:$D(^GMR(120.5,GMRVDA,2))
S ^TMP($J,"GMRV",+$E(GMRDATE,1,12),GMRVTY,GMRVDA)=""
Q
PRT ;SAVE V/M BY DATE/TIME
F GMRVTY="T","P","R","BP","HT","WT","CVP","CG","PO2","PN" I $D(^TMP($J,"GMRV",GMRDATE,GMRVTY)) F GMRVDA=0:0 S GMRVDA=$O(^TMP($J,"GMRV",GMRDATE,GMRVTY,GMRVDA)) Q:GMRVDA'>0 D SETLN^GMVGETD2
Q