示例#1
0
 public static List<TestService> BuildServiseFromDataBaseData(string IdStep)
 {
     List<TestService> serviseList = new List<TestService>();
     using (SqlConnection connection = Global.GetSqlConnection())
     {
         string findService = "SELECT * FROM Service, Step, nsi.ServiceType WHERE Service.IdStep = '" + IdStep + "' AND Service.IdStep = Step.IdStep AND Service.idServiceType = nsi.ServiceType.IdServiceType";
         SqlCommand serviceCommand = new SqlCommand(findService, connection);
         using (SqlDataReader serviceReader = serviceCommand.ExecuteReader())
         {
             while (serviceReader.Read())
             {
                 Service s = new Service();
                 s.PaymentInfo = new PaymentInfo();
                 if (serviceReader["DateEnd"].ToString() != "")
                     s.DateEnd = Convert.ToDateTime(serviceReader["DateEnd"]);
                 else
                     s.DateEnd = DateTime.MinValue;
                 if (serviceReader["DateStart"].ToString() != "")
                     s.DateStart = Convert.ToDateTime(serviceReader["DateStart"]);
                 else
                     s.DateStart = DateTime.MinValue;
                 if (serviceReader["IdFedNsi"].ToString() != "")
                     s.IdServiceType = Convert.ToString(serviceReader["IdFedNsi"]);
                 if (serviceReader["ServiceName"].ToString() != "")
                     s.ServiceName = Convert.ToString(serviceReader["ServiceName"]);
                 if (serviceReader["IdRHealthCareUnit"].ToString() != "")
                     s.PaymentInfo.HealthCareUnit = Convert.ToByte(serviceReader["IdRHealthCareUnit"]);
                 if (serviceReader["IdRVisitPaymentType"].ToString() != "")
                     s.PaymentInfo.IdPaymentType = Convert.ToByte(serviceReader["IdRVisitPaymentType"]);
                 if (serviceReader["IdRPaymentStatus"].ToString() != "")
                     s.PaymentInfo.PaymentState = Convert.ToByte(serviceReader["IdRPaymentStatus"]);
                 if (serviceReader["Quantity"].ToString() != "")
                     s.PaymentInfo.Quantity = Convert.ToInt32(serviceReader["Quantity"]);
                 if (serviceReader["Tariff"].ToString() != "")
                     s.PaymentInfo.Tariff = Convert.ToDecimal(serviceReader["Tariff"]);
                 TestService ts = new TestService(s);
                 if ((serviceReader["IdPersonRole"].ToString() != "") && (serviceReader["IdCase"].ToString() != ""))
                     ts.doctor = TestParticipant.BuildTestParticipantFromDataBase(serviceReader["IdCase"].ToString(), serviceReader["IdDoctor"].ToString(), Convert.ToByte(serviceReader["IdPersonRole"]));
                 serviseList.Add(ts);
             }
         }
     }
     if (serviseList.Count != 0)
         return serviseList;
     else
         return null;
 }
