예제 #1
0
        public override bool Equals(Object obj)
        {
            TestDispensaryOne p = obj as TestDispensaryOne;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.dispansaryOne == p.dispansaryOne)
            {
                return(true);
            }
            if ((this.dispansaryOne == null) || (p.dispansaryOne == null))
            {
                return(false);
            }
            if ((this.dispansaryOne.CreationDate == p.dispansaryOne.CreationDate) &&
                (this.dispansaryOne.HasExpertCareRefferal == p.dispansaryOne.HasExpertCareRefferal) &&
                (this.dispansaryOne.HasExtraResearchRefferal == p.dispansaryOne.HasExtraResearchRefferal) &&
                (this.dispansaryOne.HasHealthResortRefferal == p.dispansaryOne.HasHealthResortRefferal) &&
                (this.dispansaryOne.HasPrescribeCure == p.dispansaryOne.HasPrescribeCure) &&
                (this.dispansaryOne.HasSecondStageRefferal == p.dispansaryOne.HasSecondStageRefferal) &&
                (this.dispansaryOne.Header == p.dispansaryOne.Header) &&
                (this.dispansaryOne.IsGuested == p.dispansaryOne.IsGuested) &&
                (this.dispansaryOne.IsUnderObservation == p.dispansaryOne.IsUnderObservation) &&
                (this.dispansaryOne.HealthGroup.HealthGroupInfo.Date == p.dispansaryOne.HealthGroup.HealthGroupInfo.Date) &&
                (this.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup == p.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup) &&
                (Global.IsEqual(this.attachment, p.attachment)) &&
                (Global.IsEqual(this.doctor, p.doctor)) &&
                (Global.IsEqual(this.hdDoctor, p.hdDoctor)) &&
                (Global.IsEqual(this.recommendation, p.recommendation)))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestDispensaryOne");
                return(false);
            }
        }
예제 #2
0
 public static TestDispensaryOne BuildSickListFromDataBaseData(string idStep)
 {
     if (idStep != "")
     {
         List<TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idDispensaryOne);
         if (lta != null)
             foreach (TestAttachment i in lta)
             {
                 using (SqlConnection connection = Global.GetSqlConnection())
                 {
                     string findDO = "SELECT TOP(1) * FROM DispensaryStage1, DispensaryStage1HealthGroup WHERE DispensaryStage1.idDispensaryStage1 = (SELECT MAX(idDispensaryStage1) FROM DispensaryStage1 WHERE IdMedDocument = '" + i.idMedDocument + "') AND DispensaryStage1.idDispensaryStage1 = DispensaryStage1HealthGroup.idDispensaryStage1";
                     SqlCommand DOcommand = new SqlCommand(findDO, connection);
                     using (SqlDataReader DOReader = DOcommand.ExecuteReader())
                     {
                         while (DOReader.Read())
                         {
                             DispensaryOne r = new DispensaryOne();
                             r.HealthGroup = new HealthGroup();
                             r.HealthGroup.HealthGroupInfo = new HealthGroupInfo();
                             if (DOReader["IsGuested"].ToString() != "")
                                 r.IsGuested = Convert.ToBoolean(DOReader["IsGuested"]);
                             if (DOReader["HasExtraResearchRefferal"].ToString() != "")
                                 r.HasExtraResearchRefferal = Convert.ToBoolean(DOReader["HasExtraResearchRefferal"]);
                             if (DOReader["IsUnderObservation"].ToString() != "")
                                 r.IsUnderObservation = Convert.ToBoolean(DOReader["IsUnderObservation"]);
                             if (DOReader["HasExpertCareRefferal"].ToString() != "")
                                 r.HasExpertCareRefferal = Convert.ToBoolean(DOReader["HasExpertCareRefferal"]);
                             if (DOReader["HasPrescribeCure"].ToString() != "")
                                 r.HasPrescribeCure = Convert.ToBoolean(DOReader["HasPrescribeCure"]);
                             if (DOReader["HasHealthResortRefferal"].ToString() != "")
                                 r.HasHealthResortRefferal = Convert.ToBoolean(DOReader["HasHealthResortRefferal"]);
                             if (DOReader["HasSecondStageRefferal"].ToString() != "")
                                 r.HasSecondStageRefferal = Convert.ToBoolean(DOReader["HasSecondStageRefferal"]);
                             if (DOReader["IdHealthGroup"].ToString() != "")
                                 r.HealthGroup.HealthGroupInfo.IdHealthGroup = Convert.ToByte(DOReader["IdHealthGroup"]);
                             if (DOReader["Date"].ToString() != "")
                                 r.HealthGroup.HealthGroupInfo.Date = Convert.ToDateTime(DOReader["Date"]);
                             r.Header = i.DocHead;
                             r.CreationDate = i.CreationDate;
                             TestDispensaryOne tdo = new TestDispensaryOne(r);
                             if (DOReader["IdDoctor"].ToString() != "")
                                 tdo.hdDoctor = TestDoctor.BuildTestDoctorFromDataBase((DOReader["IdDoctor"]).ToString());
                             if (DOReader["idDispensaryStage1"].ToString() != "")
                                 tdo.recom = TestRecommendation.BuildSickListFromDataBaseData(DOReader["idDispensaryStage1"].ToString());
                             tdo.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor);
                             tdo.attachment = i;
                             return tdo;
                         }
                     }
                 }
             }
     }
     return null;
 }
