protected void GeneralKol(Bookmark bookmark, DocumentBuilder builder, ResearcherEntity entity, string language) { var currentLog = new List <string>(); var orgList = HttpService.GetByIds <BaseEntity <InstitutionEntity> >(entity.link_organization, DataSetEnum.organization); Document insertDoc = new Document(templateKOL);//KOL模板 DocumentBuilder insertBuilder = new DocumentBuilder(insertDoc); insertDoc.Range.Replace("$NAME$", GeneratePriorityLanguage(language, entity.name_en, entity.name_cn), false, false); if (orgList != null && orgList.data != null && orgList.data.Any()) { var org = orgList.data.FirstOrDefault(t => t.id == entity.link_organization[0]); insertDoc.Range.Replace("$DEPART$", GeneratePriorityLanguage(language, org.name_en, org.name_cn), false, false); insertDoc.Range.Replace("$HOSPITAL_LEVEL$", org.level.NullToString(), false, false); insertDoc.Range.Replace("$FUDAN_SCORE$", org.rank.NullToString(), false, false); var otherDeps = orgList.data.Except(new InstitutionEntity[] { org }); if (otherDeps.Any()) { var otherDepNames = string.Join(",", otherDeps.Select(t => GeneratePriorityLanguage(language, t.name_en, t.name_cn))); insertDoc.Range.Replace("$OTHER_DEPARTMENT$", otherDepNames, false, false); } else { insertDoc.Range.Replace("$OTHER_DEPARTMENT$", "", false, false); } //$OTHER_DEPARTMENT$ } insertDoc.Range.Replace("$DEPARTMENT_ID$", GetDepartment(entity.department_ids, departmentsDic, language), false, false); insertDoc.Range.Replace("$SEX$", GetGenderByStr(entity.gender, language), false, false); if (entity.resume != null && entity.resume.resume != null) { insertDoc.Range.Replace("$RESUME$", entity.resume.resume, false, false); } else { insertDoc.Range.Replace("$RESUME$", string.Empty, false, false); } if (entity.specialty_list != null && entity.specialty_list.Any()) { insertDoc.Range.Replace("$SPECIAL_LIST$", entity.specialty_list[0].raw_specialty_name ?? string.Empty, false, false); } var professional = GetHcpTitle(professionalTitleDic, null, null, entity.professional_title, null, null, language); insertDoc.Range.Replace("$PROFESSIONAL_TITLE$", professional, false, false); var admin = GetHcpTitle(null, null, adminTitleDic, null, null, entity.admin_title, language); insertDoc.Range.Replace("$ADMIN_TITLE$", admin, false, false); var academic = GetHcpTitle(null, academicTitleDic, null, null, entity.academic_title, null, language); insertDoc.Range.Replace("$ACADEMIC_TITLE$", academic, false, false); if (orgList != null) { var society = GetSocietyName(entity.institution_list, orgList.data, associationTitleDic, language); insertDoc.Range.Replace("$SOCIETY$", string.Join(" ", society), false, false); } //entity.institution_list.GetSocietyName(orgList, AssociationTitleDic, pamarater.language), insertBuilder.MoveToDocumentEnd(); CaptureHelper captureHelper = new CaptureHelper() { url = string.Format("http://{0}/kol/index?hcpid={1}", sourceUrl, entity.id), }; List <string> file = captureHelper.CaptureByNreco(language); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[0])); insertBuilder.MoveToDocumentEnd(); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[1])); insertBuilder.MoveToDocumentEnd(); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[2])); insertBuilder.MoveToDocumentEnd(); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[3])); insertBuilder.MoveToDocumentEnd(); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[4])); insertBuilder.MoveToDocumentEnd(); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[5])); insertBuilder.MoveToDocumentEnd(); insertBuilder.InsertOleObject(templateKOL, false, false, Image.FromFile(file[6])); //builder.MoveToBookmark(bookmark.Name, false, true); InsertDocument(bookmark.BookmarkStart.ParentNode, insertDoc); }