示例#2
0
        public bool CheckDocumentInCase(MedRecord i, string idLpu)
        {
            TestMedRecord doc = null;

            Service serv = i as Service;
            if (serv != null) doc = new TestService(serv);

            TfomsInfo tfi = i as TfomsInfo;
            if (tfi != null) doc = new TestTfomsInfo(tfi);

            DeathInfo di = i as DeathInfo;
            if (di != null) doc = new TestDeathInfo(di);

            Diagnosis diag = i as Diagnosis;
            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                doc = new TestDiagnosis(diag, idLpu);

            ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;
            if ((cmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                doc = new TestClinicMainDiagnosis(cmd, idLpu);

            AnatomopathologicalClinicMainDiagnosis acmd = i as AnatomopathologicalClinicMainDiagnosis;
            if ((acmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                doc = new TestClinicMainDiagnosis(acmd, idLpu);

            Referral r = i as Referral;
            if (r != null) doc = new TestReferral(r, idLpu);

            SickList sl = i as SickList;
            if (sl != null) doc = new TestSickList(sl, idLpu);

            DischargeSummary ds = i as DischargeSummary;
            if (ds != null) doc = new TestDischargeSummary(ds, idLpu);

            LaboratoryReport lr = i as LaboratoryReport;
            if (lr != null) doc = new TestLaboratoryReport(lr, idLpu);

            ConsultNote cn = i as ConsultNote;
            if (cn != null) doc = new TestConsultNote(cn, idLpu);

            DispensaryOne d1 = i as DispensaryOne;
            if ((d1 != null) && (caseBase.idCaseType == dispensaryId))
                doc = new TestDispensaryOne(d1, idLpu);

            AppointedMedication ap = i as AppointedMedication;
            if (ap != null) doc = new TestAppointedMedication(ap, idLpu);

            Form027U form = i as Form027U;
            if (form != null) doc = new TestForm027U(form, idLpu);

            if (Global.IsEqual(doc, null))
            {
                Global.errors1.Add("Документ не найден");
                return true;
            }

            foreach (TestMedRecord document in this.medRecords)
                if (Global.IsEqual(doc, document)) return true;

            return false;
        }
示例#3
0
 private void FindMismatch(TestService s)
 {
     if (this.document.DateEnd != s.document.DateEnd)
         Global.errors3.Add("Несовпадение DateEnd TestService");
     if (this.document.DateStart != s.document.DateStart)
         Global.errors3.Add("Несовпадение DateStart TestService");
     if (this.document.IdServiceType != s.document.IdServiceType)
         Global.errors3.Add("Несовпадение IdServiceType TestService");
     if (this.document.PaymentInfo.HealthCareUnit != s.document.PaymentInfo.HealthCareUnit)
         Global.errors3.Add("Несовпадение HealthCareUnit TestService");
     if (this.document.PaymentInfo.IdPaymentType != s.document.PaymentInfo.IdPaymentType)
         Global.errors3.Add("Несовпадение IdPaymentType TestService");
     if (this.document.PaymentInfo.PaymentState != s.document.PaymentInfo.PaymentState)
         Global.errors3.Add("Несовпадение PaymentState TestService");
     if (this.document.PaymentInfo.Quantity != s.document.PaymentInfo.Quantity)
         Global.errors3.Add("Несовпадение Quantity TestService");
     if (this.document.PaymentInfo.Tariff != s.document.PaymentInfo.Tariff)
         Global.errors3.Add("Несовпадение Tariff TestService");
     if (this.document.ServiceName != s.document.ServiceName)
         Global.errors3.Add("Несовпадение ServiceName TestService");
     if (Global.GetLength(this.doctor) != Global.GetLength(s.doctor))
         Global.errors3.Add("Несовпадение длинны doctor TestService");
 }
示例#4
0
        static public List <TestAmbStep> BuildAmbTestStepsFromDataBase(string idCase, string caseLpu)
        {
            List <TestAmbStep> ambSteps = new List <TestAmbStep>();

            if (idCase != string.Empty)
            {
                List <TestStepBase> steps = TestStepBase.BuildTestStepsFromDataBase(idCase, caseLpu);
                using (SqlConnection connection = Global.GetSqlConnection())
                {
                    foreach (TestStepBase i in steps)
                    {
                        string     findSteps    = "SELECT * FROM AmbStep WHERE IdStep = '" + i.idStep + "'";
                        SqlCommand stepsCommand = new SqlCommand(findSteps, connection);
                        using (SqlDataReader stepsReader = stepsCommand.ExecuteReader())
                        {
                            while (stepsReader.Read())
                            {
                                StepAmb sa = new StepAmb();
                                if (stepsReader["IdVisitPlace"].ToString() != "")
                                {
                                    sa.IdVisitPlace = Convert.ToByte(stepsReader["IdVisitPlace"]);
                                }
                                else
                                {
                                    sa.IdVisitPlace = 0;
                                }
                                if (stepsReader["IdVisitPurpose"].ToString() != "")
                                {
                                    sa.IdVisitPurpose = Convert.ToByte(stepsReader["IdVisitPurpose"]);
                                }
                                else
                                {
                                    sa.IdVisitPurpose = 0;
                                }
                                TestAmbStep st = new TestAmbStep(sa, caseLpu);
                                st.step    = i;
                                st.records = new List <TestMedRecord>();
                                List <TestService> s = TestService.BuildServiseFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(s, null))
                                {
                                    st.records.AddRange(s);
                                }
                                List <TestAppointedMedication> am = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(am, null))
                                {
                                    st.records.AddRange(am);
                                }
                                List <TestDiagnosis> diag = TestDiagnosis.BuildDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(diag, null))
                                {
                                    st.records.AddRange(diag);
                                }
                                TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(acdm, null))
                                {
                                    st.records.Add(acdm);
                                }
                                List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(trl, null))
                                {
                                    st.records.AddRange(trl);
                                }
                                List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(tlr, null))
                                {
                                    st.records.AddRange(tlr);
                                }
                                if (st.records.Count == 0)
                                {
                                    st.records = null;
                                }
                                ambSteps.Add(st);
                            }
                        }
                    }
                }
            }
            if (ambSteps.Count != 0)
            {
                return(ambSteps);
            }
            else
            {
                return(null);
            }
        }
