{: namesdates = dict([])} {for: act in all_actions} {if: not (namesdates.data.hasKey(act.code) and namesdates.data[act.code].endDate.date > act.endDate.date)} {: namesdates.data[act.code] = act } {end:} {end:} {: namesdates = namesdates.data.values()} {: num_actions = dialogs.dialMultiList(u"Выберите исследования", [nd.name + " - " + nd.endDate.date.toString("dd.MM.yyyy") for nd in namesdates], 2).getVar()} {: good_actions = [all_actions[i] for i in num_actions]} {: gistocits = [act for act in good_actions if act.group.code in (u'УП01.02', u'УП01.03')]} {: clindiags = [act for act in good_actions if act.group.code in (u'МРТ', u'УП01.04', u'УП01.05') or (act.group.group and act.group.group.code in (u'МРТ', u'УП01.04', u'УП01.05'))]} Метод лечения: {for: (i, action) in enumerate (event.actions)}
МИНИСТЕРСТВО ЗДРАВОХРАНЕНИЯ И СОЦИАЛЬНОГО РАЗВИТИЯ РОССИЙСКОЙ ФЕДЕРАЦИИ

{currentOrganisation.fullName}

{currentOrganisation.shortName}
{currentOrganisation.address}
телефон {currentOrganisation.phone} Факс: (812) 596-8947. Эл.почта: oncl1@rion.spb.ru
www.niioncologii.ru
ИНН {currentOrganisation.INN} КПП {currentOrganisation.KPP}
Выписка из амбулаторной карты
ФИО пациента:{client.fullName}
Диагноз: {for: (i, action) in enumerate (event.actions)} {if: action.name==u"Эпикриз на госпитальную комиссию"} {:l = [x for x in action if x.value]} {for: i, prop in enumerate(l)} {if: prop.name == u'Диагноз'}{prop.value :n}{end:} {end:} {end:} {end:} МКБ - 10: {for: diagnosis in event.diagnosises} {if: diagnosis.type.code == '1'}{diagnosis.MKB.code} - {diagnosis.MKB.descr}{end:}{end:}

Морфологическое подтверждение диагноза (цитология/гистология): {for: act in gistocits} {act.name} морфология {act.morphologyMKB.code}
{end:}
Результаты клинико-диагностических исследований (Rg, УЗИ, КТ, МРТ): {for: act in clindiags} {act.name} {act.endDate} № {act[u"№ исследования"]} заключение: {act[u"Заключение"]}
{end:}
Пациенту рекомендовано лечении в НИИ онкологии в рамках ВМП (СМП) {for: (i, action) in enumerate (event.actions)} {if: action.name==u"Эпикриз на госпитальную комиссию"} {:l = [x for x in action if x.value]} {for: i, prop in enumerate(l)} {if: prop.name == u'Рекомендации'}{prop.value :n}{end:} {end:} {end:} {end:}
{if: action.code==u"1-7"} {:l = [x for x in action if x.value]} {for: i, prop in enumerate(l)} {if: prop.name == u'Метод лечения'}{prop.value :n}{end:} {end:} {end:}{end:}

Специалист: (зав. профильного отделения) {action.person if action else event.execPerson}
Дата: {action.endDate.date.toString(u"dd MMMM yyyy г.") if action else event.execDate.date.toString(u"dd MMMM yyyy г.")}