Example #1
0
 public TestConsultNote(ConsultNote r, string idLpu = "")
 {
     if (r != null)
     {
         consultNote = r;
         attachment = new TestAttachment(r.Attachment);
         doctor = new TestDoctor(r.Author, idLpu);
     }
 }
Example #2
0
 public TestConsultNote(ConsultNote r, string idLpu = "")
 {
     if (r != null)
     {
         consultNote = r;
         attachment  = new TestAttachment(r.Attachment);
         doctor      = new TestDoctor(r.Author, idLpu);
     }
 }
Example #3
0
        public ConsultNote MinConsultNote()
        {
            ConsultNote consultNote = new ConsultNote
            {
                CreationDate = MedRecordData.consultNote.CreationDate,
                Header       = MedRecordData.consultNote.Header,
                Author       = MinDoctorSet(),
            };

            return(consultNote);
        }
Example #4
0
 public static TestConsultNote BuildSickListFromDataBaseData(string idStep)
 {
     if (idStep != "")
     {
         List<TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idConsultNote);
         if (lta != null)
             foreach (TestAttachment i in lta)
             {
                 ConsultNote r = new ConsultNote();
                 r.CreationDate = i.CreationDate;
                 r.Header = i.DocHead;
                 TestConsultNote tr = new TestConsultNote(r);
                 tr.attachment = i;
                 tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor);
                 return tr;
             }
     }
     return null;
 }
Example #5
0
 static public TestConsultNote BuildSickListFromDataBaseData(string idStep)
 {
     if (idStep != "")
     {
         List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idConsultNote);
         if (lta != null)
         {
             foreach (TestAttachment i in lta)
             {
                 ConsultNote r = new ConsultNote();
                 r.CreationDate = i.CreationDate;
                 r.Header       = i.DocHead;
                 TestConsultNote tr = new TestConsultNote(r);
                 tr.attachment = i;
                 tr.doctor     = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor);
                 return(tr);
             }
         }
     }
     return(null);
 }
Example #6
0
 public ConsultNote MinConsultNote()
 {
     ConsultNote consultNote = new ConsultNote
     {
         CreationDate = MedRecordData.consultNote.CreationDate,
         Header = MedRecordData.consultNote.Header,
         Author = MinDoctorSet(),
     };
     return consultNote;
 }
Example #7
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);
        }
Example #8
0
 public TestAmbCase(string guid, CaseAmb ca)
 {
     GUID = guid.ToLower();
     if (ca != null)
     {
         caseAmb  = ca;
         caseBase = new TestCaseBase(guid, ca);
         if (ca.Steps != null)
         {
             ambSteps = new List <TestAmbStep>();
             foreach (StepAmb i in ca.Steps)
             {
                 ambSteps.Add(new TestAmbStep(i, ca.IdLpu));
             }
         }
         if (ca.MedRecords != null)
         {
             records = new List <TestMedRecord>();
             foreach (object i in ca.MedRecords)
             {
                 Service ser = i as Service;
                 if (ser != null)
                 {
                     records.Add(new TestService(ser, ca.IdLpu));
                 }
                 TfomsInfo tfi = i as TfomsInfo;
                 if (tfi != null)
                 {
                     records.Add(new TestTfomsInfo(tfi));
                 }
                 ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;
                 if ((cmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     records.Add(new TestClinicMainDiagnosis(cmd, ca.IdLpu));
                 }
                 if (cmd == null)
                 {
                     Diagnosis diag = i as Diagnosis;
                     if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                     {
                         records.Add(new TestClinicMainDiagnosis(diag, ca.IdLpu));
                     }
                     if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                     {
                         records.Add(new TestDiagnosis(diag, ca.IdLpu));
                     }
                 }
                 Referral r = i as Referral;
                 if (r != null)
                 {
                     records.Add(new TestReferral(r, ca.IdLpu));
                 }
                 SickList sl = i as SickList;
                 if (sl != null)
                 {
                     records.Add(new TestSickList(sl, ca.IdLpu));
                 }
                 DischargeSummary ds = i as DischargeSummary;
                 if (ds != null)
                 {
                     records.Add(new TestDischargeSummary(ds, ca.IdLpu));
                 }
                 LaboratoryReport lr = i as LaboratoryReport;
                 if (lr != null)
                 {
                     records.Add(new TestLaboratoryReport(lr, ca.IdLpu));
                 }
                 ConsultNote cn = i as ConsultNote;
                 if (cn != null)
                 {
                     records.Add(new TestConsultNote(cn, ca.IdLpu));
                 }
                 DispensaryOne d1 = i as DispensaryOne;
                 if ((d1 != null) && (ca.IdCaseType == TestAmbCase.dispanseryId))
                 {
                     records.Add(new TestDispensaryOne(d1, ca.IdLpu));
                 }
                 AppointedMedication ap = i as AppointedMedication;
                 if (ap != null)
                 {
                     records.Add(new TestAppointedMedication(ap, ca.IdLpu));
                 }
             }
         }
         if ((ca.IdLpu != null) && (ca.IdPatientMis != null))
         {
             List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(TestCaseBase.GetCaseId(guid, ca.IdLpu, ca.IdCaseMis, TestPerson.GetPersonId(guid, ca.IdLpu, ca.IdPatientMis)), ca.IdLpu);
             if (st != null)
             {
                 foreach (TestStepBase i in st)
                 {
                     if (Global.IsEqual(i.doctor, null))
                     {
                         defaultStep = i;
                     }
                 }
             }
         }
     }
 }
Example #9
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;
         }
     }
 }