示例#5
0
        static public List <TestStatStep> BuildStatStepsFromDataBase(string idCase, string caseLpu)
        {
            List <TestStatStep> statSteps = new List <TestStatStep>();

            if (idCase != string.Empty)
            {
                List <TestStepBase> steps = TestStepBase.BuildTestStepsFromDataBase(idCase, caseLpu);
                using (SqlConnection connection = Global.GetSqlConnection())
                {
                    foreach (TestStepBase i in steps)
                    {
                        string     findSteps    = "SELECT * FROM HospStep WHERE IdStep = '" + i.idStep + "'";
                        SqlCommand stepsCommand = new SqlCommand(findSteps, connection);
                        using (SqlDataReader stepsReader = stepsCommand.ExecuteReader())
                        {
                            while (stepsReader.Read())
                            {
                                StepStat sa = new StepStat();
                                if (stepsReader["BedNo"].ToString() != "")
                                {
                                    sa.BedNumber = Convert.ToString(stepsReader["BedNo"]);
                                }
                                else
                                {
                                    sa.BedNumber = null;
                                }
                                if (stepsReader["IdBedProfile"].ToString() != "")
                                {
                                    sa.BedProfile = Convert.ToByte(stepsReader["IdBedProfile"]);
                                }
                                else
                                {
                                    sa.BedProfile = 0;
                                }
                                if (stepsReader["DaySpend"].ToString() != "")
                                {
                                    sa.DaySpend = Convert.ToUInt16(stepsReader["DaySpend"]);
                                }
                                else
                                {
                                    sa.DaySpend = 0;
                                }
                                if (stepsReader["HospitalDepartment"].ToString() != "")
                                {
                                    sa.HospitalDepartmentName = Convert.ToString(stepsReader["HospitalDepartment"]);
                                }
                                else
                                {
                                    sa.HospitalDepartmentName = null;
                                }
                                if (stepsReader["IdHospitalDepartment"].ToString() != "")
                                {
                                    sa.IdHospitalDepartment = Convert.ToString(stepsReader["IdHospitalDepartment"]);
                                }
                                else
                                {
                                    sa.IdHospitalDepartment = null;
                                }
                                if (stepsReader["IdRegimenType"].ToString() != "")
                                {
                                    sa.IdRegimen = Convert.ToByte(stepsReader["IdRegimenType"]);
                                }
                                else
                                {
                                    sa.IdRegimen = 0;
                                }
                                if (stepsReader["WardNumber"].ToString() != "")
                                {
                                    sa.WardNumber = Convert.ToString(stepsReader["WardNumber"]);
                                }
                                else
                                {
                                    sa.WardNumber = null;
                                }
                                TestStatStep st = new TestStatStep(sa, caseLpu);
                                st.step    = i;
                                st.records = new List <TestMedRecord>();
                                List <TestService> s = TestService.BuildServiseFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(s, null))
                                {
                                    st.records.AddRange(s);
                                }
                                List <TestAppointedMedication> am = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(am, null))
                                {
                                    st.records.AddRange(am);
                                }
                                List <TestDiagnosis> diag = TestDiagnosis.BuildDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(diag, null))
                                {
                                    st.records.AddRange(diag);
                                }
                                TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(acdm, null))
                                {
                                    st.records.Add(acdm);
                                }
                                List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(trl, null))
                                {
                                    st.records.AddRange(trl);
                                }
                                List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(tlr, null))
                                {
                                    st.records.AddRange(tlr);
                                }
                                if (st.records.Count == 0)
                                {
                                    st.records = null;
                                }
                                statSteps.Add(st);
                            }
                        }
                    }
                }
            }
            if (statSteps.Count != 0)
            {
                return(statSteps);
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        static public List <TestService> BuildServiseFromDataBaseData(string IdStep)
        {
            List <TestService> serviseList = new List <TestService>();

            using (SqlConnection connection = Global.GetSqlConnection())
            {
                string     findService    = "SELECT * FROM Service, Step, nsi.ServiceType WHERE Service.IdStep = '" + IdStep + "' AND Service.IdStep = Step.IdStep AND Service.idServiceType = nsi.ServiceType.IdServiceType";
                SqlCommand serviceCommand = new SqlCommand(findService, connection);
                using (SqlDataReader serviceReader = serviceCommand.ExecuteReader())
                {
                    while (serviceReader.Read())
                    {
                        Service s = new Service();
                        s.PaymentInfo = new PaymentInfo();
                        if (serviceReader["DateEnd"].ToString() != "")
                        {
                            s.DateEnd = Convert.ToDateTime(serviceReader["DateEnd"]);
                        }
                        else
                        {
                            s.DateEnd = DateTime.MinValue;
                        }
                        if (serviceReader["DateStart"].ToString() != "")
                        {
                            s.DateStart = Convert.ToDateTime(serviceReader["DateStart"]);
                        }
                        else
                        {
                            s.DateStart = DateTime.MinValue;
                        }
                        if (serviceReader["IdFedNsi"].ToString() != "")
                        {
                            s.IdServiceType = Convert.ToString(serviceReader["IdFedNsi"]);
                        }
                        if (serviceReader["ServiceName"].ToString() != "")
                        {
                            s.ServiceName = Convert.ToString(serviceReader["ServiceName"]);
                        }
                        if (serviceReader["IdRHealthCareUnit"].ToString() != "")
                        {
                            s.PaymentInfo.HealthCareUnit = Convert.ToByte(serviceReader["IdRHealthCareUnit"]);
                        }
                        if (serviceReader["IdRVisitPaymentType"].ToString() != "")
                        {
                            s.PaymentInfo.IdPaymentType = Convert.ToByte(serviceReader["IdRVisitPaymentType"]);
                        }
                        if (serviceReader["IdRPaymentStatus"].ToString() != "")
                        {
                            s.PaymentInfo.PaymentState = Convert.ToByte(serviceReader["IdRPaymentStatus"]);
                        }
                        if (serviceReader["Quantity"].ToString() != "")
                        {
                            s.PaymentInfo.Quantity = Convert.ToInt32(serviceReader["Quantity"]);
                        }
                        if (serviceReader["Tariff"].ToString() != "")
                        {
                            s.PaymentInfo.Tariff = Convert.ToDecimal(serviceReader["Tariff"]);
                        }
                        TestService ts = new TestService(s);
                        if ((serviceReader["IdPersonRole"].ToString() != "") && (serviceReader["IdCase"].ToString() != ""))
                        {
                            ts.doctor = TestParticipant.BuildTestParticipantFromDataBase(serviceReader["IdCase"].ToString(), serviceReader["IdDoctor"].ToString(), Convert.ToByte(serviceReader["IdPersonRole"]));
                        }
                        serviseList.Add(ts);
                    }
                }
            }
            if (serviseList.Count != 0)
            {
                return(serviseList);
            }
            else
            {
                return(null);
            }
        }
示例#7
0
        public void ChangeUpdateStatCase(string guid, CaseStat cs)
        {
            GUID = guid.ToLower();
            if (cs != null)
            {
                if (cs.DeliveryCode != null)
                {
                    this.caseStat.DeliveryCode = cs.DeliveryCode;
                }
                if (cs.IdIntoxicationType != 0)
                {
                    this.caseStat.IdIntoxicationType = cs.IdIntoxicationType;
                }
                if (cs.IdPatientConditionOnAdmission != 0)
                {
                    this.caseStat.IdPatientConditionOnAdmission = cs.IdPatientConditionOnAdmission;
                }
                if (cs.IdTypeFromDiseaseStart != 0)
                {
                    this.caseStat.IdTypeFromDiseaseStart = cs.IdTypeFromDiseaseStart;
                }
                if (cs.IdTransportIntern != 0)
                {
                    this.caseStat.IdTransportIntern = cs.IdTransportIntern;
                }
                if (cs.IdHospChannel != 0)
                {
                    this.caseStat.IdHospChannel = cs.IdHospChannel;
                }
                this.caseStat.RW1Mark  = cs.RW1Mark;
                this.caseStat.AIDSMark = cs.AIDSMark;
                caseBase.UpdateCaseBase(guid, cs);
                if (cs.MedRecords != null)
                {
                    List <TestMedRecord>    newMedRecords = new List <TestMedRecord>();
                    TestTfomsInfo           tfi           = null;
                    TestClinicMainDiagnosis cmd           = null;
                    TestDischargeSummary    ds            = null;
                    TestConsultNote         cn            = null;
                    TestDeathInfo           tdi           = null;

                    foreach (object i in cs.MedRecords)
                    {
                        Service ser = i as Service;
                        if (ser != null)
                        {
                            newMedRecords.Add(new TestService(ser, cs.IdLpu));
                        }

                        TfomsInfo tf = i as TfomsInfo;
                        if (tf != null)
                        {
                            tfi = new TestTfomsInfo(tf);
                        }

                        Diagnosis diag = i as Diagnosis;
                        if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                        {
                            newMedRecords.Add(new TestDiagnosis(diag, cs.IdLpu));
                        }

                        ClinicMainDiagnosis cd = i as ClinicMainDiagnosis;
                        if ((cd != null) && (cs.HospResult != IdDeath) && (cd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                        {
                            cmd = new TestClinicMainDiagnosis(cd, cs.IdLpu);
                        }

                        ClinicMainDiagnosis ca = i as ClinicMainDiagnosis;
                        if ((ca != null) && (cs.HospResult == IdDeath) && (ca.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                        {
                            cmd = new TestClinicMainDiagnosis(ca, cs.IdLpu);
                        }

                        Referral r = i as Referral;
                        if (r != null)
                        {
                            newMedRecords.Add(new TestReferral(r, cs.IdLpu));
                        }

                        SickList sl = i as SickList;
                        if (sl != null)
                        {
                            newMedRecords.Add(new TestSickList(sl, cs.IdLpu));
                        }

                        DischargeSummary pds = i as DischargeSummary;
                        if (pds != null)
                        {
                            ds = new TestDischargeSummary(pds, cs.IdLpu);
                        }

                        LaboratoryReport lr = i as LaboratoryReport;
                        if (lr != null)
                        {
                            newMedRecords.Add(new TestLaboratoryReport(lr, cs.IdLpu));
                        }

                        ConsultNote pcn = i as ConsultNote;
                        if (pcn != null)
                        {
                            cn = new TestConsultNote(pcn, cs.IdLpu);
                        }

                        AppointedMedication ap = i as AppointedMedication;
                        if (ap != null)
                        {
                            newMedRecords.Add(new TestAppointedMedication(ap, cs.IdLpu));
                        }

                        DeathInfo di = i as DeathInfo;
                        if (di != null)
                        {
                            tdi = new TestDeathInfo(di);
                        }

                        Form027U form = i as Form027U;
                        if (form != null)
                        {
                            newMedRecords.Add(new TestForm027U(form, cs.IdLpu));               //?
                        }
                    }
                    if (Global.GetLength(this.medRecords) != 0)
                    {
                        foreach (object i in this.medRecords)
                        {
                            TestService ser = i as TestService;
                            if (!Global.IsEqual(ser, null))
                            {
                                newMedRecords.Add(ser);
                            }

                            TestTfomsInfo tf = i as TestTfomsInfo;
                            if (!Global.IsEqual(tfi, null) && (!Global.IsEqual(tf, null)))
                            {
                                newMedRecords.Add(tf);
                            }
                            else
                            if (!Global.IsEqual(tfi, null))
                            {
                                newMedRecords.Add(tfi);
                            }

                            TestDiagnosis diag = i as TestDiagnosis;
                            if (!Global.IsEqual(diag, null))
                            {
                                newMedRecords.Add(diag);
                            }

                            TestClinicMainDiagnosis cm = i as TestClinicMainDiagnosis;
                            if (!Global.IsEqual(cmd, null))
                            {
                                newMedRecords.Add(cmd);
                            }
                            else
                            if (!Global.IsEqual(cm, null))
                            {
                                newMedRecords.Add(cm);
                            }

                            TestReferral r = i as TestReferral;
                            if (!Global.IsEqual(r, null))
                            {
                                newMedRecords.Add(r);
                            }

                            TestSickList sl = i as TestSickList;
                            if (!Global.IsEqual(sl, null))
                            {
                                newMedRecords.Add(sl);
                            }

                            TestDischargeSummary pds = i as TestDischargeSummary;
                            if (!Global.IsEqual(ds, null))
                            {
                                newMedRecords.Add(ds);
                            }
                            else
                            if (!Global.IsEqual(pds, null))
                            {
                                newMedRecords.Add(pds);
                            }

                            TestLaboratoryReport lr = i as TestLaboratoryReport;
                            if (!Global.IsEqual(lr, null))
                            {
                                newMedRecords.Add(lr);
                            }

                            TestConsultNote pcn = i as TestConsultNote;
                            if (!Global.IsEqual(cn, null))
                            {
                                newMedRecords.Add(cn);
                            }
                            else
                            if (!Global.IsEqual(pcn, null))
                            {
                                newMedRecords.Add(pcn);
                            }

                            TestAppointedMedication ap = i as TestAppointedMedication;
                            if (!Global.IsEqual(ap, null))
                            {
                                newMedRecords.Add(ap);
                            }

                            TestDeathInfo di = i as TestDeathInfo;
                            if (!Global.IsEqual(tdi, null) && (!Global.IsEqual(di, null)))
                            {
                                newMedRecords.Add(di);
                            }
                            else
                            if (!Global.IsEqual(tdi, null))
                            {
                                newMedRecords.Add(tdi);
                            }

                            TestForm027U form = i as TestForm027U;
                            if (!Global.IsEqual(form, null))
                            {
                                newMedRecords.Add(form);
                            }
                        }
                    }
                    else
                    {
                        if (!Global.IsEqual(tfi, null))
                        {
                            newMedRecords.Add(tfi);
                        }
                        if (!Global.IsEqual(cmd, null))
                        {
                            newMedRecords.Add(cmd);
                        }
                        if (!Global.IsEqual(ds, null))
                        {
                            newMedRecords.Add(ds);
                        }
                        if (!Global.IsEqual(cn, null))
                        {
                            newMedRecords.Add(cn);
                        }
                        if (!Global.IsEqual(tdi, null))
                        {
                            newMedRecords.Add(tdi);
                        }
                    }
                    this.records = newMedRecords;
                }
            }
        }
示例#8
0
        static public TestStatCase BuildAmbCaseFromDataBaseData(string guid, string idlpu, string mis, string patientId)
        {
            if ((guid != string.Empty) && (idlpu != string.Empty) && (mis != string.Empty))
            {
                string caseId = TestCaseBase.GetCaseId(guid, idlpu, mis, patientId);
                if (caseId != null)
                {
                    CaseStat ca = new CaseStat();
                    using (SqlConnection connection = Global.GetSqlConnection())
                    {
                        string     findCase    = "SELECT TOP(1) * FROM HospCase WHERE IdCase = '" + caseId + "'";
                        SqlCommand caseCommand = new SqlCommand(findCase, connection);
                        using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                        {
                            while (caseReader.Read())
                            {
                                if (caseReader["DeliveredCode"].ToString() != "")
                                {
                                    ca.DeliveryCode = Convert.ToString(caseReader["DeliveredCode"]);
                                }
                                if (caseReader["IdIntoxicationType"].ToString() != "")
                                {
                                    ca.IdIntoxicationType = Convert.ToByte(caseReader["IdIntoxicationType"]);
                                }
                                if (caseReader["IdPatientConditionOnAdmission"].ToString() != "")
                                {
                                    ca.IdPatientConditionOnAdmission = Convert.ToByte(caseReader["IdPatientConditionOnAdmission"]);
                                }
                                if (caseReader["IdTypeFromDiseaseStart"].ToString() != "")
                                {
                                    ca.IdTypeFromDiseaseStart = Convert.ToByte(caseReader["IdTypeFromDiseaseStart"]);
                                }
                                if (caseReader["IdTransportIntern"].ToString() != "")
                                {
                                    ca.IdTransportIntern = Convert.ToByte(caseReader["IdTransportIntern"]);
                                }
                                if (caseReader["IdHospChannel"].ToString() != "")
                                {
                                    ca.IdHospChannel = Convert.ToByte(caseReader["IdHospChannel"]);
                                }
                                if (caseReader["RW1Mark"].ToString() != "")
                                {
                                    ca.RW1Mark = Convert.ToBoolean(caseReader["RW1Mark"]);
                                }
                                if (caseReader["AIDSMark"].ToString() != "")
                                {
                                    ca.AIDSMark = Convert.ToBoolean(caseReader["AIDSMark"]);
                                }
                                TestStatCase statcase = new TestStatCase(guid, ca);
                                statcase.caseBase  = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idlpu, mis, patientId);
                                statcase.statSteps = TestStatStep.BuildStatStepsFromDataBase(caseId, ca.IdLpu);
                                List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(caseId, ca.IdLpu);
                                if (st != null)
                                {
                                    foreach (TestStepBase i in st)
                                    {
                                        if (Global.IsEqual(i.doctor, null))
                                        {
                                            statcase.defaultStep = i;
                                        }
                                    }
                                    if (!Global.IsEqual(statcase.defaultStep, null))
                                    {
                                        statcase.records = new List <TestMedRecord>();
                                        List <TestService> serv = TestService.BuildServiseFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(serv, null))
                                        {
                                            statcase.records.AddRange(serv);
                                        }

                                        TestTfomsInfo forms = TestTfomsInfo.BuildTfomsInfoFromDataBaseDate(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(forms, null))
                                        {
                                            statcase.records.Add(forms);
                                        }

                                        TestDeathInfo tdi = TestDeathInfo.BuildDeathInfoFromDataBaseDate(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(tdi, null))
                                        {
                                            statcase.records.Add(tdi);
                                        }

                                        List <TestDiagnosis> td = TestDiagnosis.BuildDiagnosisFromDataBaseDate(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(td, null))
                                        {
                                            statcase.records.AddRange(td);
                                        }

                                        TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(acdm, null))
                                        {
                                            statcase.records.Add(acdm);
                                        }

                                        List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(trl, null))
                                        {
                                            statcase.records.AddRange(trl);
                                        }

                                        List <TestSickList> tsl = TestSickList.BuildSickListFromDataBaseData(statcase.defaultStep.idStep, patientId);
                                        if (!Global.IsEqual(tsl, null))
                                        {
                                            statcase.records.AddRange(tsl);
                                        }

                                        TestDischargeSummary tds = TestDischargeSummary.BuildSickListFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(tds, null))
                                        {
                                            statcase.records.Add(tds);
                                        }

                                        List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(tlr, null))
                                        {
                                            statcase.records.AddRange(tlr);
                                        }

                                        TestConsultNote tcn = TestConsultNote.BuildSickListFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(tcn, null))
                                        {
                                            statcase.records.Add(tcn);
                                        }

                                        List <TestAppointedMedication> ap = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(ap, null))
                                        {
                                            statcase.records.AddRange(ap);
                                        }

                                        List <TestForm027U> form = TestForm027U.BuildForm027UFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(form, null))
                                        {
                                            statcase.records.AddRange(form);
                                        }

                                        if (statcase.records.Count == 0)
                                        {
                                            statcase.records = null;
                                        }
                                    }
                                }
                                return(statcase);
                            }
                        }
                    }
                }
            }
            return(null);
        }