本文整理了Java中org.openmrs.Obs.setValueComplex()
方法的一些代码示例,展示了Obs.setValueComplex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.setValueComplex()
方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:setValueComplex
[英]Set the value for the ComplexData. This method is used by the ComplexObsHandler. The valueComplex has two parts separated by a bar '|' character: part A) the title; and part B) the URI. The title is the readable description of the valueComplex that is returned by Obs.getValueAsString(). The URI is the location where the ComplexData is stored.
[中]设置ComplexData的值。ComplexObsHandler使用此方法。valueComplex有两个部分,由一个“|”字符分隔:部分a)标题;第二部分是URI。标题是Obs返回的valueComplex的可读描述。getValueAsString()。URI是存储ComplexData的位置。
代码示例来源:origin: openmrs/openmrs-core
obs.setValueComplex(outfile.getName() + " file |" + outfile.getName());
代码示例来源:origin: openmrs/openmrs-core
obs.setValueComplex(outfile.getName() + " file |" + outfile.getName());
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ComplexObsHandler#saveObs(Obs)
*/
@Override
public Obs saveObs(Obs obs) throws APIException {
try {
// Write the File to the File System
String fileName = obs.getComplexData().getTitle();
InputStream in = (InputStream) obs.getComplexData().getData();
File outfile = getOutputFileToWrite(obs);
OutputStream out = new FileOutputStream(outfile, false);
OpenmrsUtil.copyFile(in, out);
// Store the filename in the Obs
obs.setComplexData(null);
obs.setValueComplex(fileName + "|" + outfile.getName());
// close the stream
out.close();
}
catch (Exception e) {
throw new APIException("Obs.error.writing.binary.data.complex", null, e);
}
return obs;
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.obs.ComplexObsHandler#saveObs(org.openmrs.Obs)
*/
@Override
public Obs saveObs(Obs obs) throws APIException {
try {
// Write the File to the File System
String fileName = obs.getComplexData().getTitle();
File outfile = getOutputFileToWrite(obs);
OutputStream out = new FileOutputStream(outfile, false);
FileInputStream mediaStream = (FileInputStream) obs.getComplexData().getData();
OpenmrsUtil.copyFile(mediaStream, out);
// Store the filename in the Obs
obs.setComplexData(null);
obs.setValueComplex(fileName + "|" + outfile.getName());
// close the stream
out.close();
}
catch (IOException ioe) {
throw new APIException("Obs.error.trying.write.complex", null, ioe);
}
return obs;
}
代码示例来源:origin: openmrs/openmrs-core
obs.setValueComplex(extension + " image |" + outfile.getName());
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsValidator#validate(java.lang.Object, org.springframework.validation.Errors)
*/
@Test
public void validate_shouldPassValidationIfFieldLengthsAreCorrect() {
Obs obs = new Obs();
obs.setPerson(Context.getPersonService().getPerson(2));
obs.setConcept(Context.getConceptService().getConcept(5089));
obs.setObsDatetime(new Date());
obs.setValueNumeric(1.0);
obs.setAccessionNumber("AccessionNumber");
obs.setValueModifier("m");
obs.setValueComplex("ValueComplex");
obs.setVoidReason("VoidReason");
obs.setComment("comment");
Errors errors = new BindException(obs, "obs");
obsValidator.validate(obs, errors);
assertFalse(errors.hasErrors());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsValidator#validate(java.lang.Object, org.springframework.validation.Errors)
*/
@Test
public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() {
Obs obs = new Obs();
obs.setPerson(Context.getPersonService().getPerson(2));
obs.setConcept(Context.getConceptService().getConcept(5089));
obs.setObsDatetime(new Date());
obs.setValueNumeric(1.0);
obs.setAccessionNumber("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
obs.setValueModifier("too long text");
obs.setValueComplex("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
obs.setVoidReason("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
obs.setComment("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
Errors errors = new BindException(obs, "obs");
obsValidator.validate(obs, errors);
assertTrue(errors.hasFieldErrors("accessionNumber"));
assertTrue(errors.hasFieldErrors("valueModifier"));
assertTrue(errors.hasFieldErrors("valueComplex"));
assertTrue(errors.hasFieldErrors("comment"));
assertTrue(errors.hasFieldErrors("voidReason"));
}
代码示例来源:origin: openmrs/openmrs-core
obs.setValueComplex("test");
obs.setValueDatetime(new Date());
obs.setValueDrug(Context.getConceptService().getDrug(3));
代码示例来源:origin: openmrs/openmrs-core
newObs.setInterpretation(obsToCopy.getInterpretation());
newObs.setValueComplex(obsToCopy.getValueComplex());
newObs.setComplexData(obsToCopy.getComplexData());
newObs.setFormField(obsToCopy.getFormFieldNamespace(),obsToCopy.getFormFieldPath());
代码示例来源:origin: openmrs/openmrs-module-htmlformentry
} else if (HtmlFormEntryConstants.COMPLEX_UUID.equals(dt.getUuid())) {
obs.setComplexData((ComplexData) value);
obs.setValueComplex(obs.getComplexData().getTitle());
} else if (dt.isText()) {
if (value instanceof Location) {
代码示例来源:origin: openmrs/openmrs-module-webservices.rest
private void clearAndSetValue(Obs obs, ObsType type, Object value) {
obs.setValueCoded(type.equals(ObsType.CODED) ? (Concept) value : null);
obs.setValueComplex(type.equals(ObsType.COMPLEX) ? (String) value : null);
obs.setValueDatetime(type.equals(ObsType.DATETIME) ? (Date) value : null);
obs.setValueDrug(type.equals(ObsType.DRUG) ? (Drug) value : null);
obs.setValueNumeric(type.equals(ObsType.NUMERIC) ? (Double) value : null);
obs.setValueText(type.equals(ObsType.TEXT) ? (String) value : null);
}
代码示例来源:origin: openmrs/openmrs-module-htmlformentry
@Override
public Encounter getEncounterToView() throws Exception {
Encounter e = new Encounter();
BufferedImage image = createImage();
e.setPatient(getPatient());
Date date = Context.getDateFormat().parse("11/08/2012");
e.setDateCreated(new Date());
e.setEncounterDatetime(date);
e.setLocation(Context.getLocationService().getLocation(2));
e.setProvider(Context.getPersonService().getPerson(502));
Obs obs = new Obs();
obs.setConcept(Context.getConceptService().getConcept(6100));
obs.setComplexData(new ComplexData("complex_obs_image_test.gif", image));
obs.setValueComplex("gif image |complex_obs_image_test.gif");
e.addObs(obs);
Context.getEncounterService().saveEncounter(e);
return e;
}
}.run();
内容来源于网络,如有侵权,请联系作者删除!