public Tree getDrugDayT(int n) { int i = 0; // if (isDrug()) if (isTaskOne()) for (Tree dayT : this.getChildTs()) if (dayT.isDay()) if (n == i++) return dayT; return null; }
private Laborx regimeLaborx(Tree laborT) { Laborx laborx = new Laborx(laborT); for (Tree t1 : laborT.getChildTs()) if (t1.isDay()) { laborx.getDay().add(regimeDrugDay(t1)); } return laborx; }
private void addOfDate(OfDate patientHistoryx, Tree t1) { if (t1.isPvariable()) { Pvariablex pvariablex = new Pvariablex(t1); if ("ofDate".equals(t1.getPvalueO().getPvariable())) { patientHistoryx.setPvOfDate(pvariablex); } } }
private Patientx regimePatientx(Tree taskT) { Patientx patientx = new Patientx(taskT); for (Tree t1 : taskT.getChildTs()) if (t1.isTask()) { patientx.getTask().add(taskPatientx(t1)); } else if (t1.isFinding()) { patientx.getFinding().add(findingPatientx(t1)); } return patientx; }
private Dayx regimeDrugDay(Tree t1) { Dayx dayx = new Dayx(t1); for (Tree t2 : t1.getChildTs()) { if (t2.isTimes()) { // dayx.setTimes(new Timesx(t2)); dayx.getTimes().add(new Timesx(t2)); } } return dayx; }
private Drugx regimeDrugx(Tree drugT) { Drugx drugx = new Drugx(drugT); for (Tree t1 : drugT.getChildTs()) if (t1.isDose()) { drugx.setDose(new Dosex(t1)); } else if (t1.isApp()) { drugx.setApp(new Appx(t1)); } else if (t1.isDay()) { drugx.getDay().add(regimeDrugDay(t1)); } return drugx; }
private TaskRegimex regimeTaskx(Tree taskT) { TaskRegimex taskx = new TaskRegimex(taskT); for (Tree t1 : taskT.getChildTs()) if (t1.isDrug()) { // taskx.getTaskOne().add(regimeDrugx(t1)); taskx.getDrug().add(regimeDrugx(t1)); } else if (t1.isTask()) { taskx.getTask().add(regimeTaskx(t1)); } else if (t1.isLabor()) { taskx.getLabor().add(regimeLaborx(t1)); } return taskx; }
private TaskPatientx taskPatientx(Tree taskT) { TaskPatientx taskPatientx = new TaskPatientx(taskT); for (Tree t1 : taskT.getChildTs()) { addOfDate(taskPatientx, t1); if (t1.isPvariable()) { Pvariablex pvariablex = new Pvariablex(t1); if ("cycle".equals(t1.getPvalueO().getPvariable())) { taskPatientx.setPvCycle(pvariablex); } } } log.debug(taskPatientx); return taskPatientx; }
public Integer getAppDurationSecond() { if (null == durationValueSecond) { durationValueSecond = 0; Tree drugAppT = getParentT().getParentT().getDrugAppT(); if (null != drugAppT) { App appO = drugAppT.getAppO(); durationValueSecond = appO.getDurationValue(); if ("min".equals(appO.getUnit())) durationValueSecond *= 60; if ("h".equals(appO.getUnit())) durationValueSecond *= 60 * 60; if ("d".equals(appO.getUnit())) durationValueSecond *= 60 * 60 * 24; } } return durationValueSecond; }
private FindingPatientx findingPatientx(Tree t0) { FindingPatientx findingPatientx = new FindingPatientx(t0); for (Tree t1 : t0.getChildTs()) { addOfDate(findingPatientx, t1); } return findingPatientx; }
public String toString() { return "tree:id:" + id + " :tabName:" + tabName + " :idclass:" + idClass + " :did:" + (parentT == null ? 0 : parentT.getId()) + " :ref:" + ref + " :sort:" + sort + " :iddoc:" + (docT == null ? 0 : docT.getId()) + "\n mtlO=" + getMtlO() + (null == getHistory() ? "" : "\n " + getHistory()) // +":hashCode:"+this.hashCode() ; }
public void setTsEnd() { for (Tree appT : timesT.getParentT().getParentT().getChildTs()) if (appT.getMtlO() instanceof App) this.appT = appT; duration = TsTask._1s; if (appT != null) { App appO = (App) appT.getMtlO(); int hms = TsTask._1s; if (appO.getUnit().equals("h")) hms = TsTask._1h; else if (appO.getUnit().equals("min")) hms = TsTask._1m; Integer appValue = 1; if (appO.getAppapp() != null) appValue = appO.getAppapp(); duration = appValue * hms; } MObject timesO = timesT.getMtlO(); if (timesO != null && timesO instanceof Times && TsTask.apporder_endBeforeBegin.equals(((Times) timesO).getApporder())) { this.tsEnd = new Timestamp(ts.getTime()); this.ts = new Timestamp(tsEnd.getTime() - duration); } else { this.tsEnd = new Timestamp(ts.getTime() + duration); } }
@RequestMapping(value = "/xml={htmlId}", method = RequestMethod.GET, produces = "application/xml") public @ResponseBody Treex xml(@PathVariable String htmlId, Model model) { log.debug(1); Integer id = mopetService.getIdFromHtmlId(htmlId); log.debug(id); Tree t0 = mopetService.readNodes4(id, model); Treex mtlX = null; if (t0.isTask()) { mtlX = regimeTaskx(t0); } else if (t0.isDrug()) { mtlX = regimeDrugx(t0); } else if (t0.isPatient()) { mtlX = regimePatientx(t0); } else if (t0.isDose()) { mtlX = new Dosex(t0); } else if (t0.isDay()) { mtlX = regimeDrugDay(t0); } else if (t0.isTimes()) { mtlX = new Timesx(t0); } else { log.info("TODO!"); } return mtlX; }
public void setParentT(Tree tree1) { this.parentT = tree1; if (!parentT.hasChild()) parentT.setChildTs(new ArrayList<Tree>()); if (!parentT.getChildTs().contains(this)) parentT.getChildTs().add(this); }
public Tree getDrugDayTimesT(int n) { int i = 0; if (isDay()) for (Tree timesT : this.getChildTs()) if (timesT.isTimes()) if (n == i++) return timesT; return null; }
// public void copyDoc(CopyDocMtl copyDocM, MtlDbService dbService) { // copy(copyDocM.getDocT(),copyDocM,this,dbService); // } // private void copy(Tree originalT, CopyDocMtl copyDocM, Tree newDocT, MtlDbService dbService) { // if(copyDocM.getNotCopyS().contains(originalT))return; // setId(dbService.nextDbid()); // setDocT(newDocT); // // newDocT.getDocNodes().add(this); // copyAtt(originalT); // copyDocM.getTree().put(originalT.getId(), originalT); // copyDocM.getNewTree().put(originalT.getId(), this); // System.out.println(originalT+"\n to "+this); // copyDocM.addTreePaar(this); // dbService.getEntityManager().persist(this); // // if(originalT.getRef()!=null) // copyDocM.addRef(originalT); // if(originalT.getChildTs()!=null){ // childTs=new ArrayList<Tree>(); // for (Tree ocT : originalT.getChildTs()) { // Tree newT = new Tree(); // newT.setParentT(this); // childTs.add(newT); // newT.copy(ocT, copyDocM, newDocT, dbService); // } // } // } public void copyAtt(Tree originalT) { setTabName(originalT.getTabName()); setIdClass(originalT.getIdClass()); setSort(originalT.getSort()); }
/** * Get child tree with value of this object as integer. * * @return Tree object with parent object value as integer */ public Tree getIvalueT() { if (isFinding() || isLabor()) for (Tree iValueT : this.getChildTs()) if (iValueT.isIvalue()) return iValueT; return null; }
/** * Get child tree with value of this object as string. * * @return Tree object with parent object value as string */ public Tree getPvalueT() { if (isFinding() || isLabor()) for (Tree pValueT : this.getChildTs()) if (pValueT.isPvalue()) return pValueT; return null; }
/** * Get child tree with value of this object as string. * * @return Tree object with parent object value as string */ public Tree getOfDateT() { if (getParentT().isPatient()) for (Tree pValueT : this.getChildTs()) if (pValueT.isOfDate()) return pValueT; return null; }
public Tree getDrugDoseT() { if (isDrug()) for (Tree doseT : this.getChildTs()) if (doseT.isDose()) return doseT; return null; }
public Tree getDrugDoseAppT() { if (isDose()) for (Tree doseAppT : this.getChildTs()) if (doseAppT.isApp()) return doseAppT; return null; }
public Tree getDrugAppT() { if (isDrug()) for (Tree appT : this.getChildTs()) if (appT.isApp()) return appT; return null; }