Example #1
0
        public HospitalStaffViewModel AddHospitalStaff([FromBody] HospitalStaffViewModel hospitalStaffViewModel)
        {
            HospitalStaff hospitalStaff = new HospitalStaff()
            {
                Id           = hospitalStaffViewModel.Id,
                IsActive     = true,
                DateCreated  = DateTime.UtcNow,
                DateModified = DateTime.UtcNow,
                Name         = hospitalStaffViewModel.Name,
                HospitalId   = hospitalStaffViewModel.HospitalId,
                StaffRoleId  = hospitalStaffViewModel.StaffRoleId,
                Phone        = hospitalStaffViewModel.Phone,
                Age          = hospitalStaffViewModel.Age,
                Gender       = hospitalStaffViewModel.Gender,
                UniqueId     = hospitalStaffViewModel.UniqueId,
                AddressLine  = hospitalStaffViewModel.AddressLine,
                Area         = hospitalStaffViewModel.Area,
                City         = hospitalStaffViewModel.City,
                State        = hospitalStaffViewModel.State,
                Pincode      = hospitalStaffViewModel.Pincode,
                District     = hospitalStaffViewModel.District,
                Country      = hospitalStaffViewModel.Country,
                Username     = hospitalStaffViewModel.Username,
                Password     = hospitalStaffViewModel.Password
            };

            _context.HospitalStaff.Add(hospitalStaff);
            _context.SaveChanges();

            hospitalStaffViewModel.Id          = hospitalStaff.Id;
            hospitalStaffViewModel.HospitalId  = hospitalStaff.HospitalId;
            hospitalStaffViewModel.StaffRoleId = hospitalStaff.StaffRoleId;

            return(hospitalStaffViewModel);
        }
        public TreatmentViewModel AddTreatment([FromBody] TreatmentViewModel treatmentViewModel)
        {
            Treatment treatment = new Treatment()
            {
                IsActive          = true,
                DateCreated       = DateTime.UtcNow,
                DateModified      = DateTime.UtcNow,
                PatientId         = treatmentViewModel.PatientId,
                DoctorId          = treatmentViewModel.DoctorId,
                DiseaseId         = treatmentViewModel.DiseaseId,
                DiseaseTypeId     = treatmentViewModel.DiseaseTypeId,
                TreatmentStatusId = treatmentViewModel.TreatmentStatusId,
                AdmittedOn        = treatmentViewModel.AdmittedOn,
                RelievingOn       = treatmentViewModel.RelievingOn
            };

            _context.Treatment.Add(treatment);
            _context.SaveChanges();

            var PrescriptionDetails = new Prescription()
            {
                IsActive     = true,
                DateCreated  = DateTime.UtcNow,
                DateModified = DateTime.UtcNow,
                TreatmentId  = treatment.Id,
                Notes        = treatmentViewModel.patientPrescription.Notes
            };

            _context.Prescription.Add(PrescriptionDetails);
            _context.SaveChanges();

            treatmentViewModel.Id                = treatment.Id;
            treatmentViewModel.PatientId         = treatment.PatientId;
            treatmentViewModel.DoctorId          = treatment.DoctorId;
            treatmentViewModel.DiseaseId         = treatment.DiseaseId;
            treatmentViewModel.DiseaseTypeId     = treatment.DiseaseTypeId;
            treatmentViewModel.TreatmentStatusId = treatment.TreatmentStatusId;
            treatmentViewModel.patientPrescription.TreatmentId = treatment.Id;

            return(treatmentViewModel);
        }
Example #3
0
 public HospitalStaff AddHospitalStaff([FromBody] HospitalStaff hospitalStaff)
 {
     _context.HospitalStaff.Add(hospitalStaff);
     _context.SaveChanges();
     return(hospitalStaff);
 }
Example #4
0
 public Hospital AddHospital([FromBody] Hospital hospital)
 {
     _context.Hospital.Add(hospital);
     _context.SaveChanges();
     return(hospital);
 }