예제 #3
0
 private void FindMismatch(TestDispensaryOne r)
 {
     if (this.dispansaryOne.CreationDate != r.dispansaryOne.CreationDate)
         Global.errors3.Add("Несовпадение CreationDate TestDispensaryOne");
     if (this.dispansaryOne.HasExpertCareRefferal != r.dispansaryOne.HasExpertCareRefferal)
         Global.errors3.Add("Несовпадение HasExpertCareRefferal TestDispensaryOne");
     if (this.dispansaryOne.HasExtraResearchRefferal != r.dispansaryOne.HasExtraResearchRefferal)
         Global.errors3.Add("Несовпадение HasExtraResearchRefferal TestDispensaryOne");
     if (this.dispansaryOne.HasHealthResortRefferal != r.dispansaryOne.HasHealthResortRefferal)
         Global.errors3.Add("Несовпадение HasHealthResortRefferal TestDispensaryOne");
     if (this.dispansaryOne.HasPrescribeCure != r.dispansaryOne.HasPrescribeCure)
         Global.errors3.Add("Несовпадение HasPrescribeCure TestDispensaryOne");
     if (this.dispansaryOne.HasSecondStageRefferal != r.dispansaryOne.HasSecondStageRefferal)
         Global.errors3.Add("Несовпадение HasSecondStageRefferal TestDispensaryOne");
     if (this.dispansaryOne.Header != r.dispansaryOne.Header)
         Global.errors3.Add("Несовпадение CreationDate TestDispensaryOne");
     if (this.dispansaryOne.IsGuested != r.dispansaryOne.IsGuested)
         Global.errors3.Add("Несовпадение IsGuested TestDispensaryOne");
     if (this.dispansaryOne.IsUnderObservation != r.dispansaryOne.IsUnderObservation)
         Global.errors3.Add("Несовпадение IsUnderObservation TestDispensaryOne");
     if (this.dispansaryOne.HealthGroup.HealthGroupInfo.Date != r.dispansaryOne.HealthGroup.HealthGroupInfo.Date)
         Global.errors3.Add("Несовпадение HealthGroupInfo.Date TestDispensaryOne");
     if (this.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup != r.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup)
         Global.errors3.Add("Несовпадение HealthGroupInfo.IdHealthGroup TestDispensaryOne");
     if (Global.GetLength(this.recommendation) != Global.GetLength (r.recommendation))
         Global.errors3.Add("Несовпадение длины recommendation TestDispensaryOne");
     if (Global.GetLength(this.doctor) != Global.GetLength(r.doctor))
         Global.errors3.Add("Несовпадение длины doctor TestDispensaryOne");
     if (Global.GetLength(this.hdDoctor) != Global.GetLength(r.hdDoctor))
         Global.errors3.Add("Несовпадение длины hdDoctor TestDispensaryOne");
     if (Global.GetLength(this.attachment) != Global.GetLength(r.attachment))
         Global.errors3.Add("Несовпадение длины attachment TestDispensaryOne");
 }
