source: WorldVistAEHR/trunk/r/CLINICAL_PROCEDURES-MD/MDUXMLU1.m@ 1432

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

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1MDUXMLU1 ; HOIFO/WAA -Utilities for XML text ; 7/26/00
2 ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
3 ; Utilities for the XML Parser
4 ;
5FILTER(DATA) ;Filter out the bad chars.
6 Q:$G(DATA)'?.E1C.E DATA
7 N RESULTS
8 S RESULTS=""
9 F Q:'$L(DATA) S:$E(DATA)'?1C RESULTS=RESULTS_$E(DATA) S DATA=$E(DATA,2,$L(DATA))
10 Q RESULTS
11VAL(DATA) ;Convert any special charcters to standard XML format
12 N DATA2,RESULT,CHAR,CHAR1,CHAR2,CNT,I
13 S RESULT="",CNT=0,I=0,DATA2=""
14 S DATA=$$FILTER(DATA)
15 F CHAR="&,amp","<,lt",">,gt","',apos",""",quot" D
16 . S CNT=$L(DATA,$P(CHAR,","))
17 . S CHAR1=$P(CHAR,","),CHAR2=$P(CHAR,",",2)
18 . S RESULT=""
19 . I CNT>1 F I=1:1:CNT D
20 . . S RESULT=RESULT_$P(DATA,CHAR1,I)
21 . . I CNT'=I S RESULT=RESULT_"&"_CHAR2_";"
22 . . Q
23 . I RESULT'="" S DATA=RESULT
24 . Q
25 I RESULT="" S RESULT=DATA
26 Q RESULT
27 ;
28CODING(TYPE,DATA) ; Coding of both CPT and ICD9
29 Q:TYPE=""
30 Q:DATA=""
31 N DATAC,I,DEFF
32 S DATAC=$L(DATA,"~")
33 S DEFF=$S(TYPE="CPT":"PROCEDURE",TYPE="ICD":"DIAGNOSIS",1:0)
34 Q:'DEFF
35 F I=1:1:DATAC D
36 . D BLDXML^MDUXMLU1(TYPE_"_CODE",$P($P(DATA,"~",I),"^",1))
37 . D BLDXML^MDUXMLU1(TYPE_"_"_DEFF,$P($P(DATA,"~",I),"^",2))
38 . D BLDXML^MDUXMLU1(TYPE_"_CODE_TYPE",$P($P(DATA,"~",I),"^",3))
39 . Q
40 Q
41HEAD ;Creat the header of the XML message
42 D XML^MDUXMLU1("<?xml version="_QUOT_"1.0"_QUOT_" encoding="_QUOT_"UTF-8"_QUOT_" ?>")
43 D XML^MDUXMLU1("<HL7_MESSAGE xmlns:xsi="_QUOT_"http://www.w3.org/2001/XMLSchema-instance"_QUOT_" xsi:noNamespaceSchemaLocation="_QUOT_"CLOB.xsd"_QUOT_">")
44 Q
45TAIL ; Complete the message
46 D XML^MDUXMLU1("</RESULTS>")
47 I ORDER=1 D XML^MDUXMLU1("</ORDER_INFORMATION>")
48 D XML^MDUXMLU1("</HL7_MESSAGE>")
49 Q
50NAME(NAME) ; Convert name
51 I NAME="" Q
52 D BLDXML^MDUXMLU1("LAST_NAME",$P(NAME,"^",1))
53 D BLDXML^MDUXMLU1("FIRST_NAME",$P(NAME,"^",2))
54 D BLDXML^MDUXMLU1("MIDDLE_NAME",$P(NAME,"^",3))
55 Q
56DATE(FIELD,DATE) ; Convert date and post as xml
57 I FIELD="" Q
58 I DATE="" Q
59 D XML^MDUXMLU1("<"_FIELD_">")
60 D BLDXML^MDUXMLU1("YEAR",$E(DATE,1,4))
61 D BLDXML^MDUXMLU1("MONTH",$E(DATE,5,6))
62 D BLDXML^MDUXMLU1("DAY",$E(DATE,7,8))
63 I $E(DATE,9,10)?2N D BLDXML^MDUXMLU1("HOUR",$E(DATE,9,10))
64 I $E(DATE,11,12)?2N D BLDXML^MDUXMLU1("MINUTE",$E(DATE,11,12))
65 I $E(DATE,13,14)?2N D BLDXML^MDUXMLU1("SECOND",$E(DATE,13,14))
66 D XML^MDUXMLU1("</"_FIELD_">")
67 Q
68BLDXML(HEAD,DATA) ;
69 Q:HEAD=""
70 Q:DATA=""
71 D XML^MDUXMLU1("<"_HEAD_">"_DATA_"</"_HEAD_">")
72 Q
73XML(XMLLINE) ; create the XML Line in the temp file to be passed
74 Q:XMLLINE=""
75 S XMLCNT=XMLCNT+1
76 S ^TMP($J,"MDHL7XML",XMLCNT)=XMLLINE
77 Q
78FILE(MDIEN) ; File off the XML data into 703.1
79 N CNT,MDDZ,LINE,LN
80 S CNT=0,CCNT=0
81 S MDDZ=$$UPDATE^MDHL7U(MDIEN)
82 Q:'MDDZ
83 F S CNT=$O(^TMP($J,"MDHL7XML",CNT)) Q:CNT<1 D
84 . S LINE=$G(^TMP($J,"MDHL7XML",CNT)) Q:LINE=""
85 . S ^MDD(703.1,MDIEN,.4,CNT,0)=LINE,CCNT=CCNT+1
86 . Q
87 S ^MDD(703.1,MDIEN,.4,0)="^^"_CCNT_"^"_CCNT_"^"_DT_"^"
88 K ^TMP($J,"MDHL7XML")
89 Q
Note: See TracBrowser for help on using the repository browser.