Exemple #1
0
        public ScheduledSurgery ScheduleSurgery(Treatment treatment, DateTime startDate, DateTime endDate, string cause, Surgeon surgeon, ExamOperationRoom room)
        {
            ScheduledSurgery scheduledSurgery = new ScheduledSurgery(startDate, endDate, cause, surgeon);

            treatment.ScheduledSurgery = scheduledSurgery;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);
            Patient       patient       = medicalRecord.Patient;
            Appointment   surgery       = new Appointment(surgeon, patient, room, TypeOfAppointment.SURGERY, startDate, endDate);

            AppointmentRepository.Instance.Save(surgery);
            return(treatment.ScheduledSurgery);
        }
Exemple #2
0
        static void Main()
        { /*
           *             DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview("Nova dijagnoza", "Nova procedura");
           *             DiagnosisAndReview diagnosisAndReview2 = new DiagnosisAndReview("Nova dijagnoza2", "Nova procedura2");
           *             DiagnosisAndReviewRepository.Instance.Save(diagnosisAndReview);
           *             DiagnosisAndReviewRepository.Instance.Save(diagnosisAndReview2);
           *             //            DiagnosisAndReviewRepository.Instance.Delete(2);
           *             List<DiagnosisAndReview> diagnosisAndReviews =  DiagnosisAndReviewRepository.Instance.GetAll();
           *             Console.WriteLine("Lista dijagnoza:");
           *             foreach (DiagnosisAndReview dAndR in diagnosisAndReviews)
           *             {
           *                 Console.WriteLine(dAndR);
           *             }
           * //            Console.WriteLine("Dijagnoza id == 3:" + DiagnosisAndReviewRepository.Instance.GetDiagnosisAndReview(3).Id);
           *
           *             Drug drug1 = new Drug(null, "Panklav 200mg", "Opis Panklava", true, 20);
           *             Drug drug2 = new Drug(null, "Aerius 50mg", "Opis Aeriusa", false, 5);
           *             List<Drug> drugs = new List<Drug>();
           *             drugs.Add(drug1);
           *             drugs.Add(drug2);
           *
           *             Prescription prescription = new Prescription(drugs);
           *             PrescriptionRepository.Instance.Save(prescription);
           *             List<Prescription> prescriptions = PrescriptionRepository.Instance.GetAll();
           *             PrescriptionRepository.Instance.Delete(3);
           *             foreach (Prescription p in prescriptions)
           *             {
           *                 Console.WriteLine(p);
           *             }
           *         }
           *
           * DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview("Nova dijagnoza", "Nova procedura");
           * Drug drug1 = new Drug(null, "Panklav 200mg", "Opis Panklava", true, 20);
           * Drug drug2 = new Drug(null, "Aerius 50mg", "Opis Aeriusa", false, 5);
           * List<Drug> drugs = new List<Drug>();
           * drugs.Add(drug1);
           * drugs.Add(drug2);
           * Prescription prescription = new Prescription(drugs);
           * Treatment treatment = new Treatment(prescription, new ScheduledSurgery(DateTime.Today, DateTime.Now, "Razlog operacije", new Surgeon("Pera", "Peric", SurgicalSpecialty.CARDIOTHORACIC)), diagnosisAndReview, new ReferralToHospitalTreatment(DateTime.Today, DateTime.Now, "Razlog bolnickog lecenja"), DateTime.Today, DateTime.Now, new Doctor("Marko", "Markovic"));
           * TreatmentRepository.Instance.Save(treatment);
           */
            /*            Blog blog1 = new Blog("naslov 1", "blablbalblalba", DateTime.Now);
             *          Blog blog2 = new Blog("naslov 2", "blablbalblalba", DateTime.Now.AddHours(2));
             *          BlogController.Instance.Create(blog1);
             *          BlogController.Instance.Create(blog2);
             *          BlogController.Instance.GetBlogByTitle("naslov 1");
             *          BlogController.Instance.Delete(blog1);
             *          blog2.Text = "Promenjen text";
             *          BlogController.Instance.Edit(blog2);*/
            Drug        drug1 = new Drug(213, null, "Panklav 200mg", "Opis Panklava", true, 20);
            Drug        drug2 = new Drug(312, null, "Aerius 50mg", "Opis Aeriusa", false, 5);
            List <Drug> drugs = new List <Drug>();

            drugs.Add(drug1);
            drugs.Add(drug2);
            DrugRepository.Instance.Save(drug1);
            DrugRepository.Instance.Save(drug2);

            Doctor doctor = new Doctor(123, "Marko", "Markovic", Model.SystemUsers.Gender.MALE, DateTime.Now);

            DoctorController.Instance.Create(doctor);
//            DoctorRepository.Instance.Save(doctor);

            DateTime startDate = DateTime.Now;
            DateTime endDate   = DateTime.Now.AddDays(1);

            Prescription prescription = new Prescription(drugs);

            Surgeon surgeon = new Surgeon(222, "Pera", "Peric", Model.SystemUsers.Gender.FEMALE, DateTime.Now, SurgicalSpecialty.CARDIOTHORACIC);

            SurgeonController.Instance.Create(surgeon);
            //           SurgeonRepository.Instance.Save(surgeon);
            ScheduledSurgery scheduledSurgery = new ScheduledSurgery(startDate, endDate, "Razlog za operaciju", surgeon);

            Specialist specialist = new Specialist(333, "Ana", "Jovanovic", Model.SystemUsers.Gender.FEMALE, DateTime.Now, Specialization.ENDOCRINOLOGY);

            SpecialistController.Instance.Create(specialist);
//            SpecialistRepository.Instance.Save(specialist);
            SpecialistAppointment specialistAppointment = new SpecialistAppointment("Razlog za specijalistu", specialist);

            ReferralToHospitalTreatment referralToHospitalTreatment = new ReferralToHospitalTreatment("Razlog za bolnicko lecenje", drugs);

            DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview("Dijagnoza", "Procedura");

            Patient   patient   = new Patient("Sima", "Simic", 345);
            Treatment treatment = new Treatment(prescription, scheduledSurgery, diagnosisAndReview, referralToHospitalTreatment, startDate, endDate, 23, doctor, specialistAppointment);

//            TreatmentController.Instance.Create(patient, treatment);
            TreatmentRepository.Instance.Save(treatment);

            Treatment treatment2 = new Treatment(prescription, new ScheduledSurgery(), diagnosisAndReview, referralToHospitalTreatment, startDate, endDate, 23, doctor, specialistAppointment);

            //            TreatmentController.Instance.Create(patient, treatment);
            TreatmentRepository.Instance.Save(treatment2);
            Console.WriteLine(TreatmentController.Instance.GetTreatment(treatment2).Prescription.Drugs[0].Name);

            Treatment treatment1 = TreatmentRepository.Instance.GetTreatment(23);

            foreach (Drug oneDrug in treatment1.Prescription.Drugs)
            {
                Console.WriteLine(oneDrug.Name);
            }

            Console.WriteLine("\n\n");
            foreach (Drug oneDrug in treatment1.ReferralToHospitalTreatment.Drugs)
            {
                Console.WriteLine(oneDrug.Name);
            }

            Console.WriteLine("\n\n");
            Console.WriteLine(treatment1.Doctor.NameAndSurname);
            Console.WriteLine(treatment1.ScheduledSurgery.Surgeon.NameAndSurname);
            Console.WriteLine(treatment1.SpecialistAppointment.Doctor.NameAndSurname);
//            DoctorDrugService doctorDrugService = new DoctorDrugService(new DrugService());
//            doctorDrugService.LowerQuantity(drug1);

            DoctorDrugController doctorDrugController = new DoctorDrugController(new DrugController());

            doctorDrugController.LowerQuantity(drug1);

            //            ManagerDrugService managerDrugService = new ManagerDrugService(new DrugService());
            //            managerDrugService.AddDrug("Prozak", 15);

            ManagerDrugController managerDrugController = new ManagerDrugController(new DrugController());

            managerDrugController.AddDrug("Prozak", 22);
        }
        public Treatment ConvertCSVFormatToEntity(string entityCSVFormat)
        {
            string[] tokens = entityCSVFormat.Split(Delimiter.ToCharArray());
            long     id     = long.Parse(tokens[0]);

            string doctorId = tokens[1];
            Doctor doctor   = DoctorRepository.Instance.GetDoctorById(long.Parse(doctorId));

            DateTime startDate = DateTime.ParseExact(tokens[2], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture);
            DateTime endDate   = DateTime.ParseExact(tokens[3], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture);

            List <Drug> prescriptionDrugs      = new List <Drug>();
            string      prescriptionDrugString = tokens[4];

            string[] prescriptionDrugParts = prescriptionDrugString.Split('|');
            if (!prescriptionDrugString.Equals(""))
            {
                foreach (string drugID in prescriptionDrugParts)
                {
                    Drug drug = DrugRepository.Instance.GetDrugById(long.Parse(drugID));
                    prescriptionDrugs.Add(drug);
                }
            }
            Prescription prescription = new Prescription(prescriptionDrugs);

            ScheduledSurgery scheduledSurgery = new ScheduledSurgery();

            if (!tokens[5].Equals(""))
            {
                DateTime surgeryStartDate = DateTime.ParseExact(tokens[5], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture);
                DateTime surgeryEndDate   = DateTime.ParseExact(tokens[6], "dd/MM/yyyy hh:mm", CultureInfo.InvariantCulture);
                string   causeForSurgery  = tokens[7];
                Surgeon  surgeon          = SurgeonRepository.Instance.GetSurgeonById(long.Parse(tokens[8]));
                scheduledSurgery = new ScheduledSurgery(surgeryStartDate, surgeryEndDate, causeForSurgery, surgeon);
            }

            Specialist            specialist = SpecialistRepository.Instance.GetSpecialistById(long.Parse(tokens[9]));
            string                causeForSpecialistAppointment = tokens[10];
            SpecialistAppointment specialistAppointment         = new SpecialistAppointment(causeForSpecialistAppointment, specialist);

            string      causeForHospitalTreatment    = tokens[11];
            List <Drug> hospitalTreatmentDrugs       = new List <Drug>();
            string      hospitalTreatmentDrugsString = tokens[12];

            string[] hospitalTreatmentDrugsParts = hospitalTreatmentDrugsString.Split('|');
            if (!hospitalTreatmentDrugsString.Equals(""))
            {
                foreach (string drugID in hospitalTreatmentDrugsParts)
                {
                    Drug drug = DrugRepository.Instance.GetDrugById(long.Parse(drugID));
                    hospitalTreatmentDrugs.Add(drug);
                }
            }
            ReferralToHospitalTreatment referralToHospitalTreatment = new ReferralToHospitalTreatment(causeForHospitalTreatment, hospitalTreatmentDrugs);

            string             diagnosis          = tokens[13];
            string             review             = tokens[14];
            DiagnosisAndReview diagnosisAndReview = new DiagnosisAndReview(diagnosis, review);

            return(new Treatment(prescription, scheduledSurgery, diagnosisAndReview, referralToHospitalTreatment, startDate, endDate, id, doctor, specialistAppointment));
        }