无法识别指定的类型:name =' CD',namespace =' urn:hl7-org:v3

时间:2015-07-28 14:13:42

标签: xml xsd xsd-validation xsd2code xsd-1.1

我正在尝试使用自动生成的c#类反序列化XML文件。当我尝试反序列化xml文件时,我收到异常'指定的类型无法识别。'以前有没有人遇到过这个问题?非常感谢您的帮助。

我尝试加载c#类和xsd文件,但它们太大而无法在此加载。

c#类是使用下面的xml文件创建的xsd文件生成的。创建了两个xsd文件qrda.xsd和qrda1.xsd,并使用以下命令生成c#类(xsd qrda.xsd qrda1.xsd / c)

    <?xml version="1.0" encoding="utf-8"?>
<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="urn:hl7-org:v3"
 xmlns:voc="urn:hl7-org:v3/voc"
 xmlns:sdtc="urn:hl7-org:sdtc">
  <!-- QRDA Header -->
  <realmCode code="US"/>
  <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
  <!-- US Realm Header Template Id -->
  <templateId root="2.16.840.1.113883.10.20.22.1.1"/>
  <!-- QRDA templateId -->
  <templateId root="2.16.840.1.113883.10.20.24.1.1"/>
  <!-- QDM-based QRDA templateId -->
  <templateId root="2.16.840.1.113883.10.20.24.1.2"/>
  <!-- This is the globally unique identifier for this QRDA document -->
  <id root="96b52620-49bd-0132-cf19-4040b69a5a45"/>
  <!-- QRDA document type code -->
  <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
  <title>QRDA Incidence Report</title>
  <!-- This is the document creation time -->
  <effectiveTime value="20141108213906"/>
  <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
  <languageCode code="eng"/>
  <!-- reported patient -->
    <recordTarget>
    <patientRole>
        <id extension="12345" root="PlaceholderOrganization" />
      <addr use="HP">
          <streetAddressLine>202 Burlington Rd.</streetAddressLine>
          <city>Bedford</city>
          <state>MA</state>
          <postalCode>01730</postalCode>
          <country>US</country>
      </addr>
      <telecom use="WP" value="tel:+1-781-271-3000"/>
      <patient>
        <name>
          <given>Jesus</given>
          <family>Abbott</family>
        </name>
        <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1" codeSystemName="HL7 AdministrativeGender"/>
        <birthTime value="19380305153120"/>
          <raceCode code="1002-5" displayName="American Indian or Alaska Native" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
          <ethnicGroupCode code="2186-5" displayName="Not Hispanic or Latino" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
          <languageCommunication>
            <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
            <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
            <languageCode code="eng"/>
          </languageCommunication>
      </patient>
    </patientRole>
  </recordTarget>

  <!-- Example of an author who is a device -->
    <author>
      <time value="20141108213906"/>
      <assignedAuthor>
        <!-- id extension="Cypress" root="2.16.840.1.113883.19.5"/ -->
        <!-- NPI -->
        <id extension="FakeNPI" root="2.16.840.1.113883.4.6"/>
        <addr>
          <streetAddressLine>202 Burlington Rd.</streetAddressLine>
          <city>Bedford</city>
          <state>MA</state>
          <postalCode>01730</postalCode>
          <country>US</country>
        </addr>
        <telecom use="WP" value="tel:(781)271-3000"/>
        <assignedAuthoringDevice>
          <manufacturerModelName>Cypress</manufacturerModelName >
          <softwareName>Cypress</softwareName >
        </assignedAuthoringDevice >
      </assignedAuthor>
    </author>
    <custodian>
      <assignedCustodian>
        <representedCustodianOrganization>
          <id root="2.16.840.1.113883.19.5"/>
          <name>Cypress Test Deck</name>
          <telecom use="WP" value="tel:(781)271-3000"/>
          <addr>
            <streetAddressLine>202 Burlington Rd.</streetAddressLine>
            <city>Bedford</city>
            <state>MA</state>
            <postalCode>01730</postalCode>
            <country>US</country>
          </addr>
        </representedCustodianOrganization>
      </assignedCustodian>
    </custodian>
    <legalAuthenticator>
      <time value="20141108213906"/>
      <signatureCode code="S"/>
      <assignedEntity>
        <id root="bc01a5d1-3a34-4286-82cc-43eb04c972a7"/>
        <addr>
          <streetAddressLine>202 Burlington Rd.</streetAddressLine>
          <city>Bedford</city>
          <state>MA</state>
          <postalCode>01730</postalCode>
          <country>US</country>
        </addr>
        <telecom use="WP" value="tel:(781)271-3000"/>
        <assignedPerson>
          <name>
             <given>Henry</given>
             <family>Seven</family>
          </name>
       </assignedPerson>
        <representedOrganization>
          <id root="2.16.840.1.113883.19.5"/>
          <name>Cypress</name>
        </representedOrganization>
      </assignedEntity>
    </legalAuthenticator>

  <documentationOf typeCode="DOC">
  <serviceEvent classCode="PCPR"> <!-- care provision -->
    <!-- No provider data found in the patient record
         putting in a fake provider -->
    <effectiveTime>
      <low value="20020716"/>
      <high value="20141108213906"/>
    </effectiveTime>
    <!-- You can include multiple performers, each with an NPI, TIN, CCN. -->
    <performer typeCode="PRF"> 
      <time>
        <low value="20020716"/>
        <high value="20141108213906"/>
      </time>
      <assignedEntity>
        <!-- This is the provider NPI -->
        <id root="2.16.840.1.113883.4.6" extension="111111111" /> 
        <representedOrganization>
          <!-- This is the organization TIN -->
          <id root="2.16.840.1.113883.4.2" extension="1234567" /> 
          <!-- This is the organization CCN -->
          <id root="2.16.840.1.113883.4.336" extension="54321" /> 
        </representedOrganization>
      </assignedEntity>
    </performer>
  </serviceEvent>
