Updated UTIL to do UTC properly; worked on DPT

This commit is contained in:
sam 2008-06-23 00:04:01 +00:00
parent 7397dc915d
commit 05e7911433
2 changed files with 62 additions and 5 deletions

View File

@ -129,5 +129,49 @@ DOB() ; Date of Birth; PUBLIC; Extrinsic
; PREREQ: PT Defined ; PREREQ: PT Defined
N DOB S DOB=$P(PT(0),"^",3) N DOB S DOB=$P(PT(0),"^",3)
; Date in FM Date Format. Convert to UTC/ISO 8601. ; Date in FM Date Format. Convert to UTC/ISO 8601.
Q $$FMDTOUTC^CCRUTIL(DOB) Q $$FMDTOUTC^CCRUTIL(DOB,"D")
;
GENDER() ; Get Gender; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(0),"^",2)
;
SSN() ; Get SSN for ID; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(0),"^",9)
;
ADDRTYPE(ADDR) ; Get Home Address; PUBLIC; Extrinsic
; Vista only stores a home address for the patient.
Q "Home"
;
ADDR1() ; Get Home Address line 1; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.11),"^",1)
;
ADDR2() ; Get Home Address line 2; PUBLIC; Extrinsic
; PREREQ: PT Defined
; Vista has Lines 2,3; CCR has only line 1,2; so compromise
Q $P(PT(.11),"^",2)_", "_$P(PT(.11),"^",3)
;
CITY() ; Get City for Home Address; PUBLIC; Extrinsic
; PREREQ: PT Defined
Q $P(PT(.11),"^",4)
;
STATE() ; Get State for Home Address; PUBLIC; Extrinsic
; PREREQ: PT Defined
; State is stored as a pointer
N STATENUM=$P(PT(.11)"^",5)
;
; State File Global is below
; ^DIC(5,D0,0)= (#.01) NAME [1] ^ (#1) ABBREVIATION [2F] ^ (#2) VA STATE CODE
; ==>[3F] ^ (#5) CAPITAL [4F] ^ (#2.1) AAC RECOGNIZED [5S] ^ (#2.2)
; ==>US STATE OR POSSESSION [6S] ^
Q $P(^DIC(5,STATENUM,0),"^",1)
;
ZIP() ; Get Zip code for Home Address
; PREREQ: PT Defined
Q $P(PT(.11),"^",6)
;
COUNTY() ; Get County for our Address
; PREREQ: PT Defined
Q $P(PT(.11),"^",7)
; ;

View File

@ -3,11 +3,24 @@ CCRUTIL ;CCRCCD/SMH - Various Utilites for generating the CCR/CCD;06/15/08
W "No Entry at Top!" Q W "No Entry at Top!" Q
FMDTOUTC(DATE) ; Convert Fileman Date to UTC Date Format; PUBLIC; Extrinsic FMDTOUTC(DATE,FORMAT) ; Convert Fileman Date to UTC Date Format; PUBLIC; Extrinsic
N UTC,Y,M,D ; UTC, Year, Month, Day ; FORMAT is Format of Date. Can be either D (Day) or DT (Date and Time)
; If not passed, or passed incorrectly, it's assumed that it is D.
; FM Date format is "YYYMMDD.HHMMSS" HHMMSS may not be supplied.
; UTC date is formatted as follows: YYYY-MM-DDThh:mm:ss_offsetfromUTC
; UTC, Year, Month, Day, Hours, Minutes, Seconds, Time offset (obtained from Mailman Site Parameters)
N UTC,Y,M,D,H,MM,S,OFF
S Y=1700+$E(DATE,1,3) S Y=1700+$E(DATE,1,3)
S M=$E(DATE,4,5) S M=$E(DATE,4,5)
S D=$E(DATE,6,7) S D=$E(DATE,6,7)
S UTC=Y_"-"_M_"-"_D S H=$E(DATE,9,10)
Q UTC S MM=$E(DATE,11,12)
S S=$E(DATE,12,13)
S OFF=$$TZ^XLFDT ; See Kernel Manual for documentation.
; If H, MM and S are empty, it means that the FM date didn't supply the time.
; In this case, set H, MM and S to "00"
S:('$L(H)&'$L(MM)&'$L(S)) (H,MM,S)="00"
S UTC=Y_"-"_M_"-"_D_"T"_H_":"_MM_":"_S_OFF
I $L(FORMAT),FORMAT="DT" Q UTC ; Date with time.
E Q $P(UTC,"T")
; ;