當前位置: 首頁>>代碼示例>>Java>>正文


Java Narrative類代碼示例

本文整理匯總了Java中org.hl7.fhir.instance.model.Narrative的典型用法代碼示例。如果您正苦於以下問題:Java Narrative類的具體用法?Java Narrative怎麽用?Java Narrative使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Narrative類屬於org.hl7.fhir.instance.model包,在下文中一共展示了Narrative類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeNarrative

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
 * 
 * @param resource
 * @return a Narrative object in the FHIR reference implementation
 */
public Narrative makeNarrative(EObject resource, String resourceName) throws MapperException
{		
	// read a template DOM and fill in its values from the resource
	Element tableEl = makeNarrativeDom(resource, resourceName);
	
	if (tableEl != null)
	{
		// make a generated Narrative
		Narrative narrative = new Narrative();
		narrative.setStatusSimple(NarrativeStatus.generated);
		
		// convert the filled template DOM to Xhtml, as in the reference implementation, and add it to the Narrative
		XhtmlNode node = makeXhtmlNode(tableEl);
		narrative.setDiv(node);			
		return narrative;
	}
	return null;
	
}
 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:25,代碼來源:FHIRSearchManager.java

示例2: makeFeedWithNarratives

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
 * 
 * @param result
 * @param manager
 * @return
 * @throws MapperException
 */
private AtomFeed makeFeedWithNarratives(EObject result, FHIRSearchManager manager) throws MapperException
{
	// convert the result into an instance of the FHIR reference model
	EPackage classModel = getMappedStructure(serverName, resourceName).getClassModelRoot();
	EcoreReferenceBridge bridge = new EcoreReferenceBridge(classModel);
	AtomFeed feed = bridge.getReferenceModelFeed(result);
	feed.setTitle(serverName);

	// set the narratives of all the resources in the feed
	for (Iterator<AtomEntry<?>> it = feed.getEntryList().iterator();it.hasNext();)
	{
		AtomEntry<?> entry = it.next();
		Resource resource = entry.getResource();
		Narrative narrative  = manager.getNarrative(entry.getId());
		if (narrative != null) resource.setText(narrative);
	}
	return feed;
}
 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:26,代碼來源:FHIRServlet.java

示例3: testNamespaces

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
@Test
@Ignore
public void testNamespaces() {
	
	Narrative type = new Narrative();
	XhtmlNode div = type.getDiv();
	div.setValue("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>");
	
	assertEquals("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>", div.getValue());

}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:12,代碼來源:XhtmlNodeTest.java

示例4: testPatientCopy

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
 * Ensuring that fields defined in {@link org.hl7.fhir.instance.model.DomainResource} and {@link org.hl7.fhir.instance.model.Resource}
 * the {@link org.hl7.fhir.instance.model.DomainResource#copy()} method is called
 */
@Test
public void testPatientCopy() {
    Patient p1 = new Patient();
    p1.setId("1001");
    p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL));

    Patient copiedPatient = p1.copy();
    String copiedPatientID = copiedPatient.getIdElement().getIdPart();
    Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus();

    assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful
    assertEquals("1001", copiedPatientID);
    assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus);
}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:19,代碼來源:DomainResourceHL7_Dstu2Test.java

示例5: getResourceBundle

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
 * 
 * @param query
 * @return
 * @throws MapperException
 */
@SuppressWarnings("unchecked")
public EObject getResourceBundle(String resourceName,  Hashtable<String,String> ids) throws MapperException
{
       Vector<EObject> resources = new Vector<EObject>();
       allNarratives = new Hashtable<String,Narrative>() ;
       for (Enumeration<String> en = ids.keys();en.hasMoreElements();)
       {
       	String fhir_id = en.nextElement();
       	
       	EObject resourceObject  = getResource(resourceName,fhir_id);
       	if (resourceObject == null) message("Failed to retrieve resource with id " + fhir_id);
       	else 
       	{
       		resources.add(resourceObject);
       		Narrative nar = makeNarrative(resourceObject,resourceName);
       		if (nar != null) allNarratives.put(fhir_id, nar);
       		else message("no narrative for resource " + resourceName);
       	}
       }
       
       // create the top AtomFeed EObject, and add the resources to it
	MDLXOReader reader = servlet.getReader(serverName, resourceName);
       EObject feedObject = ModelUtil.createModelObject("feed.AtomFeed", reader.classModel());
       EClass feedClass = ModelUtil.getNamedClass(reader.classModel(), "feed.AtomFeed");
       EStructuralFeature resourceFeature = feedClass.getEStructuralFeature(GenUtil.initialLowerCase(resourceName));
       if (resourceFeature == null) throw new MapperException("Cannot find resource feature of AtomFeed object");
       Object featureVal = feedObject.eGet(resourceFeature);
       if (featureVal instanceof EList<?>)
       	for (int i = 0; i < resources.size();i++) ((EList<EObject>)featureVal).add(resources.get(i));
       else throw new MapperException("resource feature is not a list");		
       
       
	return feedObject;
}
 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:41,代碼來源:FHIRSearchManager.java

示例6: sendResource

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
 * 
 * @param resource
 * @param response
 * @throws Exception
 */
private void sendResource(EObject resource,HttpServletResponse response, FHIRSearchManager manager, String id) throws Exception
{
	if (resource != null)
	{
		EPackage classModel = getMappedStructure(serverName, resourceName).getClassModelRoot();
		EcoreReferenceBridge bridge = new EcoreReferenceBridge(classModel);
		Resource refModelResource = bridge.makeReferenceModelResource(resource);
		Narrative narrative  = manager.makeNarrative(resource,resourceName);
		if (narrative != null) refModelResource.setText(narrative);
		sendResourceResponse(response, refModelResource);
	}
	else sendErrorResponse(response, ("Found no " + resourceName + " resource with id " + id), statusCode);
}
 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:20,代碼來源:FHIRServlet.java

示例7: testNarrative

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
@Test
public void testNarrative() {
    assertTrue(INarrative.class.isAssignableFrom(Narrative.class));
}
 
開發者ID:gajen0981,項目名稱:FHIR-Server,代碼行數:5,代碼來源:ModelInheritanceTest.java

示例8: getNarrative

import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
public Narrative getNarrative(String fhir_id) {return allNarratives.get(fhir_id);} 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:2,代碼來源:FHIRSearchManager.java


注:本文中的org.hl7.fhir.instance.model.Narrative類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。