source: WorldVistAEHR/trunk/r/HEALTH_DATA_AND_INFORMATICS-HDI/HDISVU01.m@ 1375

Last change on this file since 1375 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1HDISVU01 ;BPFO/JRP - UTILITY CALLS;12/21/2004
2 ;;1.0;HEALTH DATA & INFORMATICS;**6**;Feb 22, 2005
3 ;
4XMLTFM(XMLDT,LTZ) ;Convert XML date/time to FM date/time
5 ; Input : XMLDT - XML date/time
6 ; LTZ - Flag indicating if time should be converted to local
7 ; time (XML d/t contains time zone designation)
8 ; 0 = No (default) 1 = Yes
9 ;Output : Date/time in FileMan format
10 ; Notes : Null ("") returned on error
11 N HL7DT,FMDT
12 S XMLDT=$G(XMLDT)
13 I XMLDT="" Q ""
14 S LTZ=+$G(LTZ)
15 S LTZ=$S(LTZ:"L",1:"U")
16 ;Convert to HL7 format
17 S HL7DT=$TR($P(XMLDT,"T",1),"-")_$TR($P(XMLDT,"T",2),":")
18 ;Convert HL7 format to FileMan format
19 S FMDT=$$HL7TFM^XLFDT(HL7DT,LTZ)
20 I FMDT=-1 S FMDT=""
21 Q FMDT
22 ;
23FMTXML(FMDT,NOTIME,MIDNIGHT) ;Convert FM date/time to XML date/time
24 ; Input : FMDT - FileMan date/time
25 ; NOTIME - Flag indicating if time shouldn't be included
26 ; 0 = No (include time)(default) 1 = Yes (no time)
27 ; MIDNIGHT - Flag indicating if midnight should be used when
28 ; no time is passed in
29 ; 0 = No (leave as is)(default) 1 = Yes
30 ;Output : Date/time in XML format
31 ; Notes : Null ("") returned on error
32 N XTRNDT,XMLDT,FLAG
33 S NOTIME=+$G(NOTIME)
34 S MIDNIGHT=+$G(MIDNIGHT)
35 I $P(FMDT,".",2)="" I 'MIDNIGHT S NOTIME=1
36 I $P(FMDT,".",2)?1."0" I 'NOTIME S MIDNIGHT=1
37 ;No time overrides midnight addition
38 I NOTIME S MIDNIGHT=0
39 ;Drop time
40 S FLAG=$S(NOTIME:"7FD",1:"7FS")
41 ;Convert
42 S XTRNDT=$$FMTE^XLFDT(FMDT,FLAG)
43 ;Append midnight
44 I MIDNIGHT I $P(XTRNDT,"@",2)="" S $P(XTRNDT,"@",2)="00:00:00"
45 S XMLDT=$TR(XTRNDT,"@ /","T0-")
46 I 'NOTIME S XMLDT=XMLDT_$$TZ^XLFDT()
47 Q XMLDT
48 ;
49ERR2XTMP(NODE,DESC,TEXTARR) ;Add error info to XTMP global
50 ; Input : NODE - Namespaced node name to store info off of
51 ; (Defaults to "HDI")
52 ; DESC - Error description (short text)
53 ; TEXTARR - Array containing error text (full global ref)
54 ;Output : None
55 ; Notes : Sets the following nodes in XTMP
56 ; ^XTMP(NODE,0) = Purge Date (T+10) ^ Create Date (NOW)
57 ; ^ "HDI software issues"
58 ; ^XTMP(NODE,x,0) = Create Date (NOW) ^ DESC
59 ; ^XTMP(NODE,x,"ERR") = TEXTARR
60 S NODE=$G(NODE)
61 S:NODE="" NODE="HDI"
62 S DESC=$G(DESC)
63 S TEXTARR=$G(TEXTARR)
64 N CDATE,PDATE,SUB
65 ;Set main node in XTMP
66 S CDATE=$$NOW^XLFDT()
67 S PDATE=$$FMADD^XLFDT(CDATE,10)
68 S ^XTMP(NODE,0)=PDATE_"^"_CDATE_"^HDI software issues"
69 ;Get next error node
70 S SUB=1+$O(^XTMP(NODE,""),-1)
71 ;Set main error node
72 S ^XTMP(NODE,SUB,0)=CDATE_"^"_DESC
73 ;Store error text
74 I TEXTARR'="" M ^XTMP(NODE,SUB,"TXT")=@TEXTARR
75 ;Done
76 Q
Note: See TracBrowser for help on using the repository browser.