public override CreatePatientEventRes Execute(CreatePatientEventReq pServiceRequest) { CreatePatientEventRes wRes = new CreatePatientEventRes(); int id = MedicalEventDAC.CreateMedicalEvent(pServiceRequest.BusinessData, Guid.Parse(pServiceRequest.ContextInformation.UserId)); if (pServiceRequest.BusinessData.PatientMedicaments != null) { foreach (PatientMedicament_ViewBE patientMedicament in pServiceRequest.BusinessData.PatientMedicaments) { if (patientMedicament.EntityState != Fwk.Bases.EntityState.Unchanged) { if (patientMedicament.PatientMedicamentId_Parent.HasValue) { PatientsDAC.DisablePatientMedicaments(patientMedicament.PatientMedicamentId_Parent.Value, Guid.Parse(pServiceRequest.ContextInformation.UserId), BE.Enums.MedicamentStatus.Finalizado); } patientMedicament.MedicalEventId = id; PatientsDAC.AddPatientMedicaments(patientMedicament, Guid.Parse(pServiceRequest.ContextInformation.UserId)); } } } wRes.BusinessData.EventId = id; return(wRes); }
public override RetriveMedicalEventAlertsRes Execute(RetriveMedicalEventAlertsReq pServiceRequest) { RetriveMedicalEventAlertsRes wRes = new RetriveMedicalEventAlertsRes(); MedicalEventAlert_ViewList wList = new MedicalEventAlert_ViewList(); wRes.BusinessData = MedicalEventDAC.Retrive_MedicalEventAlerts(pServiceRequest.BusinessData.PatientId, pServiceRequest.BusinessData.StartDate, pServiceRequest.BusinessData.RetriveHistory); return(wRes); }
public override RetrivePatientEventRes Execute(RetrivePatientEventReq pServiceRequest) { RetrivePatientEventRes wRes = new RetrivePatientEventRes(); wRes.BusinessData = MedicalEventDAC.RetrivePatientEvent(pServiceRequest.BusinessData.PatientId); return(wRes); }
public override GetPatientEventRes Execute(GetPatientEventReq pServiceRequest) { GetPatientEventRes wRes = new GetPatientEventRes(); wRes.BusinessData = MedicalEventDAC.GetEvent(pServiceRequest.BusinessData.MedicalEventId); var details = MedicalEventDAC.Retrive_MedicalEventDetail_ViewList(pServiceRequest.BusinessData.MedicalEventId); wRes.BusinessData.DetailView_Quirurgicos = details.Get_Quirurgicos(); wRes.BusinessData.DetailView_Diagnosis = details.Get_Diagnosis(); wRes.BusinessData.DetailView_MetodosComplementarios = details.Get_Metodo_Complementarios(); return(wRes); }
public override RetriveMedicalEventDetailsRes Execute(RetriveMedicalEventDetailsReq pServiceRequest) { RetriveMedicalEventDetailsRes wRes = new RetriveMedicalEventDetailsRes(); if (pServiceRequest.BusinessData.MedicalEventId.HasValue) { wRes.BusinessData = MedicalEventDAC.Retrive_MedicalEventDetail_ViewList(pServiceRequest.BusinessData.MedicalEventId.Value); } else { wRes.BusinessData = MedicalEventDAC.Retrive_MedicalEventDetail_ViewList_Patinet(pServiceRequest.BusinessData.PatientId); } return(wRes); }
public override UpdatePatientEventRes Execute(UpdatePatientEventReq pServiceRequest) { UpdatePatientEventRes wRes = new UpdatePatientEventRes(); MedicalEventDAC.UpdateMedicalEvent(pServiceRequest.BusinessData, Guid.Parse(pServiceRequest.ContextInformation.UserId)); int currentMedicalEventId = pServiceRequest.BusinessData.MedicalEventId; if (pServiceRequest.BusinessData.MedicalEventDetailList != null) { foreach (MedicalEventDetailBE medicalEventDetail in pServiceRequest.BusinessData.MedicalEventDetailList) { medicalEventDetail.MedicalEventId = currentMedicalEventId; if (medicalEventDetail.EntityState == EntityState.Added) { MedicalEventDAC.Insert_MedicalEventDetail(medicalEventDetail, Guid.Parse(pServiceRequest.ContextInformation.UserId)); if (medicalEventDetail.DetailType.Equals(AlertTypeEnum.Diagnosis)) { if (medicalEventDetail.RelevanceType.HasValue) { MedicalEventDAC.Create_MedicalEventAlert(currentMedicalEventId, medicalEventDetail.Description, (AlertTypeEnum)medicalEventDetail.DetailType, medicalEventDetail.Id); } } } //Si en medio de la atencion gravo y luego el profesional se arrepiente y decide quitar el medicamento este debe se eliminado fisicamente if (medicalEventDetail.EntityState == EntityState.Deleted) { MedicalEventDAC.Remove_MedicalEventDetail(medicalEventDetail.Id); } } } if (pServiceRequest.BusinessData.PatientMedicaments != null) { //Selecciono medicamentos generados en otros eventos medicos var otherMedicaments = pServiceRequest.BusinessData.PatientMedicaments.Where(p => !p.MedicalEventId.Equals(currentMedicalEventId) && p.EntityState == EntityState.Changed); ///Si cambio algun medicamento de unevento anterior este es deshbilitado y se genera uno nuevo en el actual evento medico ///Logrando asi un hstorial foreach (PatientMedicament_ViewBE patientMedicament in otherMedicaments) { PatientsDAC.DisablePatientMedicaments(patientMedicament.PatientMedicamentId, Guid.Parse(pServiceRequest.ContextInformation.UserId), BE.Enums.MedicamentStatus.Deshabilitado); } //|| p.PatientMedicamentId.Equals(-1) var currentMedicaments = pServiceRequest.BusinessData.PatientMedicaments.Where(p => p.MedicalEventId.Equals(currentMedicalEventId)); foreach (PatientMedicament_ViewBE patientMedicament in currentMedicaments) { patientMedicament.MedicalEventId = currentMedicalEventId; if (patientMedicament.EntityState == EntityState.Added) { PatientsDAC.AddPatientMedicaments(patientMedicament, Guid.Parse(pServiceRequest.ContextInformation.UserId)); } //Si modifique del mismo event Id (Esto se da por que el medico desidio guardar y luego modifico el evento si cerrar pantall // y nuevamente preciona gurdar ) if (patientMedicament.EntityState == EntityState.Changed) { PatientsDAC.UpdatePatientMedicaments(patientMedicament, Guid.Parse(pServiceRequest.ContextInformation.UserId)); } //Si en medio de la atencion gravo y luego el profesional se arrepiente y decide quitar el medicamento este debe se eliminado fisicamente if (patientMedicament.EntityState == EntityState.Deleted) { PatientsDAC.RemovePatientMedicaments(patientMedicament.PatientMedicamentId); } } } return(wRes); }