2008-08-29 13:48:03 -04:00
|
|
|
GPLVITAL ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/16/08
|
2008-07-23 15:16:41 -04:00
|
|
|
;;0.1;CCDCCR;;JUL 16,2008;
|
|
|
|
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
|
|
|
|
;General Public License See attached copy of the License.
|
|
|
|
;
|
|
|
|
;This program is free software; you can redistribute it and/or modify
|
|
|
|
;it under the terms of the GNU General Public License as published by
|
|
|
|
;the Free Software Foundation; either version 2 of the License, or
|
|
|
|
;(at your option) any later version.
|
|
|
|
;
|
|
|
|
;This program is distributed in the hope that it will be useful,
|
|
|
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
;You should have received a copy of the GNU General Public License along
|
|
|
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
;
|
2008-07-16 14:42:13 -04:00
|
|
|
W "NO ENTRY FROM TOP",!
|
|
|
|
Q
|
|
|
|
;
|
2008-07-23 15:16:41 -04:00
|
|
|
EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
|
2008-07-03 21:02:47 -04:00
|
|
|
;
|
|
|
|
; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
2008-08-29 13:48:03 -04:00
|
|
|
; IVITXML CONTAINS ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
|
2008-07-03 21:02:47 -04:00
|
|
|
;
|
2008-08-29 13:48:03 -04:00
|
|
|
N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF,VORDR
|
2008-07-03 21:02:47 -04:00
|
|
|
D VITALS^ORQQVI(.VITRSLT,DFN,"","")
|
2008-08-12 14:45:52 -04:00
|
|
|
I $P(VITRSLT(1),U,2)="No vitals found." D ; NULL RESULT FROM RPC
|
|
|
|
. W "NO VITALS FOUND FROM VITALS RPC",!
|
2008-08-12 13:37:18 -04:00
|
|
|
. S @VITOUTXML@(0)=0
|
|
|
|
. Q
|
2008-08-29 13:56:45 -04:00
|
|
|
I $P(VITRSLT(1),U,2)="No vitals found." Q ; QUIT
|
2008-07-03 21:02:47 -04:00
|
|
|
; ZWR RPCRSLT
|
2008-07-07 01:30:04 -04:00
|
|
|
S VITTVMAP=$NA(^TMP("GPLCCR",$J,"VITALS"))
|
|
|
|
S VITTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
|
2008-08-19 20:47:22 -04:00
|
|
|
K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
|
2008-08-30 13:29:46 -04:00
|
|
|
N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
|
|
|
|
D VITDATES(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
|
|
|
|
I DEBUG ZWR VDATES ;DEBUG
|
|
|
|
S VCNT=$$SORTDT^CCRUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
|
|
|
|
; DATE ORDER AND COUNT THEM. VSORT CONTAINS INDIRECT INDEXES ONLY
|
2008-08-29 13:48:03 -04:00
|
|
|
F J=1:1:VCNT D ; FOR EACH VITAL IN THE LIST
|
|
|
|
. I $D(VITRSLT(VSORT(J))) D
|
2008-07-03 21:02:47 -04:00
|
|
|
. . S VITVMAP=$NA(@VITTVMAP@(J))
|
|
|
|
. . K @VITVMAP
|
2008-07-25 22:01:34 -04:00
|
|
|
. . I DEBUG W "VMAP= ",VITVMAP,!
|
2008-08-29 13:48:03 -04:00
|
|
|
. . S VITPTMP=VITRSLT(VSORT(J)) ; DATE SORTED VITAL FROM RETURN ARRAY
|
2008-08-29 15:00:11 -04:00
|
|
|
. . I DEBUG W "VITAL ",VSORT(J),!
|
|
|
|
. . I DEBUG W VITRSLT(VSORT(J))," ",$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT"),!
|
|
|
|
. . I DEBUG W $P(VITPTMP,U,4),!
|
2008-08-29 13:48:03 -04:00
|
|
|
. . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
|
2008-07-03 21:02:47 -04:00
|
|
|
. . I $P(VITPTMP,U,2)="HT" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="248327008"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-07 09:51:27 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
|
|
|
|
. . E I $P(VITPTMP,U,2)="WT" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="107647005"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-07 09:51:27 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
|
2008-07-14 08:14:23 -04:00
|
|
|
. . E I $P(VITPTMP,U,2)="BP" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="392570002"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
|
|
|
|
. . E I $P(VITPTMP,U,2)="T" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="309646008"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="F"
|
|
|
|
. . E I $P(VITPTMP,U,2)="R" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="366147009"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
|
|
|
|
. . E I $P(VITPTMP,U,2)="P" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="366199006"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
|
|
|
|
. . E I $P(VITPTMP,U,2)="PN" D
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="22253000"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
|
2008-07-03 21:02:47 -04:00
|
|
|
. . E D
|
|
|
|
. . . ;W "IN VITAL: OTHER",!
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
|
2008-07-14 08:14:23 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="UNKNOWN"
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
|
2008-07-07 09:51:27 -04:00
|
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
|
|
|
|
. . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
|
2008-07-23 15:16:41 -04:00
|
|
|
. . . ;S @VITVMAP@("VITALSIGNSCODEVERSION")=""
|
2008-07-07 09:51:27 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
|
2008-07-03 21:02:47 -04:00
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
|
|
|
|
. . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
|
|
|
|
. . S VITARYTMP=$NA(@VITTARYTMP@(J))
|
|
|
|
. . K @VITARYTMP
|
|
|
|
. . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
|
|
|
|
. . I J=1 D ; FIRST ONE IS JUST A COPY
|
|
|
|
. . . ; W "FIRST ONE",!
|
|
|
|
. . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
|
2008-07-25 22:01:34 -04:00
|
|
|
. . . W "VITOUTXML ",VITOUTXML,!
|
2008-07-03 21:02:47 -04:00
|
|
|
. . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
|
|
|
. . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
|
|
|
|
; ZWR ^TMP($J,"VITALS",*)
|
2008-07-25 22:01:34 -04:00
|
|
|
ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
|
2008-08-19 16:50:47 -04:00
|
|
|
I DEBUG D PARY^GPLXPATH(VITOUTXML)
|
2008-07-03 21:02:47 -04:00
|
|
|
N VITTMP,I
|
|
|
|
D MISSING^GPLXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
|
|
|
|
I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
|
|
|
. W "VITALS MISSING ",!
|
|
|
|
. F I=1:1:VITTMP(0) W VITTMP(I),!
|
|
|
|
Q
|
|
|
|
;
|
2008-08-30 13:29:46 -04:00
|
|
|
VITSORT(V1,V2) ; DEPRECATED USE $$RSORTDT^CCRUTIL
|
|
|
|
; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
|
2008-08-29 13:48:03 -04:00
|
|
|
; AS EXTRINSIC
|
|
|
|
; BOTH V1 AND V2 ARE PASSED BY REFERENCE
|
2008-08-29 15:00:11 -04:00
|
|
|
N VSRT ; TEMP FOR HASHING DATES
|
|
|
|
N ZI,ZJ,ZTMP,ZCNT,ZP1,ZP2
|
2008-08-29 13:48:03 -04:00
|
|
|
S ZCNT=0 ; COUNTING NUMBER OF VITALS
|
|
|
|
S ZTMP="" ;
|
2008-08-30 13:29:46 -04:00
|
|
|
F ZI=0:0 D Q:$O(V2(ZTMP))="" ; FOR EACH VITAL IN THE ARRAY
|
2008-08-29 13:48:03 -04:00
|
|
|
. S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
|
|
|
|
. S ZTMP=$O(V2(ZTMP)) ; NEXT VITAL
|
|
|
|
. I $D(V2(ZTMP)) D ; IF THE RESULT EXISTS
|
|
|
|
. . S ZP1=$P($P(V2(ZTMP),U,4),".",1) ; THE DATE PIECE
|
|
|
|
. . S ZP2=$P($P(V2(ZTMP),U,4),".",2) ; THE TIME PIECE
|
|
|
|
. . S VSRT(ZP1,ZP2_"00000"_ZCNT)=ZCNT ; HASH ON DATE AND TIME
|
|
|
|
. . ; S VSRT($P(V2(ZTMP),U,4)_"000000"_ZCNT)=ZCNT ; PULL DATE
|
2008-08-29 15:00:11 -04:00
|
|
|
. I DEBUG W "ZTMP=",ZTMP," "
|
2008-08-29 13:48:03 -04:00
|
|
|
S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
|
2008-08-29 15:00:11 -04:00
|
|
|
I DEBUG ZWR V2
|
|
|
|
I DEBUG ZWR VSRT
|
|
|
|
N ZD,ZT ; DATA AND TIME ITERATORS
|
|
|
|
N ZDONE ; DONE FLAG
|
|
|
|
S (ZD,ZT)=""
|
|
|
|
S ZDONE=0
|
|
|
|
N ZZCNT S ZZCNT=0 ; ANOTHER COUNTER
|
2008-08-30 13:29:46 -04:00
|
|
|
F ZI=0:0 D Q:ZDONE ; VISIT THE ARRAY IN DATE ORDER
|
2008-08-30 08:48:44 -04:00
|
|
|
. S ZD=$O(VSRT(ZD),-1) ; NEXT DATE
|
2008-08-29 15:00:11 -04:00
|
|
|
. I ZD="" S ZDONE=1
|
|
|
|
. I 'ZDONE D ; MORE DATES
|
|
|
|
. . S ZT="" ; WANT FIRST TIME FOR THIS DATE
|
2008-08-30 08:48:44 -04:00
|
|
|
. . F ZJ=0:0 D Q:$O(VSRT(ZD,ZT),-1)="" ; LOOP THROUGH ALL TIMES
|
|
|
|
. . . S ZT=$O(VSRT(ZD,ZT),-1) ; NEXT TIME
|
2008-08-29 15:00:11 -04:00
|
|
|
. . . S ZZCNT=ZZCNT+1 ; INCREMENT COUNTER
|
|
|
|
. . . S V1(ZZCNT)=VSRT(ZD,ZT) ; PULL OUT THE INDEX
|
|
|
|
. ; S V1(ZI)=ZI ; PLUG FOR NOW, DATES NOT SORTED
|
|
|
|
I DEBUG ZWR V1
|
2008-08-29 13:48:03 -04:00
|
|
|
Q ZCNT
|
2008-08-30 13:29:46 -04:00
|
|
|
;
|
|
|
|
VITDATES(VDT) ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
|
|
|
|
; OF DATES IN THE VITALS RESULTS
|
|
|
|
N VDTI,VDTJ,VTDCNT
|
|
|
|
S VTDCNT=0 ; COUNT TO BUILD ARRAY
|
|
|
|
S VDTJ="" ; USED TO VISIT THE RESULTS
|
|
|
|
F VDTI=0:0 D Q:$O(VITRSLT(VDTJ))="" ; VISIT ALL RESULTS
|
|
|
|
. S VDTJ=$O(VITRSLT(VDTJ)) ; NEXT RESULT
|
|
|
|
. S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
|
|
|
|
. S VDT(VTDCNT)=$P(VITRSLT(VDTJ),U,4) ; PULL OUT THE DATE
|
|
|
|
Q
|
|
|
|
;
|