本文整理了Java中org.openmrs.Obs.setValueDatetime()
方法的一些代码示例,展示了Obs.setValueDatetime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.setValueDatetime()
方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:setValueDatetime
暂无
代码示例来源:origin: openmrs/openmrs-core
} else if ("DT".equals(abbrev)) {
DateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN);
setValueDatetime(dateFormat.parse(s));
} else if ("TM".equals(abbrev)) {
DateFormat timeFormat = new SimpleDateFormat(TIME_PATTERN);
setValueDatetime(timeFormat.parse(s));
} else if ("TS".equals(abbrev)) {
DateFormat datetimeFormat = new SimpleDateFormat(DATE_TIME_PATTERN);
setValueDatetime(datetimeFormat.parse(s));
} else if ("ST".equals(abbrev)) {
setValueText(s);
代码示例来源:origin: openmrs/openmrs-core
@Test
public void getValueAsString_shouldReturnDateInCorrectFormat() throws Exception {
Obs obs = new Obs();
obs.setValueDatetime(new Date());
Concept cn = new Concept();
ConceptDatatype cdt = new ConceptDatatype();
cdt.setHl7Abbreviation("DT");
cn.setDatatype(cdt);
obs.setConcept(cn);
Date utilDate = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String dateString = dateFormat.format(utilDate);
Assert.assertEquals(dateString, obs.getValueAsString(Locale.US));
}
代码示例来源:origin: org.motechproject/motech-server-core
@Override
public Obs setValue(Obs obs, Object value) {
obs.setValueDatetime((Date) value);
return obs;
}},
CODED {
代码示例来源:origin: openmrs/openmrs-core
if (value != null) {
Date valueDate = getDate(value.getYear(), value.getMonth(), value.getDay(), 0, 0, 0);
obs.setValueDatetime(valueDate);
} else {
log.warn("Not creating null valued obs for concept " + concept);
.getMinute(), value.getSecond());
obs.setValueDatetime(valueDate);
} else {
log.warn("Not creating null valued obs for concept " + concept);
if (value != null) {
Date valueTime = getDate(0, 0, 0, value.getHour(), value.getMinute(), value.getSecond());
obs.setValueDatetime(valueTime);
} else {
log.warn("Not creating null valued obs for concept " + concept);
代码示例来源:origin: org.motechproject/motech-openmrs-api
<T> void writeValueToOpenMRSObservation(T value, Obs openMRSObservation) {
if ((value instanceof Number) && isNumber(value.toString())) {
openMRSObservation.setValueNumeric(Double.parseDouble(value.toString()));
} else if (value instanceof String) {
openMRSObservation.setValueText((String) value);
} else if (value instanceof Boolean) {
openMRSObservation.setValueNumeric(Boolean.TRUE.equals(value) ? 1.0 : 0.0);
} else if (value instanceof Date) {
openMRSObservation.setValueDatetime((Date) value);
} else if (value instanceof OpenMRSConcept) {
openMRSObservation.setValueCoded(openMRSConceptAdapter.getConceptByName(((OpenMRSConcept) value).getName().getName()));
} else if (value != null) {
throw new IllegalArgumentException("Invalid value of the createMRSObservation- " + value);
}
}
代码示例来源:origin: openmrs/openmrs-core
obs.setValueCoded(Context.getConceptService().getConcept(18));
obs.setValueComplex("test");
obs.setValueDatetime(new Date());
obs.setValueDrug(Context.getConceptService().getDrug(3));
obs.setValueGroupId(getLoadCount());
代码示例来源:origin: openmrs/openmrs-core
obs.setLocation(location);
obs.setValueGroupId(valueGroupId);
obs.setValueDatetime(valueDatetime);
obs.setValueCoded(valueCoded);
obs.setValueNumeric(valueNumeric);
代码示例来源:origin: openmrs/openmrs-core
newObs.setValueDrug(obsToCopy.getValueDrug());
newObs.setValueGroupId(obsToCopy.getValueGroupId());
newObs.setValueDatetime(obsToCopy.getValueDatetime());
newObs.setValueNumeric(obsToCopy.getValueNumeric());
newObs.setValueModifier(obsToCopy.getValueModifier());
代码示例来源:origin: openmrs/openmrs-module-htmlformentry
|| ConceptDatatype.DATETIME.equals(dt.getHl7Abbreviation())) {
Date date = (Date) value;
obs.setValueDatetime(date);
} else if ("ZZ".equals(dt.getHl7Abbreviation())) {
代码示例来源:origin: openmrs/openmrs-module-htmlformentry
/**
*
* Utility to give us a ready-to-save (without violating foreign-key constraints) Obs
*
* @param encounter
* @param conceptId
* @param value
* @param date
* @return
*/
public static Obs createObs(Encounter encounter, Integer conceptId, Object value, Date date){
Obs obs = new Obs(encounter.getPatient(), Context.getConceptService().getConcept(conceptId), date, encounter.getLocation());
if (value != null) {
if (value instanceof Number)
obs.setValueNumeric(((Number) value).doubleValue());
else if (value instanceof String)
obs.setValueText((String) value);
else if (value instanceof Date)
obs.setValueDatetime((Date) value);
else if (value instanceof Concept)
obs.setValueCoded((Concept) value);
}
obs.setDateCreated(new Date());
return obs;
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!