public async Task <List <Reservation> > reservations( [Service] hospitecContext db, [GraphQLNonNullType] string patientId) { try { StringBuilder s = new StringBuilder(); string time = (DateTime.UtcNow .AddHours(-6)) .ToString("yyyy/MM/dd - hh:mm:ss"); s.AppendLine(string .Format("{0}: Type = Query (GET)", time)); s.AppendLine(string.Format("{0}: Operation = Reservations for patient {1}", time, patientId)); Console.WriteLine(s.ToString()); return(await db.Reservation .Where(p => p.Identification.Equals(patientId)) .ToListAsync()); } catch (Exception e) { throw new QueryException(ErrorBuilder.New() .SetMessage(e.Message) .SetCode(e.GetType().FullName) .Build()); } }
public async Task <List <Staff> > staff( [Service] hospitecContext db) { StringBuilder s = new StringBuilder(); string time = (DateTime.UtcNow .AddHours(-6)) .ToString("yyyy/MM/dd - hh:mm:ss"); s.AppendLine(string .Format("{0}: Type = Query (GET)", time)); s.AppendLine(string.Format("{0}: Operation = Staff", time)); Console.WriteLine(s.ToString()); return(await db.Staff.ToListAsync()); }
public async Task <List <Person> > patients( [Service] hospitecContext db, [Service] CoTEC_DBContext cotec) { List <Person> local = await db.Person.ToListAsync(); List <CotecModels.Patient> cotecremote = await cotec.Patient .Where(p => p.Country.Equals("Costa Rica, Republic of")) .ToListAsync(); foreach (CotecModels.Patient p in cotecremote) { local.Add(new Person { Identification = p.Identification, BirthDate = null, Canton = null, ExactAddress = null, FirstName = p.FirstName, LastName = p.LastName, PhoneNumber = null, Province = p.Region, External = true }); } StringBuilder s = new StringBuilder(); string time = (DateTime.UtcNow .AddHours(-6)) .ToString("yyyy/MM/dd - hh:mm:ss"); s.AppendLine(string .Format("{0}: Type = Query (GET)", time)); s.AppendLine(string.Format("{0}: Operation = patients", time)); Console.WriteLine(s.ToString()); return(local); }
public async Task <List <ClinicRecord> > records( [Service] hospitecContext db, [GraphQLNonNullType] string patientId) { StringBuilder s = new StringBuilder(); string time = (DateTime.UtcNow .AddHours(-6)) .ToString("yyyy/MM/dd - hh:mm:ss"); s.AppendLine(string .Format("{0}: Type = Query (GET)", time)); s.AppendLine(string.Format("{0}: Operation = Clinical records for patient {1}", time, patientId)); Console.WriteLine(s.ToString()); return(await db.ClinicRecord .Where(p => p.Identification.Equals(patientId)) .Include(p => p.MedicalProcedureRecord) .ThenInclude(p => p.ProcedureNameNavigation) .ToListAsync()); }