Example #5
0
 public Treatment AddTreatment([FromBody] Treatment treatment)
 {
     _context.Treatment.Add(treatment);
     _context.SaveChanges();
     return(treatment);
 }
 public Address AddAddress([FromBody] Address address)
 {
     _context.Address.Add(address);
     _context.SaveChanges();
     return(address);
 }
Example #7
0
 public Prescription AddPrescription([FromBody] Prescription prescription)
 {
     _context.Prescription.Add(prescription);
     _context.SaveChanges();
     return(prescription);
 }
 public Patient AddPatient([FromBody] Patient patient)
 {
     _context.Patient.Add(patient);
     _context.SaveChanges();
     return(patient);
 }
Example #9
0
        public PatientViewModel AddPatient([FromBody] PatientViewModel patientViewModel)
        {
            Patient patient = new Patient()
            {
                IsActive     = true,
                DateCreated  = DateTime.UtcNow,
                DateModified = DateTime.UtcNow,
                Id           = patientViewModel.Id,
                FirstName    = patientViewModel.FirstName,
                LastName     = patientViewModel.LastName,
                Age          = patientViewModel.Age,
                Gender       = patientViewModel.Gender,
                Phone        = patientViewModel.Phone,
                UniqueId     = patientViewModel.UniqueId,
                Username     = patientViewModel.Username,
                Password     = patientViewModel.Password,
                OccupationId = patientViewModel.OccupationId
            };

            _context.Patient.Add(patient);
            _context.SaveChanges();

            var permanentAddress = new Address()
            {
                IsActive      = true,
                DateCreated   = DateTime.UtcNow,
                DateModified  = DateTime.UtcNow,
                AddressTypeId = 1,
                PatientId     = patient.Id,
                HouseNo       = patientViewModel.permanentAddress.HouseNo,
                Area          = patientViewModel.permanentAddress.Area,
                City          = patientViewModel.permanentAddress.City,
                State         = patientViewModel.permanentAddress.State,
                District      = patientViewModel.permanentAddress.District,
                Zip           = patientViewModel.permanentAddress.Zip,
                Country       = patientViewModel.permanentAddress.Country,
            };

            _context.Address.Add(permanentAddress);
            _context.SaveChanges();

            var currentAddress = new Address()
            {
                IsActive      = true,
                DateCreated   = DateTime.UtcNow,
                DateModified  = DateTime.UtcNow,
                AddressTypeId = 2,
                PatientId     = patient.Id,
                HouseNo       = patientViewModel.currentAddress.HouseNo,
                Area          = patientViewModel.currentAddress.Area,
                City          = patientViewModel.currentAddress.City,
                State         = patientViewModel.currentAddress.State,
                District      = patientViewModel.currentAddress.District,
                Zip           = patientViewModel.currentAddress.Zip,
                Country       = patientViewModel.currentAddress.Country
            };

            _context.Address.Add(currentAddress);
            _context.SaveChanges();

            var occupationAddress = new Address()
            {
                IsActive      = true,
                DateCreated   = DateTime.UtcNow,
                DateModified  = DateTime.UtcNow,
                AddressTypeId = 3,
                PatientId     = patient.Id,
                HouseNo       = patientViewModel.occupationAddress.HouseNo,
                Area          = patientViewModel.occupationAddress.Area,
                City          = patientViewModel.occupationAddress.City,
                State         = patientViewModel.occupationAddress.State,
                District      = patientViewModel.occupationAddress.District,
                Zip           = patientViewModel.occupationAddress.Zip,
                Country       = patientViewModel.occupationAddress.Country
            };

            _context.Address.Add(occupationAddress);
            _context.SaveChanges();

            patientViewModel.Id = patient.Id;
            patientViewModel.permanentAddress.PatientId      = patient.Id;
            patientViewModel.currentAddress.PatientId        = patient.Id;
            patientViewModel.occupationAddress.PatientId     = patient.Id;
            patientViewModel.permanentAddress.AddressTypeId  = 1;
            patientViewModel.currentAddress.AddressTypeId    = 2;
            patientViewModel.occupationAddress.AddressTypeId = 3;

            return(patientViewModel);
        }