public List <ProcesSpec> GetProcesInfo(string CPR) { List <ProcesSpec> procesSpecs = new List <ProcesSpec>(); if (CPR == "123456-7891") { ProcesSpec procesSpecLeft = new ProcesSpec(); procesSpecLeft.ClinicianId = 1; procesSpecLeft.scanTechId = 2; procesSpecLeft.Printed = true; procesSpecLeft.PrintDateTime = DateTime.Now; ProcesSpec procesSpecRight = new ProcesSpec(); procesSpecRight.ClinicianId = 1; procesSpecRight.scanTechId = 2; procesSpecRight.Printed = false; procesSpecRight.scanDateTime = DateTime.Now; procesSpecs.Add(procesSpecLeft); procesSpecs.Add(procesSpecRight); } return(procesSpecs); }
/// <summary> /// Henter Process informationerne til det give PCPR. Metoden vil altid hente de nyeste informationer. /// </summary> /// <param name="CPR"></param> /// <returns></returns> public List <ProcesSpec> GetProcesInfo(string CPR) { Patient patient = GetPatient(CPR); List <ProcesSpec> procesSpecs = new List <ProcesSpec>(); ProcesSpec procesSpecL = new ProcesSpec(); ProcesSpec procesSpecR = new ProcesSpec(); try { try { //Venstre //Henter generalspec GeneralSpec generalSpecL = _dbContext.GeneralSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.PatientFK == patient.PatientId && x.EarSide == Ear.Left); if (generalSpecL.CreateDate != null) { procesSpecL.GeneralSpecCreateDateTime = generalSpecL.CreateDate; procesSpecL.ClinicianId = generalSpecL.StaffLoginFK; TecnicalSpec TechspecL = _dbContext.TecnicalSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.GeneralSpecFK == generalSpecL.HAGeneralSpecID); //Henter techspec if (TechspecL.CreateDate != null) { procesSpecL.TechSpecCreateDateTime = TechspecL.CreateDate; procesSpecL.TechnicalId = TechspecL.StaffLoginFK; procesSpecL.Printed = TechspecL.Printed; //Henter EarScan TechspecL.RawEarScan = _dbContext.RawEarScans.OrderBy(x => x.ScanDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecL.HATechinalSpecID); if (TechspecL.RawEarScan != null) { procesSpecL.scanTechId = TechspecL.StaffLoginFK; procesSpecL.scanDateTime = TechspecL.CreateDate; } //Henter Earprint if (procesSpecL.Printed) { RawEarPrint rawEarPrint = _dbContext.RawEarPrints.OrderBy(x => x.PrintDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecL.HATechinalSpecID && x.EarSide == Ear.Left); ; procesSpecL.PrintDateTime = rawEarPrint.PrintDate; procesSpecL.PrintTechId = rawEarPrint.StaffLoginFK; } } } procesSpecs.Add(procesSpecL); } catch { procesSpecs.Add(procesSpecL); } try { //Højre //Henter GeneralSpec GeneralSpec generalSpecR = _dbContext.GeneralSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.PatientFK == patient.PatientId && x.EarSide == Ear.Right); if (generalSpecR.CreateDate != null) { procesSpecR.GeneralSpecCreateDateTime = generalSpecR.CreateDate; procesSpecR.ClinicianId = generalSpecR.StaffLoginFK; TecnicalSpec TechspecR = _dbContext.TecnicalSpecs.OrderBy(x => x.CreateDate).LastOrDefault(x => x.GeneralSpecFK == generalSpecR.HAGeneralSpecID); //Henter techspec if (TechspecR.CreateDate != null) { procesSpecR.TechSpecCreateDateTime = TechspecR.CreateDate; procesSpecR.TechnicalId = TechspecR.StaffLoginFK; procesSpecR.Printed = TechspecR.Printed; //Henter EarScan TechspecR.RawEarScan = _dbContext.RawEarScans.OrderBy(x => x.ScanDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecR.HATechinalSpecID); if (TechspecR.RawEarScan != null) { procesSpecR.scanTechId = TechspecR.StaffLoginFK; procesSpecR.scanDateTime = TechspecR.CreateDate; } //Henter Earprint if (procesSpecR.Printed) { RawEarPrint rawEarPrint = _dbContext.RawEarPrints.OrderBy(x => x.PrintDate).LastOrDefault(x => x.TecnicalSpecFK == TechspecR.HATechinalSpecID && x.EarSide == Ear.Right); procesSpecR.PrintDateTime = rawEarPrint.PrintDate; procesSpecR.PrintTechId = rawEarPrint.StaffLoginFK; } } } procesSpecs.Add(procesSpecR); } catch { procesSpecs.Add(procesSpecR); } return(procesSpecs); } catch { return(null); } }