在SUSHI下如何录入Narrative文本
如下是我第一次编写时的错误写法,把Narrative当成字符串来使用:
* text = "以文本形式记录遗传病史。"
毫无疑问的给出错误提示:
**error** Cannot assign string value: <p>无。</p>. Value does not match element type: Narrative
查看sushi的代码发现了Narrative的定义如下:
/**
 * Represents the FHIR R4 data type Narrative.
 *
 * @see {@link http://hl7.org/fhir/R4/narrative.html#Narrative}
 */
export declare type Narrative = {
    status: 'generated' | 'extensions' | 'additional' | 'empty';
    div: string;
};
继续更改如下写法:
* text
  * status = #additional
  * div = "以文本形式记录遗传病史。"
继续报错:
//**error** Cannot assign string value: 以文本形式记录遗传病史。. Value does not match element type: xhtml
//**error** Element Composition.section.text.div has minimum cardinality 1 but occurs 0 time(s).
虽然div的定义为string,但是要求格式必须符合xhtml的正则表达式定义。继续修改:
* text
  * status = #additional
  * div = "<p>以文本形式记录遗传病史。</p>"
这回编译不报错了。但是看了最终的编译结果,还是不符合预期:
<section>
    <title value="遗传病史"/>
    <code>
      <coding>
        <system value="http://loinc.org"/>
        <code value="74042-3"/>
        <display value="Genetic diseases history panel Family member"/>
      </coding>
    </code>
    <text>
      <status value="additional"/>
      <p>无。</p>
    </text>
  </section>
编译器并没有把外层的
标签自动补全。
    
最后,附上正确的写法:
* section[6]
  * title = "遗传病史"
  * code = LOINC#74042-3 "Genetic diseases history panel Family member"
  * text
    * status = #additional
    * div = "<div xmlns="http://www.w3.org/1999/xhtml">以文本形式记录遗传病史。</div>"
 About Daxia
                                About Daxia