{for: diagnosis in reversed(sorted([x for x in diagnosises if (x.type.code == '2' and x.character.code in ['2','3','4'])], key=lambda item: item.setDate.date))} {end:} {for: diagnosis in reversed(sorted([x for x in diagnosises if x.type.code == '2' and x.character.code == '1'], key = lambda item: item.setDate.date))} {end:} {for: tempInvalid in reversed(sorted(tempInvalids, key=lambda item: item.begDate.date))} {end:}
{if: len(client.permanentAttach.org.fullName)}{end:} {if: len(client.temporaryAttach.org.fullName)}{end:} {if:client.work.hurts} {end:}
Код: {'*'+currentOrganisation.miacCode+'.'+client.id+'*'}
Ф.И.О.: {client.fullName}
Пол: {client.sex}
Дата рождения: {client.birthDate}
Документ, удостоверяющий личность: {client.document.type + u" серия " + client.document.serial + u" номер " + client.document.number}
Медицинский полис: {client.policy.type + u" серия " + client.policy.serial + u" номер " + client.policy.number + u" (выдан " + client.policy.insurer.fullName + ")"}
Адрес регистрации: {client.regAddress.town + u", " + client.regAddress.street + u", д." + client.regAddress.number + u", корп." + client.regAddress.corpus + u", кв. " + client.regAddress.flat }
Адрес проживания: {client.locAddress.town + u", " + client.locAddress.street + u", д." + client.locAddress.number + u", корп." + client.locAddress.corpus + u", кв. " + client.locAddress.flat }
Телефон: {client.phones}
СНИЛС: {client.SNILS}
Прикреплен: {client.permanentAttach.org.fullName} c {client.permanentAttach.begDate.date.toString("dd.MM.yyyy")}
Временно прикреплен: {client.temporaryAttach.org.fullName} c {client.temporaryAttach.begDate.date.toString("dd.MM.yyyy")}
Занятость: {if: len(client.work.shortName)}{client.work.shortName}, должность: {client.work.post}{end:}
Соц. статусы: {for: socStatus in client.socStatuses} {socStatus.classes[0]}: {socStatus.name}; {end:}
Группа крови: {client.bloodType}
Аллергии:{for: allergy in client.allergies} {allergy.name} (степень - {(u"неизвестно", u"малая", u"средняя", u"высокая", u"строгая")[allergy.power]}); {end:}
Лекарственные непереносимости: {for: intolerance in client.intolerances} {intolerance.name} (степень - {(u"неизвестно", u"малая", u"средняя", u"высокая", u"строгая")[intolerance.power]}); {end:}
Вредность и факторы: { for: i, hurt in enumerate(client.work.hurts)} {hurt.name} (стаж - {hurt.stage}); {end:}

Лист уточнённых диагнозов:
Хронические заболевания:
{diagnosis.MKB}{diagnosis.MKB.descr} {if: len(str(diagnosis.setDate))} с {diagnosis.setDate}{end:} {if: len(diagnosis.dispanser.name)}диспансер: {diagnosis.dispanser.name}{end:} {if: len(diagnosis.traumaType.name)}травма: {diagnosis.traumaType.name}{end:}
Острые заболевания:
{diagnosis.MKB}{diagnosis.MKB.descr} {if: len(str(diagnosis.setDate))} с {diagnosis.setDate}{end:}{if: len(str(diagnosis.endDate))} по {diagnosis.endDate}{end:}

Мероприятия:
{for: act in sorted([x for x in actions], key = lambda item: item.begDate.date)} {end:}
{act.begDate.date.toString("dd.MM.yyyy")} {act.name} назначил: {act.setPerson.longName}
{for: (i, prop) in enumerate([x for x in act if unicode(x.value) != ''])} {prop.name}: {unicode(prop.value)};{end:}
{act.endDate.date.toString("dd.MM.yyyy")} {if: act.showTime}, время окончания: {act.endDate.time.toString("hh.mm")}{end:} выполнил: {act.person.longName}

Временная утрата трудоспособности:
{tempInvalid.MKB} ({tempInvalid.reason.name}) c {tempInvalid.begDate} по {tempInvalid.endDate} серия {tempInvalid.serial} номер {tempInvalid.number} - {(u'Открыт', u'Закрыт', u'Продлён', u'Передан')[tempInvalid.closed]}