Ejemplo n.º 1
0
        public void ImportFromExcelFile(string path)
        {
            var excelRepository = new ExcelRepository();

            var data = excelRepository.GetAllDataFrom(path, "CID.xls", "CID10");

            var list = new List<CID>();

            foreach (DataRow row in data.Rows)
            {
                var cid = new CID();

                foreach (DataColumn column in data.Columns)
                {
                    switch (column.Caption)
                    {
                        case "CODIGO":
                            cid.Code = (string)row[column];
                            break;
                        case "DESCRICAO":
                            cid.Description = (string)row[column];
                            break;
                        case "DESCRABREV":
                            cid.AbbreviatedDescription = (string)row[column];
                            break;
                    }
                }

                list.Add(cid);
            }

            var cids = new CIDRepository();

            cids.SaveList(list);
        }
Ejemplo n.º 2
0
        private void SetCid(CID cid)
        {
            Assertion.NotNull(cid, "Cid não informado.").Validate();

            Cid = cid;

            Assertion.Equals(Cid, cid, "Cid não foi atribuido corretamente.").Validate();
        }
Ejemplo n.º 3
0
        private void AddDiagnostics(Legacy.Summary legacySummary, Summary newSummary)
        {
            var diagnosticTypesRepository = new Types<DiagnosticType>();

            foreach (var legacyDiagnostic in legacySummary.Diagnostics)
            {
                if (legacyDiagnostic != null && !String.IsNullOrWhiteSpace(legacyDiagnostic.Type))
                {
                    short diagnosticTypeId = Convert.ToInt16(legacyDiagnostic.Type);
                    DiagnosticType diagnosticType = diagnosticTypesRepository.Get(diagnosticTypeId);
                    CID cid = new CID { Code = legacyDiagnostic.Cid };

                    newSummary.CreateDiagnostic(diagnosticType, cid);
                }
            }
        }
Ejemplo n.º 4
0
 private void AddFields(CID cid, Document doc)
 {
     doc.Add(new Field("Id", cid.Id.ToString(CultureInfo.InvariantCulture), Field.Store.YES, Field.Index.ANALYZED));
     doc.Add(new Field("Description", cid.Description.ToLower(), Field.Store.YES, Field.Index.ANALYZED));
     doc.Add(new Field("Code", cid.Code.ToLower(), Field.Store.YES, Field.Index.ANALYZED));
 }
Ejemplo n.º 5
0
 public void UpdateIndex(CID cids)
 {
     UpdateIndex(new List<CID> { cids });
     Optimize();
 }
Ejemplo n.º 6
0
        private CID _mapLuceneDocumentToData(Document doc)
        {
            var cid = new CID
                          {
                              Id = short.Parse(doc.Get("Id")),
                              Description = doc.Get("Description"),
                              Code = doc.Get("Code"),
                          };

            return cid;
        }
Ejemplo n.º 7
0
 private void _addToLuceneIndex(CID cid, IndexWriter writer)
 {
     //Não precisa remover o tratamento, pois existem varios tratamentos com o id igual.
     // RemoveIndex(treatment, writer);
     var doc = new Document();
     AddFields(cid, doc);
     writer.AddDocument(doc);
 }
Ejemplo n.º 8
0
 private void RemoveIndex(CID cid, IndexWriter writer)
 {
     var searchQuery = new TermQuery(new Term("Id", cid.Id.ToString(CultureInfo.InvariantCulture)));
     writer.DeleteDocuments(searchQuery);
 }
Ejemplo n.º 9
0
 public static CidModel MapCidModelFrom(CID cid)
 {
     Mapper.CreateMap<CID, CidModel>();
     return Mapper.Map<CID, CidModel>(cid);
 }