예제 #4
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;
        }
예제 #5
0
        public static TestMasterCase BuildTestMasterCase(string guid, string idlpu, string patientIdmis, string mis = "")
        {
            if ((guid != string.Empty) && (idlpu != string.Empty) && (patientIdmis != string.Empty))
            {
                string patientId = TestPerson.GetPersonId(guid, idlpu, patientIdmis);
                string caseId    = TestCaseBase.GetCaseId(guid, idlpu, mis, patientId);
                if (caseId != null)
                {
                    TestMasterCase mcase = new TestMasterCase();
                    mcase.caseBase = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idlpu, mis, patientId);
                    List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(caseId, idlpu);
                    if (st != null)
                    {
                        foreach (TestStepBase i in st)
                        {
                            if (Global.IsEqual(i.doctor, null))
                            {
                                mcase.defaultStep = i;
                            }
                        }
                        if (!Global.IsEqual(mcase.defaultStep, null))
                        {
                            mcase.records = new List <TestMedRecord>();
                            List <TestService> serv = TestService.BuildServiseFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(serv, null))
                            {
                                mcase.records.AddRange(serv);
                            }

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

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

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

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

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

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

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

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

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

                            TestDispensaryOne d1 = TestDispensaryOne.BuildSickListFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(d1, null))
                            {
                                mcase.records.Add(d1);
                            }

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

                            List <TestForm027U> form = TestForm027U.BuildForm027UFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(form, null))
                            {
                                mcase.records.AddRange(form);
                            }
                        }
                    }
                    return(mcase);
                }
            }
            return(null);
        }
예제 #6
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);
        }
예제 #7
0
 public void ChangeUpdateAmbCase(string guid, CaseAmb ca)
 {
     GUID = guid.ToLower();
     if (ca != null)
     {
         this.caseAmb.IsActive = ca.IsActive;
         if (ca.IdAmbResult != 0)
         {
             this.caseAmb.IdAmbResult = ca.IdAmbResult;
         }
         if (ca.IdCasePurpose != 0)
         {
             this.caseAmb.IdCasePurpose = ca.IdCasePurpose;
         }
         caseBase.UpdateCaseBase(guid, ca);
         if (ca.MedRecords != null)
         {
             List <TestMedRecord>    newMedRecords = new List <TestMedRecord>();
             TestTfomsInfo           tfi           = null;
             TestClinicMainDiagnosis cmd           = null;
             TestDischargeSummary    ds            = null;
             TestConsultNote         cn            = null;
             TestDispensaryOne       d1            = null;
             foreach (object i in ca.MedRecords)
             {
                 Service ser = i as Service;
                 if (ser != null)
                 {
                     newMedRecords.Add(new TestService(ser, ca.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, ca.IdLpu));
                 }
                 ClinicMainDiagnosis cm = i as ClinicMainDiagnosis;
                 if ((cm != null) && (cm.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     cmd = new TestClinicMainDiagnosis(cm, ca.IdLpu);
                 }
                 Referral r = i as Referral;
                 if (r != null)
                 {
                     newMedRecords.Add(new TestReferral(r, ca.IdLpu));
                 }
                 SickList sl = i as SickList;
                 if (sl != null)
                 {
                     newMedRecords.Add(new TestSickList(sl, ca.IdLpu));
                 }
                 DischargeSummary pds = i as DischargeSummary;
                 if (pds != null)
                 {
                     ds = new TestDischargeSummary(pds, ca.IdLpu);
                 }
                 LaboratoryReport lr = i as LaboratoryReport;
                 if (lr != null)
                 {
                     newMedRecords.Add(new TestLaboratoryReport(lr, ca.IdLpu));
                 }
                 ConsultNote pcn = i as ConsultNote;
                 if (pcn != null)
                 {
                     cn = new TestConsultNote(pcn, ca.IdLpu);
                 }
                 DispensaryOne d = i as DispensaryOne;
                 if (d != null)
                 {
                     d1 = new TestDispensaryOne(d, ca.IdLpu);
                 }
                 AppointedMedication ap = i as AppointedMedication;
                 if (ap != null)
                 {
                     newMedRecords.Add(new TestAppointedMedication(ap, ca.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);
                     }
                     TestDispensaryOne d = i as TestDispensaryOne;
                     if (!Global.IsEqual(d1, null))
                     {
                         newMedRecords.Add(d1);
                     }
                     else
                     if (!Global.IsEqual(d, null))
                     {
                         newMedRecords.Add(d);
                     }
                     TestAppointedMedication ap = i as TestAppointedMedication;
                     if (!Global.IsEqual(ap, null))
                     {
                         newMedRecords.Add(ap);
                     }
                 }
             }
             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);
                 }
             }
             this.records = newMedRecords;
         }
     }
 }
