* печатает спан
* @param span
*/
private void printSpanDetails(TimeSpanItem span) {
try {
SheduleReceptionData item = span.get();
HashMap<String, Object> data = new LinkedHashMap<String, Object>();
String title = "Запись на прием:";
data.put("clientFIO", "Пациент: " + item.getClient(am).toString());
data.put("collabFIO", "Врач: " + item.getCollaborator().getTitle());
data.put("date", "Дата: " + Converter.dateToString(item.getBegin()));
DayOfWeek dayOfWeek = day.getDayOfWeek();
SheduleIndividualLocal sil = new SheduleIndividualLocal(collaborator);
WeekIndex weekIndex = new WeekIndex(day);
Iterator<SheduleIndividualData> it = sil.daySelector(weekIndex, dayOfWeek);
if (!it.hasNext()) {
WeekIndex planWeekIndex = new WeekIndex(weekIndex.getIndex() % sil.getWeekCount());
it = sil.daySelector(planWeekIndex, dayOfWeek);
}
DirectoryCabinetItem cabinet = null;
Calendar itemBegin = new GregorianCalendar();
itemBegin.setTime(item.getBegin());
Calendar itemEnd = new GregorianCalendar();
itemEnd.setTime(item.getEnd());
Calendar workBegin = new GregorianCalendar();
Calendar workEnd = new GregorianCalendar();
int year = itemBegin.get(Calendar.YEAR);
int month = itemBegin.get(Calendar.MONTH);
int dayy = itemBegin.get(Calendar.DAY_OF_MONTH);
while (it.hasNext()) {
SheduleIndividualData work = it.next();
workBegin.setTime(work.getBegin());
workBegin.set(year, month, dayy);
workEnd.setTime(work.getBegin());
workEnd.add(Calendar.MINUTE, work.getWorkDuration());
workEnd.set(year, month, dayy);
if ((itemBegin.after(workBegin) || itemBegin.equals(workBegin)) &&
(itemEnd.before(workEnd) || itemEnd.equals(workEnd))) {
cabinet = work.getCabinet();
break;
}
}
Calendar tb = GregorianCalendar.getInstance();
Calendar te = GregorianCalendar.getInstance();
tb.setTime(item.getBegin());
te.setTime(item.getEnd());
String period = String.format("%02d:%02d-%02d:%02d", tb.get(Calendar.HOUR_OF_DAY),
tb.get(Calendar.MINUTE), te.get(Calendar.HOUR_OF_DAY), te.get(Calendar.MINUTE));
data.put("period", "Время: " + period);
String services = "";
List<Integer> srl = item.getLinkedServicesList();
List<SerRenLocal> clientServices = getServices(item.getClient(am));
if (srl.size() != 0) {
for (int i = 0; i < clientServices.size(); i++) {
SerRenLocal s = clientServices.get(i);
if (srl.contains(s.getID())) {
services += " - " + s.getService().getTitle() + "\n";
}
}
}
else {
services += " нет привязанных услуг";
}
data.put("services", "Привязанные услуги: \n" + services);
if (!item.getDescription().isEmpty()) {
data.put("description", "Примечание: \n" + item.getDescription());
}
if (cabinet != null) {
String cab = cabinet.getTitle();
cab += " (" + cabinet.getDescription() + ")";