</documentationOf>

  <component>
    <structuredBody>
            <component>
        <section>
          <!-- 
            *****************************************************************
            Measure Section
            *****************************************************************
          -->
          <!-- This is the templateId for Measure Section -->
          <templateId root="2.16.840.1.113883.10.20.24.2.2"/>
          <!-- This is the templateId for Measure Section QDM -->
          <templateId root="2.16.840.1.113883.10.20.24.2.3"/>
          <!-- This is the LOINC code for "Measure document". This stays the same for all measure section required by QRDA standard -->
          <code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
          <title>Measure Section</title>
          <text>
            <table border="1" width="100%">
              <thead>
                <tr>
                  <th>eMeasure Title</th>
                  <th>Version neutral identifier</th>
                  <th>eMeasure Version Number</th>
                  <th>Version specific identifier</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>Thrombolytic Therapy</td>
                  <td>2838875A-07B5-4BF0-BE04-C3EB99F53975</td>
                  <td>4</td>
                  <td>40280381-446B-B8C2-0144-95DE69F81CF4</td>
                  <td></td>
                </tr>
              </tbody>
            </table>
          </text>
          <!-- 1..* Organizers, each containing a reference to an eMeasure -->
          <entry>
            <organizer classCode="CLUSTER" moodCode="EVN">
              <!-- This is the templateId for Measure Reference -->
              <templateId root="2.16.840.1.113883.10.20.24.3.98"/>
              <!-- This is the templateId for eMeasure Reference QDM -->
              <templateId root="2.16.840.1.113883.10.20.24.3.97"/>
              <statusCode code="completed"/>
              <!-- Containing isBranch external references -->
              <reference typeCode="REFR">
                <externalDocument classCode="DOC" moodCode="EVN">
                  <!-- SHALL: This is the version specific identifier for eMeasure: QualityMeasureDocument/id it is a GUID-->
                  <id root="40280381-446B-B8C2-0144-95DE69F81CF4"/>
                  <!-- SHOULD This is the title of the eMeasure -->
                  <text>Thrombolytic Therapy</text>
                  <!-- SHOULD: setId is the eMeasure version neutral id  -->
                  <setId root="2838875A-07B5-4BF0-BE04-C3EB99F53975"/>
                  <!-- This is the sequential eMeasure Version number -->
                  <versionNumber value="4"/>                  
                </externalDocument>
              </reference>
            </organizer>
          </entry>
        </section>
      </component>

            <component>
        <section>
          <!-- This is the templateId for Reporting Parameters section -->
          <templateId root="2.16.840.1.113883.10.20.17.2.1"/>
          <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
          <title>Reporting Parameters</title>
          <text>
            <list>
              <item>Reporting period: January 1st, 2013 00:00 - December 31st, 2013 23:59</item>
            </list>
          </text>
          <entry typeCode="DRIV">
            <act classCode="ACT" moodCode="EVN">
              <!-- This is the templateId for Reporting Parameteres Act -->
              <templateId root="2.16.840.1.113883.10.20.17.3.8"/>
              <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
              <effectiveTime>
                <low value="20130101000000"/>
                <high value="20131231235959"/>
              </effectiveTime>
            </act>
          </entry>
        </section>
      </component>
            <component>
        <section>
          <!-- This is the templateId for Patient Data section -->
          <templateId root="2.16.840.1.113883.10.20.17.2.4"/>
          <!-- This is the templateId for Patient Data QDM section -->
          <templateId root="2.16.840.1.113883.10.20.24.2.1"/>
          <code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
          <title>Patient Data</title>
          <text>

          </text>

