public VisitTO(Visit mdo) { if (mdo == null) { return; } this.id = mdo.Id; this.type = mdo.Type; if (mdo.Patient != null) { this.patient = new PatientTO(mdo.Patient); } if (mdo.Attending != null) { this.attending = new UserTO(mdo.Attending); } if (mdo.Provider != null) { this.provider = new UserTO(mdo.Provider); } this.service = mdo.Service; if (mdo.Location != null) { this.location = new HospitalLocationTO(mdo.Location); } this.patientType = mdo.PatientType; this.visitId = mdo.VisitId; this.timestamp = mdo.Timestamp; this.status = mdo.Status; if (mdo.Facility != null) { facility = new SiteTO(new Site(mdo.Facility.Id, mdo.Facility.Name)); } }
public VisitTO(Visit mdo) { this.id = mdo.Id; this.type = mdo.Type; if (mdo.Patient != null) { this.patient = new PatientTO(mdo.Patient); } if (mdo.Attending != null) { this.attending = new UserTO(mdo.Attending); } if (mdo.Provider != null) { this.provider = new UserTO(mdo.Provider); } this.service = mdo.Service; if (mdo.Location != null) { this.location = new HospitalLocationTO(mdo.Location); } this.patientType = mdo.PatientType; this.visitId = mdo.VisitId; this.timestamp = mdo.Timestamp; this.status = mdo.Status; }
public OrderTO(Order mdoOrder) { if (mdoOrder == null) { return; } this.id = mdoOrder.Id; this.timestamp = mdoOrder.Timestamp.ToString("yyyyMMdd.HHmmss"); this.orderingServiceName = mdoOrder.OrderingServiceName; this.treatingSpecialty = mdoOrder.TreatingSpecialty; this.startDate = mdoOrder.StartDate.ToString("yyyyMMdd.HHmmss"); this.stopDate = mdoOrder.StopDate.ToString("yyyyMMdd.HHmmss"); this.status = mdoOrder.Status; this.sigStatus = mdoOrder.SigStatus; this.dateSigned = mdoOrder.DateSigned.ToString("yyyyMMdd.HHmmss"); this.verifyingNurse = mdoOrder.VerifyingNurse; this.dateVerified = mdoOrder.DateVerified.ToString("yyyyMMdd.HHmmss"); this.verifyingClerk = mdoOrder.VerifyingClerk; this.chartReviewer = mdoOrder.ChartReviewer; this.dateReviewed = mdoOrder.DateReviewed.ToString("yyyyMMdd.HHmmss"); this.provider = new UserTO(mdoOrder.Provider); this.text = mdoOrder.Text; this.detail = mdoOrder.Detail; this.errMsg = mdoOrder.ErrMsg; this.flag = mdoOrder.Flag; this.type = new OrderTypeTO(mdoOrder.Type); }
public AdtTO(Adt mdo) { if (mdo == null) { return; } this.id = mdo.Id; this.patient = new PatientTO(mdo.Patient); this.checkInId = mdo.CheckInId; this.checkOutId = mdo.CheckOutId; this.relatedPhysicalMovementId = mdo.RelatedPhysicalMovementId; this.transaction = mdo.Transaction; this.movementType = mdo.MovementType; this.timestamp = mdo.Timestamp.ToString("yyyyMMdd.HHmmss"); this.diagnosis = mdo.Diagnosis; this.assignedLocation = new HospitalLocationTO(mdo.AssignedLocation); this.provider = new UserTO(mdo.Provider); this.attending = new UserTO(mdo.Attending); this.transferFacility = mdo.TransferFacility; this.specialty = new TaggedText(mdo.Specialty); this.patientTxId = mdo.PatientTxId; this.visitId = mdo.VisitId; this.patientMovementNumber = mdo.PatientMovementNumber; this.nextPatientMovement = mdo.NextPatientMovement; this.enteredBy = new UserTO(mdo.EnteredBy); this.lengthOfStay = mdo.LengthOfStay; this.passDays = mdo.PassDays; this.daysAbsent = mdo.DaysAbsent; this.asihAdmission = new TaggedText(mdo.AsihAdmission); this.asihTransfer = mdo.AsihTransfer; this.asihSequence = mdo.AsihSequence; this.asihDays = mdo.AsihDays; this.absenceReturnDate = mdo.AbsenceReturnDate.ToString("yyyyMMdd.HHmmss"); this.admittedForScCondition = mdo.AdmittedForScCondition; this.scheduledAdmission = mdo.ScheduledAdmission; this.admissionSource = mdo.AdmissionSource; this.admittingCategory = mdo.AdmittingCategory; this.admittingRegulation = new TaggedText(mdo.AdmittingRegulation); this.admittingEligibility = new TaggedText(mdo.AdmittingEligibility); this.masMovementType = new TaggedText(mdo.MasMovementType); this.lodgingReason = mdo.LodgingReason; this.lodgingComments = mdo.LodgingComments; this.disposition = mdo.Disposition; this.eligibility = mdo.Eligibility; this.preAdmitId = mdo.PreAdmitId; this.referring = new UserTO(mdo.Referring); this.consulting = new UserTO(mdo.Consulting); this.admitting = new UserTO(mdo.Admitting); this.service = new TaggedText(mdo.Service); this.priorLocation = new HospitalLocationTO(mdo.PriorLocation); this.temporaryLocation = new HospitalLocationTO(mdo.TemporaryLocation); this.pendingLocation = new HospitalLocationTO(mdo.PendingLocation); this.patientType = mdo.PatientType; this.admitTimestamp = mdo.AdmitTimestamp.ToString("yyyyMMdd.HHmmss"); this.dischargeTimestamp = mdo.DischargeTimestamp.ToString("yyyyMMdd.HHmmss"); this.admitReason = mdo.AdmitReason; this.transferReason = mdo.TransferReason; }
void buildArray(User[] mdo) { users = new UserTO[mdo.Length]; for (int i = 0; i < mdo.Length; i++) { users[i] = new UserTO(mdo[i]); } count = mdo.Length; }
public UserArray(User[] mdoUsers) { if (mdoUsers == null) { return; } users = new UserTO[mdoUsers.Length]; for (int i = 0; i < mdoUsers.Length; i++) { users[i] = new UserTO(mdoUsers[i]); } count = mdoUsers.Length; }
public TaggedUserArray(string tag, User[] mdoUsers) { this.tag = tag; if (mdoUsers == null) { this.count = 0; return; } users = new UserTO[mdoUsers.Length]; for (int i = 0; i < mdoUsers.Length; i++) { users[i] = new UserTO(mdoUsers[i]); } count = mdoUsers.Length; }
public OrderTO(Order mdoOrder) { this.id = mdoOrder.Id; this.timestamp = mdoOrder.Timestamp.ToString("yyyyMMdd.HHmmss"); this.orderingServiceName = mdoOrder.OrderingServiceName; this.treatingSpecialty = mdoOrder.TreatingSpecialty; this.startDate = mdoOrder.StartDate.ToString("yyyyMMdd.HHmmss"); this.stopDate = mdoOrder.StopDate.ToString("yyyyMMdd.HHmmss"); this.status = mdoOrder.Status; this.sigStatus = mdoOrder.SigStatus; this.dateSigned = mdoOrder.DateSigned.ToString("yyyyMMdd.HHmmss"); this.verifyingNurse = mdoOrder.VerifyingNurse; this.dateVerified = mdoOrder.DateVerified.ToString("yyyyMMdd.HHmmss"); this.verifyingClerk = mdoOrder.VerifyingClerk; this.chartReviewer = mdoOrder.ChartReviewer; this.dateReviewed = mdoOrder.DateReviewed.ToString("yyyyMMdd.HHmmss"); this.provider = new UserTO(mdoOrder.Provider); this.text = mdoOrder.Text; this.detail = mdoOrder.Detail; this.errMsg = mdoOrder.ErrMsg; this.flag = mdoOrder.Flag; this.type = new OrderTypeTO(mdoOrder.Type); }
public PersonsTO(UserTO user, PatientTO patient) { this.user = user; this.patient = patient; }
public UserPatientTO(User user, Patient patient) { this.user = new UserTO(user); this.patient = new PatientTO(patient); }
/// <summary> /// Connect to and log onto a data source. /// </summary> /// <remarks> /// Combines connecting, authentication and authorization into a single function. /// It will create a new set of session credentials and a primary permission. /// These credentials can then be used for subsequent visits. Calls login. /// </remarks> /// <param name="sourceId">Station number</param> /// <param name="accountId">Access code</param> /// <param name="accountPwd">Verify code</param> /// <param name="permissionString">If blank defaults to CPRS context</param> /// <returns>UserTO</returns> public UserTO connectAndLogin(string sourceId, string accountId, string accountPwd, string permissionString) { UserTO result = new UserTO(); if (sourceId == "") { result.fault = new FaultTO("Missing source ID"); } else if (accountId == "") { result.fault = new FaultTO("Missing account ID"); } else if (accountPwd == "") { result.fault = new FaultTO("Missing account password"); } if (result.fault != null) { return result; } try { ConnectionLib cxnLib = new ConnectionLib(mySession); DataSourceArray da = cxnLib.connectToLoginSite(sourceId); if (da.fault != null) { result.fault = da.fault; return result; } result = login(accountId, accountPwd, permissionString); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
/// <summary> /// Visit a single data source and authorize without a previous login. /// </summary> /// <remarks> /// This method is for visits without logins. It makes its credentials /// and user the session credentials and session user. /// </remarks> /// <param name="pwd">Client app's BSE security phrase</param> /// <param name="sourceId">Station number of site to visit</param> /// <param name="userSourceId">User's station number</param> /// <param name="userName">User's name as it appears in VistA</param> /// <param name="userLocalId">User's DUZ</param> /// <param name="userFederatedId">User's SSN</param> /// <param name="permissionString">If blank defaults to CPRS context</param> /// <returns>UserTO</returns> public UserTO visitAndAuthorize( string pwd, string sourceId, string userSourceId, string userName, string userLocalId, string userFederatedId, string permissionString) { UserTO result = new UserTO(); //Make sure we have all the args we need if (mySession == null || mySession.SiteTable == null) { result.fault = new FaultTO("No session has been started"); } else if (sourceId == "") { result.fault = new FaultTO("Missing sitecode of site to visit"); } else if (mySession.SiteTable.getSite(sourceId) == null) { result.fault = new FaultTO("No site " + sourceId + " in the site table"); } else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0 && mySession.ConnectionSet.IsConnected(sourceId)) { result.fault = new FaultTO("Site " + sourceId + " already connected"); } else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0) { result.fault = new FaultTO("This session has pre-existing connections and this method should be the base connection.","Do a disconnect?"); } else if (userSourceId == "") { result.fault = new FaultTO("Missing userSitecode"); } else if (userName == "") { result.fault = new FaultTO("Missing userName"); } else if (userLocalId == "") { result.fault = new FaultTO("Missing DUZ"); } else if (userFederatedId == "") { result.fault = new FaultTO("Missing SSN"); } if (result.fault != null) { return result; } try { SiteTable t = mySession.SiteTable; Site userSite = (Site)t.Sites[userSourceId]; if (userSite == null) { result.fault = new FaultTO("No such site: " + userSourceId); return result; } Site visitSite = (Site)t.Sites[sourceId]; if (visitSite == null) { result.fault = new FaultTO("No such site: " + sourceId); return result; } DataSource dataSource = visitSite.getDataSourceByModality("HIS"); if (dataSource == null) { result.fault = new FaultTO("Site " + sourceId + " has no HIS"); return result; } mySession.Credentials = MdwsUtils.setVisitCredentials(userLocalId, userFederatedId, userName, "", userSite.getDataSourceByModality("HIS"), pwd); mySession.Credentials.SecurityPhrase = pwd; if (permissionString == "") { permissionString = mySession.DefaultPermissionString; } mySession.PrimaryPermission = new MenuOption(permissionString); mySession.User = doTheVisit(sourceId, mySession.Credentials, mySession.PrimaryPermission); mySession.User.Name = new PersonName(userName); mySession.User.SSN = new SocSecNum(userFederatedId); mySession.User.LogonSiteId = dataSource.SiteId; addMyCxn2CxnSet(); result = new UserTO(mySession.User); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
/// <summary> /// Log onto a data source. /// </summary> /// <remarks> /// Combines authentication and authorization into a single function. /// It will create a new set of session credentials and a primary permission. /// These credentials can then be used for subsequent visits. /// Login requires a previous connection. /// </remarks> /// <param name="accountId">Access code</param> /// <param name="accountPwd">Verify code</param> /// <param name="permissionString">If blank defaults to CPRS context</param> /// <returns>UserTO</returns> public UserTO login(string accountId, string accountPwd, string permissionString) { UserTO result = new UserTO(); if (!mySession.HasBaseConnection) { result.fault = new FaultTO("There is no connection to log onto"); } else if (accountId == "") { result.fault = new FaultTO("Missing account ID"); } else if (accountPwd == "") { result.fault = new FaultTO("Missing account password"); } if (result.fault != null) { return result; } try { AbstractConnection c = mySession.ConnectionSet.BaseConnection; AbstractCredentials credentials = AbstractCredentials.getCredentialsForCxn(c); credentials.AccountName = accountId; credentials.AccountPassword = accountPwd; c.Account.AuthenticationMethod = MdwsConstants.LOGIN_CREDENTIALS; if (String.IsNullOrEmpty(permissionString)) { permissionString = MdwsConstants.CPRS_CONTEXT; } mySession.PrimaryPermission = new MenuOption(permissionString); mySession.User = c.Account.authenticateAndAuthorize(credentials, mySession.PrimaryPermission); mySession.Credentials = credentials; result = new UserTO(mySession.User); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public UserPatientTO(UserTO userTO, PatientTO patientTO) { this.user = userTO; this.patient = patientTO; }
public UserTO userLookup(string duz) { UserTO result = new UserTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession); if (String.IsNullOrEmpty(duz)) { result.fault = new FaultTO("Missing DUZ param"); } else if (msg != "OK") { result.fault = new FaultTO(msg); } if (result.fault != null) { return result; } try { AbstractConnection cxn = mySession.ConnectionSet.BaseConnection; UserApi api = new UserApi(); User[] user = api.userLookup(cxn, new System.Collections.Generic.KeyValuePair<string, string>("DUZ", duz)); result = new UserTO(user[0]); } catch (Exception exc) { result.fault = new FaultTO(exc); } return result; }
internal UserTO getUser(AbstractConnection cxn, string DUZ) { UserTO result = new UserTO(); if (DUZ == "") { result.fault = new FaultTO("Missing DUZ"); } if (result.fault != null) { return result; } try { UserApi api = new UserApi(); User u = api.getUser(cxn, DUZ); result = new UserTO(u); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public UserTO getUser(string sitecode, string DUZ) { if (sitecode == "") { UserTO result = new UserTO(); result.fault = new FaultTO("Missing sitecode"); return result; } return getUser(mySession.ConnectionSet.getConnection(sitecode), DUZ); }