当前位置: 首页>>代码示例>>C#>>正文


C# CsvWriter.WriteToFile方法代码示例

本文整理汇总了C#中CsvWriter.WriteToFile方法的典型用法代码示例。如果您正苦于以下问题:C# CsvWriter.WriteToFile方法的具体用法?C# CsvWriter.WriteToFile怎么用?C# CsvWriter.WriteToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CsvWriter的用法示例。


在下文中一共展示了CsvWriter.WriteToFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var randomizer = new Random((int)DateTime.Now.Ticks);

            var allClaimsTherapies = new List<ClaimsTherapy>();
            var allClaimsUtilizations = new List<ClaimsUtilization>();
            var allPatientAllergies = new List<PatientAllergy>();
            var allPatientClinicals = new List<PatientClinical>();
            var allPatientDemographics = new List<PatientDemographics>();
            var allPatientDiagnoses = new List<PatientDiagnosis>();
            var allPatientLabs = new List<PatientLab>();
            var allPatientProcedures = new List<PatientProcedure>();
            var allPatientTherapies = new List<PatientTherapy>();
            var allPatientUtilizations = new List<PatientUtilization>();

            var fixture = new Fixture();
            fixture.Customizations.Add(new PatientSpecimenBuilder());

            int maxNumberOfClaimsTherapies = 5;
            int maxNumberOfClaimsUtilizations = 10;
            int maxNumberOfPatientAllergies = 5;
            int maxNumberOfPatientClinicals = 10;
            int maxNumberOfPatientDiagnoses = 10;
            int maxNumberOfPatientLabs = 20;
            int maxNumberOfPatientProcedures = 5;
            int maxNumberOfPatientTherapies = 20;
            int maxNumberOfPatientUtilizations = 15;
            int numberOfPatients = 50;
            for (int i = 0; i < numberOfPatients; i++)
            {
                var alcoholAbuse = fixture.Create<bool>();
                var drugAbuse = fixture.Create<bool>();
                var smoker = fixture.Create<bool>();

                var chanceOfObesity = 15;
                var obese = randomizer.NextPercent() < chanceOfObesity;

                var demographic = PatientDemographicBuilder.Instance.GetPatientDemographic(randomizer);
                var clinicals = PatientClinicalBuilder.Instance.GetPatientClinicals(fixture, randomizer, demographic, alcoholAbuse, drugAbuse, smoker, obese, maxNumberOfPatientClinicals);
                var utilizations = PatientUtilizationBuilder.Instance.GetPatientUtilizations(fixture, randomizer, demographic, maxNumberOfPatientUtilizations);
                var diagnoses = PatientDiagnosisBuilder.Instance.GetPatientDiagnoses(fixture, randomizer, demographic, maxNumberOfPatientDiagnoses);
                var labs = PatientLabBuilder.Instance.GetPatientLabs(fixture, randomizer, demographic, maxNumberOfPatientLabs);
                var therapies = PatientTherapyBuilder.Instance.GetPatientTherapies(fixture, randomizer, demographic, maxNumberOfPatientTherapies);
                var allergies = PatientAllergyBuilder.Instance.GetPatientAllergies(fixture, randomizer, demographic, maxNumberOfPatientAllergies);
                var procedures = PatientProcedureBuilder.Instance.GetPatientProcedures(fixture, randomizer, demographic, maxNumberOfPatientProcedures);
                var claimsUtilizations = ClaimsUtilizationBuilder.Instance.GetClaimsUtilizations(fixture, randomizer, demographic, alcoholAbuse, drugAbuse, maxNumberOfClaimsUtilizations);
                var claimsTherapies = ClaimsTherapyBuilder.Instance.GetClaimsTherapies(fixture, randomizer, demographic, alcoholAbuse, drugAbuse, maxNumberOfClaimsTherapies);

                allClaimsTherapies.AddRange(claimsTherapies);
                allClaimsUtilizations.AddRange(claimsUtilizations);
                allPatientAllergies.AddRange(allergies);
                allPatientClinicals.AddRange(clinicals);
                allPatientDemographics.Add(demographic);
                allPatientDiagnoses.AddRange(diagnoses);
                allPatientLabs.AddRange(labs);
                allPatientProcedures.AddRange(procedures);
                allPatientTherapies.AddRange(therapies);
                allPatientUtilizations.AddRange(utilizations);
            }

            string FOLDERPATH = "c:\\temp";
            string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
            var writer = new CsvWriter();
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientdemographics.csv", allPatientDemographics);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientclinicals.csv", allPatientClinicals);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientutilizations.csv", allPatientUtilizations);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientdiagnoses.csv", allPatientDiagnoses);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientlabs.csv", allPatientLabs);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patienttherapies.csv", allPatientTherapies);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientallergies.csv", allPatientAllergies);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.patientprocedures.csv", allPatientProcedures);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.claimstherapies.csv", allClaimsTherapies);
            writer.WriteToFile($"{FOLDERPATH}\\{timestamp}.unofficial.claimsutilizations.csv", allClaimsUtilizations);
        }
开发者ID:ryanpeelman,项目名称:EMRG,代码行数:74,代码来源:Program.cs


注:本文中的CsvWriter.WriteToFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。