예제 #8
0
 static public TestAmbCase BuildAmbCaseFromDataBaseData(string guid, string idlpu, string mis, string patientId)
 {
     if ((guid != string.Empty) && (idlpu != string.Empty) && (mis != string.Empty) && (patientId != string.Empty))
     {
         string caseId = TestCaseBase.GetCaseId(guid, idlpu, mis, patientId);
         if (caseId != null)
         {
             CaseAmb ca = new CaseAmb();
             using (SqlConnection connection = Global.GetSqlConnection())
             {
                 string     findCase    = "SELECT TOP(1) * FROM AmbCase WHERE IdCase = '" + caseId + "'";
                 SqlCommand caseCommand = new SqlCommand(findCase, connection);
                 using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                 {
                     while (caseReader.Read())
                     {
                         if (caseReader["IdCasePurpose"].ToString() != "")
                         {
                             ca.IdCasePurpose = Convert.ToByte(caseReader["IdCasePurpose"]);
                         }
                         if (caseReader["IdAmbResult"].ToString() != "")
                         {
                             ca.IdAmbResult = Convert.ToByte(caseReader["IdAmbResult"]);
                         }
                         if (caseReader["IsActive"].ToString() != "")
                         {
                             ca.IsActive = Convert.ToBoolean(caseReader["IsActive"]);
                         }
                         TestAmbCase ambcase = new TestAmbCase(guid, ca);
                         ambcase.caseBase = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idlpu, mis, patientId);
                         ambcase.ambSteps = TestAmbStep.BuildAmbTestStepsFromDataBase(caseId, ca.IdLpu);
                         List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(caseId, ca.IdLpu);
                         if (st != null)
                         {
                             foreach (TestStepBase i in st)
                             {
                                 if (Global.IsEqual(i.step.IdStepMis, null))
                                 {
                                     ambcase.defaultStep = i;
                                 }
                             }
                             if (!Global.IsEqual(ambcase.defaultStep, null))
                             {
                                 ambcase.records = new List <TestMedRecord>();
                                 List <TestService> ser = TestService.BuildServiseFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(ser, null))
                                 {
                                     ambcase.records.AddRange(ser);
                                 }
                                 TestTfomsInfo forms = TestTfomsInfo.BuildTfomsInfoFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(forms, null))
                                 {
                                     ambcase.records.Add(forms);
                                 }
                                 TestDeathInfo tdi = TestDeathInfo.BuildDeathInfoFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tdi, null))
                                 {
                                     ambcase.records.Add(tdi);
                                 }
                                 List <TestDiagnosis> td = TestDiagnosis.BuildDiagnosisFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(td, null))
                                 {
                                     ambcase.records.AddRange(td);
                                 }
                                 TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(acdm, null))
                                 {
                                     ambcase.records.Add(acdm);
                                 }
                                 List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(trl, null))
                                 {
                                     ambcase.records.AddRange(trl);
                                 }
                                 List <TestSickList> tsl = TestSickList.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep, patientId);
                                 if (!Global.IsEqual(tsl, null))
                                 {
                                     ambcase.records.AddRange(tsl);
                                 }
                                 TestDischargeSummary tds = TestDischargeSummary.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tds, null))
                                 {
                                     ambcase.records.Add(tds);
                                 }
                                 List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tlr, null))
                                 {
                                     ambcase.records.AddRange(tlr);
                                 }
                                 TestConsultNote tcn = TestConsultNote.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tcn, null))
                                 {
                                     ambcase.records.Add(tcn);
                                 }
                                 TestDispensaryOne d1 = TestDispensaryOne.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(d1, null))
                                 {
                                     ambcase.records.Add(d1);
                                 }
                                 List <TestAppointedMedication> ap = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(ap, null))
                                 {
                                     ambcase.records.AddRange(ap);
                                 }
                                 if (ambcase.records.Count == 0)
                                 {
                                     ambcase.records = null;
                                 }
                             }
                         }
                         return(ambcase);
                     }
                 }
             }
         }
     }
     return(null);
 }
