rewrote Date sort routine to fix Vitals bug. debugging meds.
This commit is contained in:
parent
9a7a927275
commit
b41654cf7b
|
@ -178,8 +178,12 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
||||||
. ;
|
. ;
|
||||||
. ; --- END OF DIRECTIONS ---
|
. ; --- END OF DIRECTIONS ---
|
||||||
. ;
|
. ;
|
||||||
. S @MAP@("MEDPTINSTRUCTIONS","F")="52.41^105"
|
. ; S @MAP@("MEDPTINSTRUCTIONS","F")="52.41^105"
|
||||||
. S @MAP@("MEDFULLFILLMENTINSTRUCTIONS","F")="52.41^9"
|
. S @MAP@("MEDPTINSTRUCTIONS")=$G(^PSRX(RXIEN,"PI",1,0)) ;GPL
|
||||||
|
. W @MAP@("MEDPTINSTRUCTIONS"),!
|
||||||
|
. ; S @MAP@("MEDFULLFILLMENTINSTRUCTIONS","F")="52.41^9"
|
||||||
|
. S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")=$G(^PSRX(RXIEN,"SIG1",1,0)) ;GPL
|
||||||
|
. W @MAP@("MEDFULLFILLMENTINSTRUCTIONS"),!
|
||||||
. S @MAP@("MEDRFNO")=$$GET1^DIQ(52.41,RXIEN,13)
|
. S @MAP@("MEDRFNO")=$$GET1^DIQ(52.41,RXIEN,13)
|
||||||
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
|
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
|
||||||
. K @RESULT
|
. K @RESULT
|
||||||
|
|
94
p/CCRUTIL.m
94
p/CCRUTIL.m
|
@ -57,80 +57,24 @@ SORTDT(V1,V2,ORDR) ; DATE SORT ARRAY AND RETURN INDEX IN V1 AND COUNT
|
||||||
; 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 DATES
|
S ZCNT=V2(0) ; COUNTING NUMBER OF DATES
|
||||||
S ZTMP="" ;
|
F ZI=1:1:ZCNT D ; FOR EACH DATE IN THE ARRAY
|
||||||
F ZI=0:0 D Q:$O(V2(ZTMP))="" ; FOR EACH DATE IN THE ARRAY
|
. I $D(V2(ZI)) D ; IF THE DATE EXISTS
|
||||||
. S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
|
. . S ZP1=$P(V2(ZI),".",1) ; THE DATE PIECE
|
||||||
. S ZTMP=$O(V2(ZTMP)) ; NEXT DATE
|
. . S ZP2=$P(V2(ZI),".",2) ; THE TIME PIECE
|
||||||
. I $D(V2(ZTMP)) D ; IF THE DATE EXISTS
|
. . ; W "DATE: ",ZP1," TIME: ",ZP2,!
|
||||||
. . S ZP1=$P(V2(ZTMP),".",1) ; THE DATE PIECE
|
. . S VSRT(ZP1,ZP2,ZI)=ZI ; INDEX OF DATE, TIME AND COUNT
|
||||||
. . S ZP2=$P(V2(ZTMP),".",2) ; THE TIME PIECE
|
N ZG
|
||||||
. . S VSRT(ZP1,ZP2_"00000"_ZCNT)=ZCNT ; HASH ON DATE AND TIME
|
S ZG=$Q(VSRT(""))
|
||||||
. . ; S VSRT($P(V2(ZTMP),U,4)_"000000"_ZCNT)=ZCNT ; PULL DATE
|
F D Q:ZG="" ;
|
||||||
. I DEBUG W "ZTMP=",ZTMP," "
|
. ; W ZG,!
|
||||||
S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
|
. D PUSH^GPLXPATH("V1",@ZG)
|
||||||
; I DEBUG ZWR V2
|
. S ZG=$Q(@ZG)
|
||||||
; I DEBUG ZWR VSRT
|
I ORDR=-1 D ; HAVE TO REVERSE ORDER
|
||||||
N ZD,ZT ; DATA AND TIME ITERATORS
|
. N ZG2
|
||||||
N ZDONE ; DONE FLAG
|
. F ZI=1:1:V1(0) D ; FOR EACH ELELMENT
|
||||||
S (ZD,ZT)=""
|
. . S ZG2(V1(0)-ZI+1)=V1(ZI) ; SET IN REVERSE ORDER
|
||||||
S ZDONE=0
|
. S ZG2(0)=V1(0)
|
||||||
N UORDR ; ORDER TO USE 1=FORWARD -1=REVERSE
|
. D CP^GPLXPATH("ZG2","V1") ; COPY OVER THE NEW ARRAY
|
||||||
S UORDR=ORDR ; DIRECTION TO SORT
|
|
||||||
I ORDR="" S UORDR=1
|
|
||||||
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),UORDR) ; 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),UORDR)="" ; LOOP THROUGH ALL TIMES
|
|
||||||
. . . S ZT=$O(VSRT(ZD,ZT),UORDR) ; NEXT TIME
|
|
||||||
. . . S ZZCNT=ZZCNT+1 ; INCREMENT COUNTER
|
|
||||||
. . . S V1(ZZCNT)=VSRT(ZD,ZT) ; PULL OUT THE INDEX
|
|
||||||
Q ZCNT
|
|
||||||
;
|
|
||||||
SORTDT2(V1,V2,ORDR) ; REWRITE TO USE 3 INSTEAD OF 2 LVLS OF INDEX
|
|
||||||
; AND $Q INSTEAD OF $O
|
|
||||||
; DATE SORT ARRAY AND RETURN INDEX IN V1 AND COUNT
|
|
||||||
; AS EXTRINSIC ORDR IS 1 OR -1 FOR FORWARD OR REVERSE
|
|
||||||
; DATE AND TIME ORDER. DEFAULT IS FORWARD
|
|
||||||
; V2 IS AN ARRAY OF DATES IN FILEMAN FORMAT
|
|
||||||
; V1 IS RETURNS INDIRECT INDEXES OF V2 IN REVERSE DATE ORDER
|
|
||||||
; SO V2(V1(X)) WILL RETURN THE DATES IN DATE/TIME ORDER
|
|
||||||
; THE COUNT OF THE DATES IS RETURNED AS AN EXTRINSIC
|
|
||||||
; BOTH V1 AND V2 ARE PASSED BY REFERENCE
|
|
||||||
N VSRT ; TEMP FOR HASHING DATES
|
|
||||||
N ZI,ZJ,ZTMP,ZCNT,ZP1,ZP2
|
|
||||||
S ZCNT=0 ; COUNTING NUMBER OF DATES
|
|
||||||
S ZTMP="" ;
|
|
||||||
F ZI=0:0 D Q:$O(V2(ZTMP))="" ; FOR EACH DATE IN THE ARRAY
|
|
||||||
. S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
|
|
||||||
. S ZTMP=$O(V2(ZTMP)) ; NEXT DATE
|
|
||||||
. I $D(V2(ZTMP)) D ; IF THE DATE EXISTS
|
|
||||||
. . S ZP1=$P(V2(ZTMP),".",1) ; THE DATE PIECE
|
|
||||||
. . S ZP2=$P(V2(ZTMP),".",2) ; THE TIME PIECE
|
|
||||||
. . S VSRT(ZP1,ZP2,ZCNT)=ZCNT ; HASH ON DATE AND TIME
|
|
||||||
. I DEBUG W "ZTMP=",ZTMP," "
|
|
||||||
S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
|
|
||||||
; 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 UORDR ; ORDER TO USE 1=FORWARD -1=REVERSE
|
|
||||||
S UORDR=ORDR ; DIRECTION TO SORT
|
|
||||||
I ORDR="" S UORDR=1
|
|
||||||
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),UORDR) ; NEXT DATE fix this
|
|
||||||
. 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),UORDR)="" ; LOOP THROUGH ALL TIMES
|
|
||||||
. . . S ZT=$O(VSRT(ZD,ZT),UORDR) ; NEXT TIME
|
|
||||||
. . . S ZZCNT=ZZCNT+1 ; INCREMENT COUNTER
|
|
||||||
. . . S V1(ZZCNT)=VSRT(ZD,ZT) ; PULL OUT THE INDEX
|
|
||||||
Q ZCNT
|
Q ZCNT
|
||||||
;
|
;
|
|
@ -193,5 +193,6 @@ VITDATES(VDT) ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
|
||||||
. S VDTJ=$O(VITRSLT(VDTJ)) ; NEXT RESULT
|
. S VDTJ=$O(VITRSLT(VDTJ)) ; NEXT RESULT
|
||||||
. S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
|
. S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
|
||||||
. S VDT(VTDCNT)=$P(VITRSLT(VDTJ),U,4) ; PULL OUT THE DATE
|
. S VDT(VTDCNT)=$P(VITRSLT(VDTJ),U,4) ; PULL OUT THE DATE
|
||||||
|
S VDT(0)=VTDCNT
|
||||||
Q
|
Q
|
||||||
;
|
;
|
Loading…
Reference in New Issue