Vitals time extract fixed... Vitals now in date order
This commit is contained in:
parent
7dfb1ab484
commit
c2f09c1966
37
p/GPLVITAL.m
37
p/GPLVITAL.m
|
@ -45,9 +45,9 @@ EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
|
||||||
. . K @VITVMAP
|
. . K @VITVMAP
|
||||||
. . I DEBUG W "VMAP= ",VITVMAP,!
|
. . I DEBUG W "VMAP= ",VITVMAP,!
|
||||||
. . S VITPTMP=VITRSLT(VSORT(J)) ; DATE SORTED VITAL FROM RETURN ARRAY
|
. . S VITPTMP=VITRSLT(VSORT(J)) ; DATE SORTED VITAL FROM RETURN ARRAY
|
||||||
. . W "VITAL ",VSORT(J),!
|
. . I DEBUG W "VITAL ",VSORT(J),!
|
||||||
. . W VITRSLT(VSORT(J))," ",$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT"),!
|
. . I DEBUG W VITRSLT(VSORT(J))," ",$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT"),!
|
||||||
. . W $P(VITPTMP,U,4),!
|
. . I DEBUG W $P(VITPTMP,U,4),!
|
||||||
. . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
|
. . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID
|
||||||
. . I $P(VITPTMP,U,2)="HT" D
|
. . I $P(VITPTMP,U,2)="HT" D
|
||||||
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
. . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
|
||||||
|
@ -184,8 +184,8 @@ EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
|
||||||
VITSORT(V1,V2) ; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
|
VITSORT(V1,V2) ; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
|
||||||
; AS EXTRINSIC
|
; AS EXTRINSIC
|
||||||
; BOTH V1 AND V2 ARE PASSED BY REFERENCE
|
; BOTH V1 AND V2 ARE PASSED BY REFERENCE
|
||||||
; N VSRT ; TEMP FOR HASHING DATES
|
N VSRT ; TEMP FOR HASHING DATES
|
||||||
; N ZI,ZJ,ZTMP,ZCNT,ZP1,ZP2
|
N ZI,ZJ,ZTMP,ZCNT,ZP1,ZP2
|
||||||
S ZCNT=0 ; COUNTING NUMBER OF VITALS
|
S ZCNT=0 ; COUNTING NUMBER OF VITALS
|
||||||
S ZTMP="" ;
|
S ZTMP="" ;
|
||||||
F ZI=0:0 D Q:$O(V2(ZTMP))="" ; FOR EACH VITAL IN THE ARRAY
|
F ZI=0:0 D Q:$O(V2(ZTMP))="" ; FOR EACH VITAL IN THE ARRAY
|
||||||
|
@ -196,14 +196,25 @@ VITSORT(V1,V2) ; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
|
||||||
. . S ZP2=$P($P(V2(ZTMP),U,4),".",2) ; THE TIME 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(ZP1,ZP2_"00000"_ZCNT)=ZCNT ; HASH ON DATE AND TIME
|
||||||
. . ; S VSRT($P(V2(ZTMP),U,4)_"000000"_ZCNT)=ZCNT ; PULL DATE
|
. . ; S VSRT($P(V2(ZTMP),U,4)_"000000"_ZCNT)=ZCNT ; PULL DATE
|
||||||
. W "ZTMP=",ZTMP," "
|
. I DEBUG W "ZTMP=",ZTMP," "
|
||||||
S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
|
S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
|
||||||
S ZJ=""
|
I DEBUG ZWR V2
|
||||||
ZWR V2
|
I DEBUG ZWR VSRT
|
||||||
ZWR VSRT
|
N ZD,ZT ; DATA AND TIME ITERATORS
|
||||||
F ZI=1:1:ZCNT D Q:$O(VSRT(ZJ))="" ; VISIT THE ARRAY IN DATE ORDER
|
N ZDONE ; DONE FLAG
|
||||||
. ; S ZJ=$O(VSRT(ZJ)) ; NEXT DATE
|
S (ZD,ZT)=""
|
||||||
. ; S V1(ZI)=VSRT(ZJ) ; ASSIGN INDEX OF NEXT DATE
|
S ZDONE=0
|
||||||
. S V1(ZI)=ZI ; PLUG FOR NOW, DATES NOT SORTED
|
N ZZCNT S ZZCNT=0 ; ANOTHER COUNTER
|
||||||
|
F ZI=0:0 D Q:ZDONE ; VISIT THE ARRAY IN DATE ORDER
|
||||||
|
. S ZD=$O(VSRT(ZD)) ; NEXT DATE
|
||||||
|
. I ZD="" S ZDONE=1
|
||||||
|
. I 'ZDONE D ; MORE DATES
|
||||||
|
. . S ZT="" ; WANT FIRST TIME FOR THIS DATE
|
||||||
|
. . F ZJ=0:0 D Q:$O(VSRT(ZD,ZT))="" ; LOOP THROUGH ALL TIMES
|
||||||
|
. . . S ZT=$O(VSRT(ZD,ZT)) ; NEXT TIME
|
||||||
|
. . . 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
|
||||||
Q ZCNT
|
Q ZCNT
|
||||||
;
|
;
|
Loading…
Reference in New Issue