예제 #9
0
파일: TestAmbCase.cs 프로젝트: nbIxMaN/EMKT
 public void ChangeUpdateAmbCase(string guid, CaseAmb ca)
 {
     GUID = guid.ToLower();
     if (ca != null)
     {
         this.caseAmb.IsActive = ca.IsActive;
         if (ca.IdAmbResult != 0)
             this.caseAmb.IdAmbResult = ca.IdAmbResult;
         if (ca.IdCasePurpose != 0)
             this.caseAmb.IdCasePurpose = ca.IdCasePurpose;
         caseBase.UpdateCaseBase(guid, ca);
         if (ca.MedRecords != null)
         {
             List<TestMedRecord> newMedRecords = new List<TestMedRecord>();
             TestTfomsInfo tfi = null;
             TestClinicMainDiagnosis cmd = null;
             TestDischargeSummary ds = null;
             TestConsultNote cn = null;
             TestDispensaryOne d1 = null;
             foreach (object i in ca.MedRecords)
             {
                 Service ser = i as Service;
                 if (ser != null)
                     newMedRecords.Add(new TestService(ser, ca.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, ca.IdLpu));
                 ClinicMainDiagnosis cm = i as ClinicMainDiagnosis;
                 if ((cm != null) && (cm.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                     cmd = new TestClinicMainDiagnosis(cm, ca.IdLpu);
                 Referral r = i as Referral;
                 if (r != null)
                     newMedRecords.Add(new TestReferral(r, ca.IdLpu));
                 SickList sl = i as SickList;
                 if (sl != null)
                     newMedRecords.Add(new TestSickList(sl, ca.IdLpu));
                 DischargeSummary pds = i as DischargeSummary;
                 if (pds != null)
                     ds = new TestDischargeSummary(pds, ca.IdLpu);
                 LaboratoryReport lr = i as LaboratoryReport;
                 if (lr != null)
                     newMedRecords.Add(new TestLaboratoryReport(lr, ca.IdLpu));
                 ConsultNote pcn = i as ConsultNote;
                 if (pcn != null)
                     cn = new TestConsultNote(pcn, ca.IdLpu);
                 DispensaryOne d = i as DispensaryOne;
                 if (d != null)
                     d1 = new TestDispensaryOne(d, ca.IdLpu);
                 AppointedMedication ap = i as AppointedMedication;
                 if (ap != null)
                     newMedRecords.Add(new TestAppointedMedication(ap, ca.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);
                     TestDispensaryOne d = i as TestDispensaryOne;
                     if (!Global.IsEqual(d1, null))
                         newMedRecords.Add(d1);
                     else
                         if (!Global.IsEqual(d, null))
                             newMedRecords.Add(d);
                     TestAppointedMedication ap = i as TestAppointedMedication;
                     if (!Global.IsEqual(ap, null))
                         newMedRecords.Add(ap);
                 }
             }
             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);
             }
             this.records = newMedRecords;
         }
     }
 }
