{setPageSize('A4')} {setOrientation('P')} {setLeftMargin(5)} {setTopMargin(5)} {setBottomMargin(5)} {setRightMargin(5)}
Министерство здравоохранения и социального развития РФ Медицинская документация
Форма N 25/у
{currentOrganisation.shortName} *{client.id}*
{if: len(currentPerson.speciality.name)}Отделение: {currentPerson.orgStructure.name}{end:}
ВЫПИСКА ИЗ МЕДИЦИНСКОЙ КАРТЫ № {client.id}

{client.fullName}


Дата рождения: {client.birthDate}({client.age}) Пол: {client.sex}СНИЛС:{client.SNILS}
Документ: {client.document}
Полис:{client.policy}
Адрес регистрации:{client.regAddress}
Адрес проживания: {client.locAddress}
Тел:{client.phones}
Группа крови: {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:}
{if: len(client.permanentAttach.org.fullName)}Прикреплен: {client.permanentAttach.org.fullName} c {client.permanentAttach.begDate.date.toString("dd.MM.yyyy")}
{end:} {if: len(client.temporaryAttach.org.fullName)}Временно прикреплен: {client.temporaryAttach.org.fullName} c {client.temporaryAttach.begDate.date.toString("dd.MM.yyyy")}
{end:} Занятость: {if: len(client.work.shortName)}{client.work.shortName}, должность: {client.work.post}{end:}
Соц. статусы: {for: socStatus in client.socStatuses} {socStatus.classes[0]}: {socStatus.name}; {end:}
{if:client.work.hurts} Вредность и факторы: { for: i, hurt in enumerate(client.work.hurts)} {hurt.name} (стаж - {hurt.stage}); {end:}
{end:}

{if: len(diagnosises)}{end:} {if: len([x for x in diagnosises if (x.type.code == '2' and x.character.code in ['2','3','4'])])}{end:} {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:} {if: len([x for x in diagnosises if x.type.code == '2' and x.character.code == '1'])}{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:} {if: len(tempInvalids)}{end:} {for: tempInvalid in reversed(sorted(tempInvalids, key=lambda item: item.begDate.date))} {end:}
Лист уточнённых диагнозов:
Хронические заболевания:
{diagnosis.MKB}{if: diagnosis.MKBEx}+{diagnosis.MKBEx.code}{end:}{diagnosis.MKB.descr}{if: diagnosis.MKBEx} ({diagnosis.MKBEx.descr}){end:} {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}{if: diagnosis.MKBEx}+{diagnosis.MKBEx.code}{end:}{diagnosis.MKB.descr}{if: diagnosis.MKBEx} ({diagnosis.MKBEx.descr}){end:} {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)} {: currentTI = None} {for: TI in tempInvalids} {if: TI.begDate.date <= act.endDate.date and TI.endDate.date >= act.endDate.date}{: currentTI = TI}{end:} {end:} {: currentVisit = None} {for: visit in act.event.visits} {if: visit.date.date == act.endDate.date}{: currentVisit = visit}{end:} {end:} {: visitPlace = ('', u'в поликлинике', u'на дому', u'актив на дому',u'на выезде')[int(currentVisit.scene.code)] if currentVisit else ''} {end:}
{act.endDate.date.toString("dd.MM.yyyy")} {act.name} врач: {act.person.longName} {act.person.speciality.name} {act.person.orgStructure.name} {visitPlace}
{for: (i, prop) in enumerate([x for x in act if unicode(x.value) != ''])} {prop.name}: {unicode(prop.value)} {if: prop.name == u'трудоспособность' and currentTI}л/н № {currentTI.serial} {currentTI.number} с {currentTI.begDate} по {currentTI.endDate}{end:};{end:}

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

{currentDate}{if: len(currentPerson.speciality.name)}{currentPerson.post}_______________ /{currentPerson.shortName}/{end:}