<entry>
  <encounter classCode="ENC" moodCode="EVN">
    <!--  Encounter activities template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
    <!-- Encounter performed template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.23"/>
    <id root="1.3.6.1.4.1.115" extension="54272ceb637970595b9c0000"/>
    <code code="4525004" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.292"><originalText>Encounter, Performed: Emergency Department Visit</originalText></code>
    <text>Encounter, Performed: Emergency Department Visit</text>
    <statusCode code="completed"/>
    <effectiveTime>
      <!-- We try to look for the admit/discharge times on the encounter if they are
           there. If not, we fall back to the typical start/end date. -->
      <low value='20130112170120'/>
      <high value='20130112210120'/>
    </effectiveTime>

    <participant typeCode="LOC">
      <!-- Facility Location template -->
      <templateId root="2.16.840.1.113883.10.20.24.3.100"/>
      <time>
        <!-- Attribute: facility location arrival datetime -->
        <low value='20130112170120'/>
        <!-- Attribute: facility location departure datetime -->
        <high value='20130112210120'/>
      </time>
      <participantRole classCode="SDLOC">
        <code nullFlavor="UNK"/>
        <telecom nullFlavor="UNK"/>
        <playingEntity classCode="PLC">
          <name></name>
        </playingEntity>
      </participantRole>
    </participant>



  </encounter>
</entry>
<entry>
  <encounter classCode="ENC" moodCode="EVN">
    <!--  Encounter activities template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
    <!-- Encounter performed template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.23"/>
    <id root="1.3.6.1.4.1.115" extension="54272ceb637970595b9e0000"/>
    <code code="4525004" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.292"><originalText>Encounter, Performed: Emergency Department Visit</originalText></code>
    <text>Encounter, Performed: Emergency Department Visit</text>
    <statusCode code="completed"/>
    <effectiveTime>
      <!-- We try to look for the admit/discharge times on the encounter if they are
           there. If not, we fall back to the typical start/end date. -->
      <low value='20130401150120'/>
      <high value='20130401163120'/>
    </effectiveTime>

    <participant typeCode="LOC">
      <!-- Facility Location template -->
      <templateId root="2.16.840.1.113883.10.20.24.3.100"/>
      <time>
        <!-- Attribute: facility location arrival datetime -->
        <low value='20130401150120'/>
        <!-- Attribute: facility location departure datetime -->
        <high value='20130401163120'/>
      </time>
      <participantRole classCode="SDLOC">
        <code nullFlavor="UNK"/>
        <telecom nullFlavor="UNK"/>
        <playingEntity classCode="PLC">
          <name></name>
        </playingEntity>
      </participantRole>
    </participant>



  </encounter>
</entry>
<entry>
  <encounter classCode="ENC" moodCode="EVN">
    <!--  Encounter activities template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
    <!-- Encounter performed template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.23"/>
    <id root="1.3.6.1.4.1.115" extension="54272ceb637970595ba10000"/>
    <code code="183452005" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.424"><originalText>Encounter, Performed: Non-Elective Inpatient Encounter</originalText></code>
    <text>Encounter, Performed: Non-Elective Inpatient Encounter</text>
    <statusCode code="completed"/>
    <effectiveTime>
      <!-- We try to look for the admit/discharge times on the encounter if they are
           there. If not, we fall back to the typical start/end date. -->
      <low value='20130401170120'/>
      <high value='20130404180120'/>
    </effectiveTime>
    <sdtc:dischargeDispositionCode code="10161009" 
            codeSystem="2.16.840.1.113883.6.96"/>




  </encounter>
</entry>

<entry>
  <!-- Physical Exam Finding -->
  <observation classCode="OBS" moodCode="EVN">
    <!--  Result observation template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
    <!-- Physical Exam, Finding template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.57"/>
    <id root="1.3.6.1.4.1.115" extension="54272ceb637970595ba20000"/>
    <code code="405795006" codeSystem="2.16.840.1.113883.6.96" sdtc:valueSet="2.16.840.1.113762.1.4.1045.14"><originalText>Physical Exam: Time of Symptom Onset</originalText></code>    
    <text>Physical Exam: Time of Symptom Onset</text>
    <statusCode code="completed"/>

    <effectiveTime>
      <low value='20130401140120'/>
      <high value='20130401140120'/>
    </effectiveTime>
    <value xsi:type="CD" nullFlavor="UNK"/>

  </observation>
</entry>