예제 #10
0
 static public TestDispensaryOne BuildSickListFromDataBaseData(string idStep)
 {
     if (idStep != "")
     {
         List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idDispensaryOne);
         if (lta != null)
         {
             foreach (TestAttachment i in lta)
             {
                 using (SqlConnection connection = Global.GetSqlConnection())
                 {
                     string     findDO    = "SELECT TOP(1) * FROM DispensaryStage1, DispensaryStage1HealthGroup WHERE DispensaryStage1.idDispensaryStage1 = (SELECT MAX(idDispensaryStage1) FROM DispensaryStage1 WHERE IdMedDocument = '" + i.idMedDocument + "') AND DispensaryStage1.idDispensaryStage1 = DispensaryStage1HealthGroup.idDispensaryStage1";
                     SqlCommand DOcommand = new SqlCommand(findDO, connection);
                     using (SqlDataReader DOReader = DOcommand.ExecuteReader())
                     {
                         while (DOReader.Read())
                         {
                             DispensaryOne r = new DispensaryOne();
                             r.HealthGroup = new HealthGroup();
                             r.HealthGroup.HealthGroupInfo = new HealthGroupInfo();
                             if (DOReader["IsGuested"].ToString() != "")
                             {
                                 r.IsGuested = Convert.ToBoolean(DOReader["IsGuested"]);
                             }
                             if (DOReader["HasExtraResearchRefferal"].ToString() != "")
                             {
                                 r.HasExtraResearchRefferal = Convert.ToBoolean(DOReader["HasExtraResearchRefferal"]);
                             }
                             if (DOReader["IsUnderObservation"].ToString() != "")
                             {
                                 r.IsUnderObservation = Convert.ToBoolean(DOReader["IsUnderObservation"]);
                             }
                             if (DOReader["HasExpertCareRefferal"].ToString() != "")
                             {
                                 r.HasExpertCareRefferal = Convert.ToBoolean(DOReader["HasExpertCareRefferal"]);
                             }
                             if (DOReader["HasPrescribeCure"].ToString() != "")
                             {
                                 r.HasPrescribeCure = Convert.ToBoolean(DOReader["HasPrescribeCure"]);
                             }
                             if (DOReader["HasHealthResortRefferal"].ToString() != "")
                             {
                                 r.HasHealthResortRefferal = Convert.ToBoolean(DOReader["HasHealthResortRefferal"]);
                             }
                             if (DOReader["HasSecondStageRefferal"].ToString() != "")
                             {
                                 r.HasSecondStageRefferal = Convert.ToBoolean(DOReader["HasSecondStageRefferal"]);
                             }
                             if (DOReader["IdHealthGroup"].ToString() != "")
                             {
                                 r.HealthGroup.HealthGroupInfo.IdHealthGroup = Convert.ToByte(DOReader["IdHealthGroup"]);
                             }
                             if (DOReader["Date"].ToString() != "")
                             {
                                 r.HealthGroup.HealthGroupInfo.Date = Convert.ToDateTime(DOReader["Date"]);
                             }
                             r.Header       = i.DocHead;
                             r.CreationDate = i.CreationDate;
                             TestDispensaryOne tdo = new TestDispensaryOne(r);
                             if (DOReader["IdDoctor"].ToString() != "")
                             {
                                 tdo.hdDoctor = TestDoctor.BuildTestDoctorFromDataBase((DOReader["IdDoctor"]).ToString());
                             }
                             if (DOReader["idDispensaryStage1"].ToString() != "")
                             {
                                 tdo.recom = TestRecommendation.BuildSickListFromDataBaseData(DOReader["idDispensaryStage1"].ToString());
                             }
                             tdo.doctor     = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor);
                             tdo.attachment = i;
                             return(tdo);
                         }
                     }
                 }
             }
         }
     }
     return(null);
 }