Example #10
0
 private List <EMKServise.MedRecord> ConvertMedRecords(MedRecord[] c)
 {
     if (((object)c != null) && (c.Length != 0))
     {
         List <EMKServise.MedRecord> lmr = new List <EMKServise.MedRecord>();
         foreach (object i in c)
         {
             Service ser = i as Service;
             if (ser != null)
             {
                 EMKServise.Service eser = new EMKServise.Service();
                 if (ser.DateEnd != DateTime.MinValue)
                 {
                     eser.DateEnd = ser.DateEnd;
                 }
                 if (ser.DateStart != DateTime.MinValue)
                 {
                     eser.DateStart = ser.DateStart;
                 }
                 if (ser.IdServiceType != "")
                 {
                     eser.IdServiceType = ser.IdServiceType;
                 }
                 eser.PaymentInfo = ConvertPaymentInfo(ser.PaymentInfo);
                 eser.Performer   = ConvertParticipant(ser.Performer);
                 if (ser.ServiceName != "")
                 {
                     eser.ServiceName = ser.ServiceName;
                 }
                 lmr.Add(eser);
             }
             TfomsInfo tfi = i as TfomsInfo;
             if (tfi != null)
             {
                 EMKServise.TfomsInfo etfi = new EMKServise.TfomsInfo();
                 etfi.Count       = tfi.Count;
                 etfi.IdTfomsType = tfi.IdTfomsType;
                 etfi.Tariff      = tfi.Tariff;
                 lmr.Add(etfi);
             }
             AppointedMedication ap = i as AppointedMedication;
             if (ap != null)
             {
                 EMKServise.AppointedMedication eap = new EMKServise.AppointedMedication();
                 if (ap.AnatomicTherapeuticChemicalClassification != "")
                 {
                     eap.AnatomicTherapeuticChemicalClassification = ap.AnatomicTherapeuticChemicalClassification;
                 }
                 eap.CourseDose = ConvertQuantity(ap.CourseDose);
                 eap.DayDose    = ConvertQuantity(ap.DayDose);
                 eap.DaysCount  = ap.DaysCount;
                 eap.Doctor     = ConvertMedicalStaff(ap.Doctor);
                 if (ap.IssuedDate != DateTime.MinValue)
                 {
                     eap.IssuedDate = ap.IssuedDate;
                 }
                 if (ap.MedicineIssueType != "")
                 {
                     eap.MedicineIssueType = ap.MedicineIssueType;
                 }
                 if (ap.MedicineName != "")
                 {
                     eap.MedicineName = ap.MedicineName;
                 }
                 eap.MedicineType   = ap.MedicineType;
                 eap.MedicineUseWay = ap.MedicineUseWay;
                 if (ap.Number != "")
                 {
                     eap.Number = ap.Number;
                 }
                 eap.OneTimeDose = ConvertQuantity(ap.OneTimeDose);
                 if (ap.Seria != "")
                 {
                     eap.Seria = ap.Seria;
                 }
                 lmr.Add(eap);
             }
             DeathInfo di = i as DeathInfo;
             if (di != null)
             {
                 EMKServise.DeathInfo edi = new EMKServise.DeathInfo();
                 if (di.MkbCode != "")
                 {
                     edi.MkbCode = di.MkbCode;
                 }
                 lmr.Add(edi);
             }
             ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;
             if ((cmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
             {
                 EMKServise.ClinicMainDiagnosis ecmd = new EMKServise.ClinicMainDiagnosis();
                 ecmd.Complications = ConvertDiagnosis(cmd.Complications);
                 ecmd.DiagnosisInfo = ConvertDiagnosisInfo(cmd.DiagnosisInfo);
                 ecmd.Doctor        = ConvertMedicalStaff(cmd.Doctor);
                 lmr.Add(ecmd);
             }
             if (cmd == null)
             {
                 Diagnosis diag = i as Diagnosis;
                 if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     EMKServise.ClinicMainDiagnosis ecmd = new EMKServise.ClinicMainDiagnosis();
                     ecmd.DiagnosisInfo = ConvertDiagnosisInfo(diag.DiagnosisInfo);
                     ecmd.Doctor        = ConvertMedicalStaff(diag.Doctor);
                     lmr.Add(ecmd);
                 }
                 if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     EMKServise.Diagnosis ecmd = new EMKServise.Diagnosis();
                     ecmd.DiagnosisInfo = ConvertDiagnosisInfo(diag.DiagnosisInfo);
                     ecmd.Doctor        = ConvertMedicalStaff(diag.Doctor);
                     lmr.Add(ecmd);
                 }
             }
             Referral r = i as Referral;
             if (r != null)
             {
                 EMKServise.Referral er = new EMKServise.Referral();
                 er.Attachment = ConvertAttachment(r.Attachment);
                 er.Author     = ConvertMedicalStaff(r.Author);
                 if (r.CreationDate != DateTime.MinValue)
                 {
                     er.CreationDate = r.CreationDate;
                 }
                 er.DepartmentHead = ConvertMedicalStaff(r.DepartmentHead);
                 if (r.Header != "")
                 {
                     er.Header = r.Header;
                 }
                 if (r.IdSourceLpu != "")
                 {
                     er.IdSourceLpu = r.IdSourceLpu;
                 }
                 if (r.IdTargetLpu != "")
                 {
                     er.IdTargetLpu = r.IdTargetLpu;
                 }
                 if (r.ReferralID != "")
                 {
                     er.ReferralID = r.ReferralID;
                 }
                 er.ReferralInfo = ConvertReferralInfo(r.ReferralInfo);
                 if (r.RelatedID != "")
                 {
                     er.RelatedID = r.RelatedID;
                 }
                 lmr.Add(er);
             }
             SickList sl = i as SickList;
             if (sl != null)
             {
                 EMKServise.SickList esl = new EMKServise.SickList();
                 esl.Attachment = ConvertAttachment(sl.Attachment);
                 esl.Author     = ConvertMedicalStaff(sl.Author);
                 if (sl.CreationDate != DateTime.MinValue)
                 {
                     esl.CreationDate = sl.CreationDate;
                 }
                 if (sl.Header != "")
                 {
                     esl.Header = sl.Header;
                 }
                 esl.SickListInfo = ConvertSickListInfo(sl.SickListInfo);
                 lmr.Add(esl);
             }
             DischargeSummary ds = i as DischargeSummary;
             if (ds != null)
             {
                 EMKServise.DischargeSummary eds = new EMKServise.DischargeSummary();
                 eds.Attachment = ConvertAttachment(ds.Attachment);
                 eds.Author     = ConvertMedicalStaff(ds.Author);
                 if (ds.CreationDate != DateTime.MinValue)
                 {
                     eds.CreationDate = ds.CreationDate;
                 }
                 if (ds.Header != "")
                 {
                     eds.Header = ds.Header;
                 }
                 lmr.Add(eds);
             }
             LaboratoryReport lr = i as LaboratoryReport;
             if (lr != null)
             {
                 EMKServise.LaboratoryReport elr = new EMKServise.LaboratoryReport();
                 elr.Attachment = ConvertAttachment(lr.Attachment);
                 elr.Author     = ConvertMedicalStaff(lr.Author);
                 if (lr.CreationDate != DateTime.MinValue)
                 {
                     elr.CreationDate = lr.CreationDate;
                 }
                 if (lr.Header != "")
                 {
                     elr.Header = lr.Header;
                 }
                 lmr.Add(elr);
             }
             ConsultNote cn = i as ConsultNote;
             if (cn != null)
             {
                 EMKServise.ConsultNote ecn = new EMKServise.ConsultNote();
                 ecn.Attachment = ConvertAttachment(cn.Attachment);
                 ecn.Author     = ConvertMedicalStaff(cn.Author);
                 if (cn.CreationDate != DateTime.MinValue)
                 {
                     ecn.CreationDate = cn.CreationDate;
                 }
                 if (cn.Header != "")
                 {
                     ecn.Header = cn.Header;
                 }
                 lmr.Add(ecn);
             }
             DispensaryOne d1 = i as DispensaryOne;
             if (d1 != null)
             {
                 EMKServise.DispensaryOne ed1 = new EMKServise.DispensaryOne();
                 ed1.Attachment = ConvertAttachment(d1.Attachment);
                 ed1.Author     = ConvertMedicalStaff(d1.Author);
                 if (d1.CreationDate != DateTime.MinValue)
                 {
                     ed1.CreationDate = d1.CreationDate;
                 }
                 if (d1.Header != "")
                 {
                     ed1.Header = d1.Header;
                 }
                 ed1.HasExpertCareRefferal    = d1.HasExpertCareRefferal;
                 ed1.HasExtraResearchRefferal = d1.HasExtraResearchRefferal;
                 ed1.HasHealthResortRefferal  = d1.HasHealthResortRefferal;
                 ed1.HasPrescribeCure         = d1.HasPrescribeCure;
                 ed1.HasSecondStageRefferal   = d1.HasSecondStageRefferal;
                 ed1.HealthGroup        = ConvertHealthGroup(d1.HealthGroup);
                 ed1.IsGuested          = d1.IsGuested;
                 ed1.IsUnderObservation = d1.IsUnderObservation;
                 ed1.Recommendations    = ConvertRecommendation(d1.Recommendations);
                 lmr.Add(ed1);
             }
         }
         return(lmr);
     }
     else
     {
         return(null);
     }
 }