<entry>
  <!-- Patient Characteristic Payer -->
  <observation classCode="OBS" moodCode="EVN">
    <templateId root="2.16.840.1.113883.10.20.24.3.55"/>
    <id root="1.3.6.1.4.1.115" extension="54272ceb637970595ba50000"/>
    <code code="48768-6" codeSystemName="LOINC" codeSystem="2.16.840.1.113883.6.1" displayName="Payment source"/> 
    <statusCode code="completed"/>
    <value code="349" codeSystem="2.16.840.1.113883.3.221.5" xsi:type="CD" sdtc:valueSet="2.16.840.1.114222.4.11.3591"><originalText></originalText></value>
  </observation>            
</entry>

<entry>
  <observation classCode="OBS" moodCode="EVN">
    <!--  Problem observation template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.4"/>
    <!--  Diagnosis active template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.11"/>
    <id root="1.3.6.1.4.1.115" extension="54272ceb637970595b9b0000"/>
    <code code="282291009" displayName="diagnosis" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
    <text>Diagnosis, Active: Ischemic Stroke</text>
    <statusCode code="completed"/>
    <effectiveTime>
      <!-- Attribute: admission datetime -->
      <low value='20130401170120'/>
      <!-- Attribute: discharge datetime -->
      <high value='20130403180120'/>
    </effectiveTime>
    <priorityCode  code="63161005" 
              codeSystem="2.16.840.1.113883.6.96"
              sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.14"
              />


    <value code="111297002" codeSystem="2.16.840.1.113883.6.96" xsi:type="CD" sdtc:valueSet="2.16.840.1.113883.3.117.1.7.1.247"><originalText>Diagnosis, Active: Ischemic Stroke</originalText><translation code="433.01" codeSystem="2.16.840.1.113883.6.103"/>
<translation code="I63.00" codeSystem="2.16.840.1.113883.6.90"/>
</value>

    <entryRelationship typeCode="REFR">
      <observation classCode="OBS" moodCode="EVN">
        <!-- Problem Status (consolidation) template -->
        <templateId root="2.16.840.1.113883.10.20.22.4.6"/>
        <!-- Problem Status, Active template -->
        <templateId root="2.16.840.1.113883.10.20.24.3.94"/>
        <id root="96b8a910-49bd-0132-cf19-4040b69a5a45"/>  
        <code code="33999-4" 
          codeSystem="2.16.840.1.113883.6.1"
          codeSystemName="LOINC" 
          displayName="status"/>
        <statusCode code="completed"/>
        <value xsi:type="CD" code="55561003" 
           displayName="active"
           codeSystem="2.16.840.1.113883.6.96" 
           codeSystemName="SNOMED CT"/>
      </observation>
    </entryRelationship>
  </observation>
</entry>










        </section>
      </component>
    </structuredBody>
  </component>
</ClinicalDocument>

3 个答案:

答案 0 :(得分:0)

我对我们的CaboLabs.com CDA架构进行了验证。您的CDA中存在无效属性,请删除&#34; valueSet&#34;来自&#34;代码&#34;元素,这是无效的。

完整错误列表:

ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:sdtc}dischargeDispositionCode': This element is not expected. Expected is one of ( {urn:hl7-org:v3}priorityCode, {urn:hl7-org:v3}subject, {urn:hl7-org:v3}specimen, {urn:hl7-org:v3}performer, {urn:hl7-org:v3}author, {urn:hl7-org:v3}informant, {urn:hl7-org:v3}participant, {urn:hl7-org:v3}entryRelationship, {urn:hl7-org:v3}reference, {urn:hl7-org:v3}precondition ).
ERROR: Element '{urn:hl7-org:v3}code', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}value', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}priorityCode', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.
ERROR: Element '{urn:hl7-org:v3}value', attribute '{urn:hl7-org:sdtc}valueSet': The attribute '{urn:hl7-org:sdtc}valueSet' is not allowed.

答案 1 :(得分:0)

您从单个XML文件创建的XSD文件不太可能足以使用HL7文档(除非您使用的系统只能发布非常窄的标准子集)。

此外,&#39; CD&#39;您所遇到的问题并不容易通过您采取的方法解决。基本上,XSD验证器试图找到一种称为“CD&#39; CD”的复杂类型。你生成的XSD可能只是创建了一个xsi:type属性,但没有创建底层的complexType,要添加到这个类型=&#39; CD&#39;可以很容易地输入=&#39; PQR&#39; (或任何其他派生类型,见图)。

HL7 CD complextype derived types

您确实需要从原始HL7架构生成代码。但是我不确定xsd.exe是否适合这项工作,因为这些是大型复杂模式。 <{3}}可能会做你想要的,但它不是免费的。

答案 2 :(得分:0)

缺少支持XSD文档的位置用于转换。

您需要加载XSD文档以反序列化。