Ejemplo n.º 1
0
        ///<summary>Returns a list of clinics that are associated to any clones of the master patient passed in (patNumFrom).
        ///This method will include the clinic for the master patient passed in.</summary>
        public static List <Clinic> GetClinicsForClones(long patNumFrom)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <Clinic> >(MethodBase.GetCurrentMethod(), patNumFrom));
            }
            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                throw new ApplicationException("GetClinicsForClones is not currently Oracle compatible.  Please call support.");
            }
            //Always include the master patient's clinic.
            List <long> listPatNumClones = new List <long>()
            {
                patNumFrom
            };

            //Get all clones (PatNumTos) that are associated to the master patient passed in (patNumFrom).
            listPatNumClones.AddRange(PatientLinks.GetPatNumsLinkedFrom(patNumFrom, PatientLinkType.Clone));
            //Get the clinics associated to all of the clones for this patient.
            string command = "SELECT * FROM clinic "
                             + "INNER JOIN patient ON clinic.ClinicNum=patient.ClinicNum "
                             + "WHERE patient.PatNum IN (" + string.Join(",", listPatNumClones) + ") "
                             + "GROUP BY clinic.ClinicNum";  //We only care about unique clinics, it doesn't matter if several clones have the same clinic.

            return(Crud.ClinicCrud.SelectMany(command));
        }
Ejemplo n.º 2
0
        ///<summary>Returns the CustomerId that PaySimple gave us for the given patNum.
        ///If addToPaySimpleIfMissing, the PaySimple API will add the given patNum if a link isn't in our database and return the new CustomerId.
        ///Otherwise, it will return 0.</summary>
        public static long GetCustomerIdForPat(long patNum, string fname, string lname, long clinicNum = -1)
        {
            long psCustomerId = PatientLinks.GetPatNumsLinkedFrom(patNum, PatientLinkType.PaySimple).FirstOrDefault();

            if (psCustomerId == 0)           //Patient doesn't have a PaySimpleCustomerId
            {
                psCustomerId = AddCustomer(fname, lname, (patNum > 0 ? "PatNum: " + patNum.ToString() : ""), clinicNum);
                PatientLinks.Insert(new PatientLink()
                {
                    PatNumFrom = patNum,
                    PatNumTo   = psCustomerId,
                    LinkType   = PatientLinkType.PaySimple,
                });
            }
            return(psCustomerId);
        }