예제 #11
0
 private void FindMismatch(TestDispensaryOne r)
 {
     if (this.dispansaryOne.CreationDate != r.dispansaryOne.CreationDate)
     {
         Global.errors3.Add("Несовпадение CreationDate TestDispensaryOne");
     }
     if (this.dispansaryOne.HasExpertCareRefferal != r.dispansaryOne.HasExpertCareRefferal)
     {
         Global.errors3.Add("Несовпадение HasExpertCareRefferal TestDispensaryOne");
     }
     if (this.dispansaryOne.HasExtraResearchRefferal != r.dispansaryOne.HasExtraResearchRefferal)
     {
         Global.errors3.Add("Несовпадение HasExtraResearchRefferal TestDispensaryOne");
     }
     if (this.dispansaryOne.HasHealthResortRefferal != r.dispansaryOne.HasHealthResortRefferal)
     {
         Global.errors3.Add("Несовпадение HasHealthResortRefferal TestDispensaryOne");
     }
     if (this.dispansaryOne.HasPrescribeCure != r.dispansaryOne.HasPrescribeCure)
     {
         Global.errors3.Add("Несовпадение HasPrescribeCure TestDispensaryOne");
     }
     if (this.dispansaryOne.HasSecondStageRefferal != r.dispansaryOne.HasSecondStageRefferal)
     {
         Global.errors3.Add("Несовпадение HasSecondStageRefferal TestDispensaryOne");
     }
     if (this.dispansaryOne.Header != r.dispansaryOne.Header)
     {
         Global.errors3.Add("Несовпадение CreationDate TestDispensaryOne");
     }
     if (this.dispansaryOne.IsGuested != r.dispansaryOne.IsGuested)
     {
         Global.errors3.Add("Несовпадение IsGuested TestDispensaryOne");
     }
     if (this.dispansaryOne.IsUnderObservation != r.dispansaryOne.IsUnderObservation)
     {
         Global.errors3.Add("Несовпадение IsUnderObservation TestDispensaryOne");
     }
     if (this.dispansaryOne.HealthGroup.HealthGroupInfo.Date != r.dispansaryOne.HealthGroup.HealthGroupInfo.Date)
     {
         Global.errors3.Add("Несовпадение HealthGroupInfo.Date TestDispensaryOne");
     }
     if (this.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup != r.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup)
     {
         Global.errors3.Add("Несовпадение HealthGroupInfo.IdHealthGroup TestDispensaryOne");
     }
     if (Global.GetLength(this.recommendation) != Global.GetLength(r.recommendation))
     {
         Global.errors3.Add("Несовпадение длины recommendation TestDispensaryOne");
     }
     if (Global.GetLength(this.doctor) != Global.GetLength(r.doctor))
     {
         Global.errors3.Add("Несовпадение длины doctor TestDispensaryOne");
     }
     if (Global.GetLength(this.hdDoctor) != Global.GetLength(r.hdDoctor))
     {
         Global.errors3.Add("Несовпадение длины hdDoctor TestDispensaryOne");
     }
     if (Global.GetLength(this.attachment) != Global.GetLength(r.attachment))
     {
         Global.errors3.Add("Несовпадение длины attachment TestDispensaryOne");
     }
 }