Example #11
0
        public TestStatCase(string guid, CaseStat cs)
        {
            GUID = guid.ToLower();
            if (cs != null)
            {
                caseStat = cs;
                caseBase = new TestCaseBase(guid, cs);
                if (cs.Steps != null)
                {
                    statSteps = new List <TestStatStep>();
                    foreach (StepStat i in cs.Steps)
                    {
                        statSteps.Add(new TestStatStep(i, cs.IdLpu));
                    }
                }
                if (cs.MedRecords != null)
                {
                    records = new List <TestMedRecord>();
                    foreach (object i in cs.MedRecords)
                    {
                        Service ser = i as Service;
                        if (ser != null)
                        {
                            records.Add(new TestService(ser, cs.IdLpu));
                        }

                        TfomsInfo tfi = i as TfomsInfo;
                        if (tfi != null)
                        {
                            records.Add(new TestTfomsInfo(tfi));
                        }

                        DeathInfo di = i as DeathInfo;
                        if (di != null)
                        {
                            records.Add(new TestDeathInfo(di));
                        }

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

                        AnatomopathologicalClinicMainDiagnosis acmd = i as AnatomopathologicalClinicMainDiagnosis;
                        if ((acmd != null) && (cs.HospResult == IdDeath) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                        {
                            records.Add(new TestClinicMainDiagnosis(acmd, cs.IdLpu));
                        }
                        if ((cmd == null) && (acmd == null))
                        {
                            Diagnosis diag = i as Diagnosis;
                            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                            {
                                records.Add(new TestDiagnosis(diag, cs.IdLpu));
                            }
                            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                            {
                                records.Add(new TestClinicMainDiagnosis(diag, cs.IdLpu));
                            }
                        }

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

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

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

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

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

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

                        Form027U form = i as Form027U;
                        if (form != null)
                        {
                            records.Add(new TestForm027U(form, cs.IdLpu));
                        }
                    }
                }
                if ((cs.IdLpu != null) && (cs.IdPatientMis != null))
                {
                    List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(TestCaseBase.GetCaseId(guid, cs.IdLpu, cs.IdCaseMis, TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis)), cs.IdLpu);
                    if (st != null)
                    {
                        foreach (TestStepBase i in st)
                        {
                            if (Global.IsEqual(i.doctor, null))
                            {
                                defaultStep = i;
                            }
                        }
                    }
                }
            }
        }
Example #12
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;
                }
            }
        }