Ejemplo n.º 1
0
 public ActionResult AddDiagnose(DoctorPatientDiagnose model)
 {
     if (ModelState.IsValid)
     {
         Diagnose diagnose = new Diagnose();
         diagnose.Date        = model.Date;
         diagnose.Description = model.Description;
         var patient = db.Patients.Where(z => z.Id.Equals(model.PatientId)).FirstOrDefault();
         var doctor  = db.Doctors.Where(z => z.Id.Equals(model.DoctorId)).FirstOrDefault();
         diagnose.Patient = patient;
         diagnose.Doctor  = doctor;
         db.Diagnoses.Add(diagnose);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
        private static Diagnose[] GenerateDiagnoses(Patient patient)
        {
            var diagnoseNames = new string[]
            {
                "Limp Scurvy",
                "Fading Infection",
                "Cow Feet",
                "Incurable Ebola",
                "Snake Blight",
                "Spider Asthma",
                "Sinister Body",
                "Spine Diptheria",
                "Pygmy Decay",
                "King's Arthritis",
                "Desert Rash",
                "Deteriorating Salmonella",
                "Shadow Anthrax",
                "Hiccup Meningitis",
                "Fading Depression",
                "Lion Infertility",
                "Wolf Delirium",
                "Humming Measles",
                "Incurable Stomach",
                "Grave Heart",
            };
            //var diagnoseNames = File.ReadAllLines("<INSERT DIR HERE>");

            int diagnoseCount = rnd.Next(1, 4);
            var diagnoses     = new Diagnose[diagnoseCount];

            for (int i = 0; i < diagnoseCount; i++)
            {
                string diagnoseName = diagnoseNames[rnd.Next(diagnoseNames.Length)];

                var diagnose = new Diagnose()
                {
                    Name    = diagnoseName,
                    Patient = patient
                };

                diagnoses[i] = diagnose;
            }

            return(diagnoses);
        }
        public async Task <IActionResult> EditDiagnose(Diagnose diagnose)
        {
            if (!ModelState.IsValid)
            {
                return(View(diagnose));
            }
            var diagnoseModel = await _diagnoseService.Get(diagnose.UserId);

            if (diagnoseModel == null)
            {
                _diagnoseService.Add(diagnose);
            }
            else
            {
                await _diagnoseService.Update(diagnose);
            }
            return(Content(""));
        }
        public MainWindow()
        {
            const int numberOfStrings = 100;

            InitializeComponent();

            List <String> eventsList = EventOptions.getEvents();

            UIEventPicker.SetBinding(ComboBox.ItemsSourceProperty, new Binding()
            {
                Source = eventsList
            });

            UIGenerate.Click += (o, a) =>
            {
                var      comboBoxValue  = UIEventPicker.SelectedItem;
                String[] stringsToPrint = new String[numberOfStrings];
                Diagnose diagnose       = new Diagnose();
                Register register       = new Register();

                if (comboBoxValue != null)
                {
                    switch (comboBoxValue.ToString())
                    {
                    case "Register":
                        stringsToPrint = register.StringsToPrint(100);
                        break;

                    case "Diagnose":
                        stringsToPrint = diagnose.StringsToPrint(100);
                        break;

                    default:
                        break;
                    }
                    AllStrings.ItemsSource = stringsToPrint;
                }
            };

            UIClear.Click += (o, a) =>
            {
                AllStrings.ItemsSource = null;
            };
        }
Ejemplo n.º 5
0
        public IActionResult Index()
        {
            List <Patient> patients = _patientsService.SelectForDoctorUIDAsync(_userManager.GetUserId(HttpContext.User)).Result;

            List <DoctorDashboardPatientModel> patientsOutput = new List <DoctorDashboardPatientModel>();

            patients.ForEach(patient =>
            {
                long diagnoseId    = -1;
                long treatmentId   = -1;
                long healthCheckId = -1;
                if (patient.ActiveDiagnoseId > 0)
                {
                    Diagnose diagnose = _diagnoseService.GetByIdAsync(patient.ActiveDiagnoseId).Result;
                    diagnoseId        = diagnose.Id;
                    if (diagnose.Treatment != null)
                    {
                        treatmentId = diagnose.Treatment.Id;
                    }

                    HealthCheck healthCheck = _healthCheckService.getLastForDiagnoseAsync(diagnose.Id).Result;

                    if (healthCheck != null)
                    {
                        healthCheckId = healthCheck.Id;
                    }
                }

                ApplicationUser patientPrincipal = _userManager.FindByIdAsync(patient.UserId).Result;
                patientsOutput.Add(new DoctorDashboardPatientModel()
                {
                    Id                = patient.UserId,
                    PhoneNumber       = patient.PhoneNumber,
                    DiagnoseId        = diagnoseId,
                    TreatmentId       = treatmentId,
                    LastHealthCheckId = healthCheckId,
                    Name              = patientPrincipal.FirstName + " " + patientPrincipal.LastName
                });
            });


            return(View("/Views/Dashboard/Doctor/DoctorDashboardHome.cshtml", patientsOutput));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> CreateAsync(string patientId, PrimaryTumorState primaryTumor, DistantMetastasisState distantMetastasis, RegionalLymphNodesState regionalLymphNodes)
        {
            Patient patient = await _patientService.GetByIdAsync(patientId);

            Doctor doctor = await _doctorService.GetByUserIdAsync(_userManager.GetUserId(HttpContext.User));

            if (patient.ActiveDiagnoseId != 0)
            {
                var oldDiagnose = await _diagnoseService.GetByIdAsync(patient.ActiveDiagnoseId);

                if (oldDiagnose != null && oldDiagnose.Treatment != null)
                {
                    oldDiagnose.Treatment.End = DateTime.Now;
                    await _diagnoseService.UpdateAsync();
                }
            }

            Diagnose diagnose = new Diagnose()
            {
                Patient            = patient,
                Doctor             = doctor,
                DistantMetastasis  = distantMetastasis,
                PrimaryTumor       = primaryTumor,
                RegionalLymphNodes = regionalLymphNodes,
                Stage = _diagnoseService.DetermineStage(distantMetastasis, primaryTumor, regionalLymphNodes)
            };

            HealthCheck healthCheck = new HealthCheck()
            {
                Diagnose  = diagnose,
                Timestamp = DateTime.Now
            };

            var healthCheckId = await _healthCheckService.CreateAsync(healthCheck);

            healthCheck = await _healthCheckService.GetByIdAsync(healthCheckId);

            patient.ActiveDiagnoseId = healthCheck.Diagnose.Id;

            await _patientService.UpdateAsync();

            return(RedirectToAction("", "DoctorDashboard"));
        }
Ejemplo n.º 7
0
        public ActionResult Add(Diagnose diagnose, Diagnoserecord history, int ID)
        {
            if (Session["user"] != null)
            {
                var user   = Session["user"].ToString();
                var doctor = _db.Doctors.Where(x => x.Username == user).FirstOrDefault();

                int    DocId   = doctor.Vetid;
                string Docname = doctor.Fullname;


                diagnose.DocName   = Docname;
                diagnose.Vetid     = DocId;
                diagnose.Datetoday = DateTime.Now;

                TempData["diagnosemsg"] = "text";
                TempData["msg"]         = "hey";

                _db.Diagnoses.Add(diagnose);
                _db.SaveChanges();

                //Diagnose History//
                history.DocName   = Docname;
                history.Vetid     = DocId;
                history.Datetoday = DateTime.Now;

                _db.Diagnoserecords.Add(history);
                _db.SaveChanges();


                var patient = _db.Patients.Find(ID);

                if (patient != null)
                {
                    _db.Patients.Remove(patient);
                    _db.SaveChanges();
                }

                return(RedirectToAction("index", "Diagnose"));
            }
            return(RedirectToAction("Logoff", "Account"));
        }
        public async Task <IActionResult> Create(Diagnose model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var diagnose = await _lovePlatformApi.GetDiagnose(model.UserId);

            var response = diagnose == null ? await _lovePlatformApi.AddDiagnose(model) : await _lovePlatformApi.UpdateDiagnose(model);

            if (!response.IsSuccess)
            {
                ModelState.AddModelError("", response.Message);
                return(View(model));
            }

            var user = await _lovePlatformApi.GetUser(model.UserId);

            return(RedirectToAction("Index", "User", new { openId = user.WexinOpenId }));
        }
Ejemplo n.º 9
0
        public async Task AddDiagnose(string pacientId, Doctor doc,
                                      Diagnose diagnose, DiagnoseHistory history)
        {
            var card = await GetCardByIdAsync(pacientId);

            diagnose.Card = card;

            if (doc != null)
            {
                diagnose.DoctorEstablishe = doc;
                history.Doctor            = doc;
            }
            diagnose.Status = false;
            await _dbContext.Diagnoses.AddAsync(diagnose);

            history.Diagnose = diagnose;
            await _dbContext.DiagnoseHistories.AddAsync(history);

            diagnose.DiagnoseHistorie.Append(history);
            await _dbContext.SaveChangesAsync();
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            var ctx = new HospitalContext();

            using (ctx)
            {
                ctx.Database.Initialize(true);

                Patient patient = new Patient()
                {
                    FirstName    = "Petar",
                    LastName     = "Petrov",
                    Address      = "Sofia",
                    BirthDate    = new DateTime(1989, 10, 9),
                    Email        = "*****@*****.**",
                    HasInsurance = true
                };
                Medicament medicament = new Medicament()
                {
                    Name = "Busculisin"
                };

                Visitation visit = new Visitation()
                {
                    Date    = new DateTime(2017, 02, 14),
                    Comment = "Today is better than yesterday!"
                };
                Diagnose diagn = new Diagnose()
                {
                    Name    = "Laringitis acuta!",
                    Comment = "Dr.Oh Boli"
                };

                ctx.Patients.Add(patient);
                patient.Medicaments.Add(medicament);
                patient.Diagnoses.Add(diagn);
                patient.Visitations.Add(visit);
                ctx.SaveChanges();
            }
        }
Ejemplo n.º 11
0
        public ActionResult AddItem(int?Id = null)
        {
            if (Id != null)
            {
                if (Session["user"] != null)
                {
                    var user    = Session["user"].ToString();
                    var Docinfo = _db.Doctors.Where(x => x.Username == user).FirstOrDefault();
                    int DocId   = Docinfo.Vetid;

                    //ServiceDropdown
                    List <Servicesacon> servicelist = _db.Servicesacons.Where(x => x.VetId == DocId).ToList();
                    ViewBag.Servicelist = servicelist;

                    //ServiceDropdown
                    List <Medicine> medicines = _db.Medicines.Where(x => x.VetId == DocId).ToList();
                    ViewBag.MedList = medicines;
                    if (medicines == null)
                    {
                        return(RedirectToAction("Index", "Diagnose"));
                    }

                    List <Productacom> product = _db.Productacoms.Where(x => x.VetId == DocId).ToList();
                    ViewBag.prod = product;

                    List <Recept> recept = _db.Recepts.ToList();
                    ViewBag.recpt = recept;
                }

                Diagnose diagnose = _db.Diagnoses.Find(Id);
                ViewBag.DiagnoseId = diagnose;
                if (diagnose == null)
                {
                    return(RedirectToAction("Index", "Diagnose"));
                }
                return(View());
            }

            return(RedirectToAction("Index", "Diagnose"));
        }
        protected override void Seed(HospitalContext context)
        {
            Visitation visition = new Visitation()
            {
                Date     = DateTime.Today,
                Comments = "Lupus definetly"
            };
            Doctor doc = new Doctor()
            {
                FirstName = "Kris", LastName = "Milkin", Specialty = "Stomatology"
            };

            Medicament medicament = new Medicament()
            {
                Name = "Autoimmuneixoid",
            };

            Diagnose diagnose = new Diagnose()
            {
                Comments = "He's definitely got it", Name = "Lupus"
            };

            Patient patientZero = new Patient()
            {
                FirstName          = "Cherniq",
                LastName           = "Negur",
                Address            = "Sofia, Lulin",
                DateOfBirth        = new DateTime?(new DateTime(1991, 02, 04)),
                IsMedicallyInsured = true
            };

            doc.Visitations.Add(visition);
            patientZero.Medicaments.Add(medicament);
            patientZero.Visitations.Add(visition);
            patientZero.Diagnoses.Add(diagnose);

            context.Doctors.Add(doc);
            context.Patients.Add(patientZero);
            context.SaveChanges();
        }
Ejemplo n.º 13
0
        public static void Main()
        {
            Patient patient = new Patient()
            {
                FirstName        = "Sev",
                LastName         = "Pau",
                Address          = "str.32 blg.4, Sofia",
                Email            = "*****@*****.**",
                DateOfBirth      = new DateTime(1989, 06, 02),
                MedicalInsurance = false,
                Medicaments      = new List <string> {
                    "Asperin", "Analgin", "Vitamin"
                }
            };

            Diagnose diagnose = new Diagnose()
            {
                Name = "GoodBacteria"
            };

            Doctor doctor = new Doctor()
            {
                Name      = "Petrov",
                Specialty = "Sergary"
            };

            Visitation visitation = new Visitation()
            {
                VisitDate = new DateTime(2017, 10, 10),
                Doctor    = doctor
            };

            patient.Diagnoses.Add(diagnose);
            patient.Visitations.Add(visitation);

            HospitalContext context = new HospitalContext();

            context.Patients.Add(patient);
            context.SaveChanges();
        }
Ejemplo n.º 14
0
 public SimulateSymbolSyncTicks(FIXSimulatorSupport fixSimulatorSupport,
                                QuoteSimulatorSupport quoteSimulatorSupport,
                                string symbolString,
                                PartialFillSimulation partialFillSimulation,
                                TimeStamp endTime,
                                long id)
 {
     log.Register(this);
     this.id = id;
     this.fixSimulatorSupport   = fixSimulatorSupport;
     this.quoteSimulatorSupport = quoteSimulatorSupport;
     this.onTick                         = quoteSimulatorSupport.OnTick;
     this.onEndTick                      = quoteSimulatorSupport.OnEndTick;
     this.PartialFillSimulation          = partialFillSimulation;
     this.symbolString                   = symbolString;
     this.symbol                         = Factory.Symbol.LookupSymbol(symbolString);
     fillSimulator                       = Factory.Utility.FillSimulator("FIX", Symbol, false, true, null);
     fillSimulator.EnableSyncTicks       = SyncTicks.Enabled;
     FillSimulator.OnPhysicalFill        = fixSimulatorSupport.OnPhysicalFill;
     FillSimulator.OnRejectOrder         = fixSimulatorSupport.OnRejectOrder;
     fillSimulator.PartialFillSimulation = partialFillSimulation;
     tickSync       = SyncTicks.GetTickSync(Symbol.BinaryIdentifier);
     latency        = new LatencyMetric("SimulateSymbolSyncTicks-" + symbolString.StripInvalidPathChars());
     diagnoseMetric = Diagnose.RegisterMetric("Simulator");
     if (debug)
     {
         log.Debug("Opening tick file for reading.");
     }
     reader = Factory.TickUtil.TickFile();
     try
     {
         reader.Initialize("Test\\MockProviderData", symbolString, TickFileMode.Read);
         reader.EndTime = endTime;
     }
     catch (FileNotFoundException ex)
     {
         log.Info("File for symbol " + symbolString + " not found: " + ex.Message);
     }
 }
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (CaseSexType == SexType.詳)
            {
                yield return(new ValidationResult("個案性別 有誤。", new[] { "CaseSex" }));
            }

            if (CaseBirthday.HasValue && CaseBirthday >= DateTime.Today)
            {
                yield return(new ValidationResult("個案生日 有誤。", new[] { "CaseBirthday" }));
            }

            if (PsyHistoryType == Enum.MTC.PsyHistoryType.)
            {
                if (Diagnose == null || !Diagnose.Any())
                {
                    yield return(new ValidationResult("過往精神病史為「有」時,診斷 欄位是必要項。", new[] { "Diagnose" }));
                }
            }

            if (PsyHistoryType == Enum.MTC.PsyHistoryType.詳 && string.IsNullOrWhiteSpace(SymptomOther))
            {
                yield return(new ValidationResult("過往精神病史為「不詳」時,精神疾病症狀-其他 欄位是必要項。", new[] { "SymptomOther" }));
            }

            if (Id < 0)
            {
                yield return(new ValidationResult("查無此案。", new[] { "Id" }));
            }
            else if (Id == 0) //新增
            {
                if (MedicalPersonImage == null)
                {
                    yield return(new ValidationResult("醫護人員簽名圖檔 欄位是必要項。", new[] { "MedicalPersonImage" }));
                }
            }
        }
Ejemplo n.º 16
0
        public async Task AddTreatmentToDiagnose(TreatmentModel model)
        {
            Diagnose diagnose = await _diagnoseContext.Diagnoses
                                .Where(d => d.Id == model.DiagnoseId)
                                .Include(d => d.Treatment)
                                .SingleOrDefaultAsync();

            var newTreatment = new Treatment()
            {
                Beginning          = DateTime.Now,
                End                = model.End.Value,
                Chemeotherapy      = model.Chemeotherapy,
                EndocrineTreatment = model.EndocrineTreatment,
                Radiation          = model.Radiation,
                Surgery            = model.Surgery,
                DiagnoseId         = diagnose.Id
            };

            await _diagnoseContext.Treatments.AddAsync(newTreatment);

            diagnose.Treatment = newTreatment;

            await _diagnoseContext.SaveChangesAsync();
        }
Ejemplo n.º 17
0
 public async Task <OutputBase> Update([FromBody] Diagnose diagnose)
 {
     return(await _diagnoseService.Update(diagnose));
 }
        /// <summary>
        /// 更新诊断
        /// </summary>
        /// <param name="diagnose">诊断</param>
        /// <returns></returns>
        public async Task <OutputBase> Update(Diagnose diagnose)
        {
            await _diagnoseRepository.Update(diagnose);

            return(_unitWork.Commit() ? OutputBase.Success("更新成功") : OutputBase.Fail("更新失败"));
        }
        /// <summary>
        /// 新增诊断
        /// </summary>
        /// <param name="diagnose">诊断</param>
        /// <returns>诊断ID</returns>
        public OutputBase Add(Diagnose diagnose)
        {
            var id = _diagnoseRepository.Add(diagnose);

            return(_unitWork.Commit() ? OutputBase.Success("新增成功") : OutputBase.Fail("新增失败"));
        }
Ejemplo n.º 20
0
        protected void ShowDiagButton_Click(object sender, EventArgs e)
        {
            if (Session["SelectedData"] == null)
            {
                ViewState["ErrorMsg"] = Language.Selected["Alert_SelData"];
                //Response.Write("<script>$(function(){$('#ErrorMsg p').innerText='" + Language.Selected["Alert_SelData"] + "';$('#ErrorMsg').show();})</script>");
                //Response.Write("<script>alert(" + Language.Selected["Alert_SelData"] + "')</script>");

                return;
            }
            if (Session["SelectedAbs"] == null)
            {
                ViewState["ErrorMsg"] = Language.Selected["Alert_SelAbs"];
                //Response.Write("<script>alert(" + Language.Selected["Alert_SelAbs"] + "')</script>");
                return;
            }
            if (Session["SelectedRel"] == null)
            {
                ViewState["ErrorMsg"] = Language.Selected["Alert_SelRel"];
                //Response.Write("<script>alert(" + Language.Selected["Alert_SelRel"] + "')</script>");
                return;
            }

            ContentData data = (ContentData)Session["SelectedData"];
            ContentData abs  = (ContentData)Session["SelectedAbs"];
            ContentData rel  = (ContentData)Session["SelectedRel"];

            if (data.ReadDate <= abs.ReadDate)
            {
                ViewState["ErrorMsg"] = Language.Selected["Alert_TimeErr1"];
                //Response.Write("<script>alert('" + Language.Selected["Alert_TimeErr1"] + "')</script>");
                return;
            }
            if (data.ReadDate <= rel.ReadDate)
            {
                ViewState["ErrorMsg"] = Language.Selected["Alert_TimeErr2"];
                //Response.Write("<script>alert('" + Language.Selected["Alert_TimeErr2"] + "')</script>");
                return;
            }
            ViewState["ErrorMsg"] = "";
            switch (ShowDiagDrop.SelectedValue)
            {
            case "大卫三角形法":
                Session["DiagType"] = "DavidDiag";
                break;

            case "立体图示法":
                Session["DiagType"] = "ThreeShow";
                break;
            }



            AnlyInformation    anlyInfo  = null;
            List <AlarmMsgAll> alarmList = null;

            MongoHelper <Config> _cfg             = new MongoHelper <Config>();
            Expression <Func <Config, bool> > ex  = p => p.DevID == devId && p.Alarm != null;
            Expression <Func <Config, bool> > ex1 = p => p.DevID == devId && p.AnalyPara.EnviSet != null;
            Config cfg = _cfg.FindOneBy(ex);

            if (cfg == null || cfg.Alarm == null || cfg.AnalyPara.EnviSet == null)
            {
                //。。。。。。。。。。。。。从下位机取。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
            }
            AlarmAll           hold    = cfg.Alarm;
            EnvironmentSetting setting = cfg.AnalyPara.EnviSet;

            if (hold == null || setting == null)
            {
                //从下位机取。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
            }
            //告警信息
            alarmList = Diagnose.GasAlarm(data, abs, rel, setting, hold);

            ////故障分析。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
            anlyInfo = Diagnose.GasDiagnose(devId, data, abs, rel, setting, hold.DiagSet);
            DiagnoseResult dr = Diagnose.WrapperAnlyResult(devId, 2, anlyInfo);

            TB_Result.Text = "";

            //TB_Result.Text += "\r\n------告警信息(" + alarmList.Length.ToString() + ")条------\r\n";//ljb:alarmList为空的时候不知道有没有Length这个属性(这个地方一直没法运行下去,估计这就是问题)
            TB_Result.Text += "\r\n------告警信息------\r\n";//ljb
            //有告警信息
            if (alarmList != null && alarmList.Count() != 0)
            {
                TB_Result.Text += "\r\n------告警信息(" + alarmList.Count().ToString() + ")条------\r\n";//ljb
                for (int i = 0; i < alarmList.Count(); i++)
                {
                    string msg = "";
                    msg += Language.Selected["Alarm_Device"] + devId + "\r\n";
                    msg += Language.Selected["Alarm_Gas"] + alarmList[i].GasName + "\r\n";

                    string msgType = "";
                    switch (alarmList[i].Type)
                    {
                    case 0:
                        msgType = Language.Selected["Alarm_Type_Content"];
                        break;

                    case 1:
                        msgType = Language.Selected["Alarm_Type_Abs"];
                        break;

                    case 2:
                        msgType = Language.Selected["Alarm_Type_Rel"];
                        break;

                    default:
                        msgType = Language.Selected["Alarm_Type_Content"];
                        break;
                    }

                    msg += Language.Selected["Alarm_Type"] + msgType + "\r\n";
                    msg += Language.Selected["Alarm_Value"] + alarmList[i].AlarmValue.ToString("F1") + ", " + Language.Selected["Alarm_RealValue"] + alarmList[i].RealValue.ToString("F3") + "\r\n";
                    msg += Language.Selected["Alarm_Level"] + WarringLevel[alarmList[i].Level] + "\r\n";

                    TB_Result.Text += msg + "\r\n";
                }
            }
            else
            {
                TB_Result.Text += "\r\n------无信息------\r\n";
            }

            //有故障信息
            TB_Result.Text += "\r\n------故障诊断信息------\r\n";
            if (anlyInfo != null)
            {
                //最终 诊断结果
                TB_Result.Text += "\r\n" + Language.Selected["Diag_Result"] + "\r\n" + dr.Result + "\r\n";
                //其它诊断中间数据,三比值、大卫三角形、立体图示
                TB_Result.Text += "\r\n" + Language.Selected["ThreeRatio_Diag_Result"] + "\r\n" + dr.ThreeRatioCode + "(" + dr.ThreeRatioResult + ")\r\n";
                TB_Result.Text += "\r\n" + Language.Selected["David_Result"] + "\r\n" + dr.DevidCode + "(" + dr.DevidResult + ")\r\n";
                TB_Result.Text += "\r\n" + Language.Selected["Cube_Diag_Result"] + "\r\n" + dr.CubeCode + "\r\n";

                //
                LB_Ratio.Text = dr.ThreeRatioCode;

                //大卫三角形数据
                //"C2H2:10%, C2H4:20%, CH4:30%"
                string   sr  = dr.DevidCode;
                string[] str = sr.Split(',');
                for (int i = 0; i < str.Length; i++)
                {
                    string[] temp = str[i].Split(':');
                    if (temp[0] == "C2H2" || temp[0] == "C2H4" || temp[0] == "CH4")
                    {
                        Session[temp[0]] = temp[1];
                    }
                }
                if (Session["C2H2"] != null & Session["C2H4"] != null && Session["CH4"] != null)
                {
                    get_temp_Map();
                    Timer1.Enabled = true;
                }

                else
                {
                    Response.Write("<script>alert(" + "session出错,请重新诊断!" + "')</script>");
                }
                //dr = dr.Replace('%', ' ');
                //dr = dr.Replace(',', '&');
                //dr = dr.Replace(":", "=");
                //dr = dr.Replace(" ", "");
                //string str = "javascript:showPopWin('" + Language.Selected["Title_Sample"] + "', 'DevidShow.aspx?";
                //str += dr;
                //str += "',  620, 330, null, true, true);return false;";
                //BT_Devid.OnClientClick = str;
                //BT_Devid.Enabled = true;

                //string str1 = "javascript:showPopWin('" + Language.Selected["CubeShow"] + "', 'ThreeShow.aspx?";
                //str1 += dr;
                //str1 += "',  900, 440, null, true, true);return false;";
                //BT_Cube.OnClientClick = str1;
                //BT_Cube.Enabled = true;
                ////立体图 命令参数
                ////"C2H2/C2H4=1, C2H4/C2H6=1, CH4/H2=1"
//#if false
//                                    //dr = anlyInfo._cubecode;

//                                    //string cmd = anlyInfo.Value.ratio.CH4_H2.ToString() + ",";
//                                    //cmd += anlyInfo.Value.ratio.C2H2_C2H4.ToString() + ",";
//                                    //cmd += anlyInfo.Value.ratio.C2H4_C2H6.ToString();
//                                    //ViewState["CMD"] = cmd;
//#else
//                ViewState["CMD"] = null;//这是谁改的?它和else里面的一样,那ViewState["CMD"]永远为null了,上面这段为什么注释掉?--ljb
//#endif
            }
            else
            {
                TB_Result.Text += "\r\n------无信息------\r\n";

                //ljb
                //BT_Devid.Enabled = true;
                //BT_Devid.Enabled = false;
                //BT_Cube.Enabled = false;

                ViewState["CMD"] = null;
            }
        }
        private static Diagnose[] GenerateDiagnoses(Patient patient)
        {
            var diagnoseNames = new string[]
            {
                "Limp Scurvy",
                "Fading Infection",
                "Cow Feet",
                "Incurable Ebola",
                "Snake Blight",
                "Spider Asthma",
                "Sinister Body",
                "Spine Diptheria",
                "Pygmy Decay",
                "King's Arthritis",
                "Desert Rash",
                "Deteriorating Salmonella",
                "Shadow Anthrax",
                "Hiccup Meningitis",
                "Fading Depression",
                "Lion Infertility",
                "Wolf Delirium",
                "Humming Measles",
                "Incurable Stomach",
                "Grave Heart",
                "Andromeda Strain",
                "Atlantis Complex",
                "Alien Amnesia",
                "Bazi Plague",
                "Bloodfire Pox",
                "Killing Nanovirus",
                "Codon Zero",
                "Descolada Trump",
                "Dryditch Fever",
                "EF76 Strain",
                "Virus VC321xb47",
                "Foul Drought",
                "Cat Flu",
                "Great Harlequin",
                "Neptune Plague",
                "Curable AIDS",
                "Pale Mare",
                "Scarlet Fever",
                "Stone Sickness",
                "Stone Deafness",
                "Wanderer's Folly",
                "Takis A",
                "Brain Cloud",
                "Meningoencephalitis One",
                "Ezekiel Complex",
                "Thing Cells",
                "Amoria Phlebitis",
                "Bowden's Malady",
                "Cosmic Rust",
                "Eureka Seven",
                "Dark Harvest",
                "Irumodic Syndrome",
                "Pigouen Head",
                "Jungle Worms",
                "Polaris Extremis"
            };
            //var diagnoseNames = File.ReadAllLines("<INSERT DIR HERE>");

            int diagnoseCount = rnd.Next(1, 4);
            var diagnoses     = new Diagnose[diagnoseCount];

            for (int i = 0; i < diagnoseCount; i++)
            {
                string diagnoseName = diagnoseNames[rnd.Next(diagnoseNames.Length)];

                var diagnose = new Diagnose()
                {
                    Name    = diagnoseName,
                    Patient = patient
                };

                diagnoses[i] = diagnose;
            }

            return(diagnoses);
        }
Ejemplo n.º 22
0
        public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider)
        {
            List <Diagnose> diagnoseList = new List <Diagnose>();

            Diagnose diagnose = new Diagnose
            {
                Name        = "CuronaVirus",
                Description = "Fantasmagoricus lafchitus",
            };

            Diagnose diagnose1 = new Diagnose
            {
                Name        = "JujonaVirus",
                Description = "Hablara muchisimo",
            };

            Diagnose diagnose2 = new Diagnose
            {
                Name        = "Who you ball",
                Description = "Sam sym si records",
            };

            Diagnose diagnose3 = new Diagnose
            {
                Name        = "LighthouseAches",
                Description = "Bombilla fundida",
            };

            Diagnose diagnose4 = new Diagnose
            {
                Name        = "GuzoAches",
                Description = "Dolores de culo",
            };

            Diagnose diagnose5 = new Diagnose
            {
                Name        = "TheOtherJobAches",
                Description = "Me duele el trabajo",
            };

            Diagnose diagnose6 = new Diagnose
            {
                Name        = "Corana Virus",
                Description = "when I was your age",
            };

            Diagnose diagnose7 = new Diagnose
            {
                Name        = "Medical Students Syndrome",
                Description = "Topykedno Uchene",
            };

            Diagnose diagnose8 = new Diagnose
            {
                Name        = "Triskadekaphobia",
                Description = "fear of number 13",
            };

            Diagnose diagnose9 = new Diagnose
            {
                Name        = "Hexakosioihexekontahexaphobia",
                Description = "fear of 666",
            };

            Diagnose diagnose10 = new Diagnose
            {
                Name        = "Phalacrophobia",
                Description = "Bald, becoming",
            };

            diagnoseList.Add(diagnose);
            diagnoseList.Add(diagnose1);
            diagnoseList.Add(diagnose2);
            diagnoseList.Add(diagnose3);
            diagnoseList.Add(diagnose4);
            diagnoseList.Add(diagnose5);
            diagnoseList.Add(diagnose6);
            diagnoseList.Add(diagnose7);
            diagnoseList.Add(diagnose8);
            diagnoseList.Add(diagnose9);
            diagnoseList.Add(diagnose10);

            if (diagnoseList.Count() > dbContext.Diagnoses.Count())
            {
                dbContext.Diagnoses.RemoveRange(dbContext.Diagnoses);
                await dbContext.AddRangeAsync(diagnoseList);
            }
        }
Ejemplo n.º 23
0
 public void Add(Diagnose model)
 {
     this.context.Diagnoses.Add(model);
     this.context.SaveChanges();
 }
        private static void Main(string[] args)
        {
            HospitalContext context = new HospitalContext();

            Patient patient = new Patient()
            {
                FirstName   = "Ivan",
                LastName    = "Ivanov",
                Address     = "Mladost 1",
                Email       = "*****@*****.**",
                DateOfBirth = DateTime.Now
            };

            context.Patients.Add(patient);

            Visitation visitation = new Visitation()
            {
                Patient = patient,
                Date    = DateTime.Now
            };

            context.Visitations.Add(visitation);

            Diagnose diagnose = new Diagnose()
            {
                Name    = "Disease",
                Patient = patient
            };

            context.Diagnoses.Add(diagnose);

            Medicament medicament = new Medicament()
            {
                Name = "Vitamin C",
            };

            medicament.Patients.Add(patient);

            context.Medicaments.Add(medicament);

            Doctor doctor = new Doctor()
            {
                Name      = "Dr. Ivanov",
                Specialty = "orthopedic doctor"
            };

            visitation.Doctor = doctor;

            context.Doctors.Add(doctor);

            try
            {
                context.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var ev in ex.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      ev.Entry.Entity.GetType().Name, ev.Entry.State);
                    foreach (var ve in ev.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
        }
Ejemplo n.º 25
0
        //Edit patient in system
        public void EditPatient(HospitalContext context)
        {
            var medicament = new Medicament();
            var diagnose   = new Diagnose();
            var visitation = new Visitation();

            Console.WriteLine("Please, write patient first name and last name you want to edit:");
            List <string> names = Console.ReadLine()
                                  .Split(" ")
                                  .ToList();

            string patientFirstname = names[0];
            string patientLastname  = names[1];

            var patientToEdit = context.Patients
                                .FirstOrDefault(p => p.FirstName == patientFirstname &&
                                                p.LastName == patientLastname && p.HasInsurance == true);

            if (context.Patients.Any(p => p == patientToEdit))
            {
                Console.WriteLine("What do you want to edit? To add visitation/medicament/diagnose write some of the following - " +
                                  "Add visitation/Add medicament/Add diagnose. To remove the same - Remove visitation/Remove medicament/" +
                                  "Remove diagnose.");

                string answer = Console.ReadLine();

                if (answer == "Add visitation")
                {
                    Console.WriteLine("Enter date for visitation:");
                    string visitationDate = Console.ReadLine();

                    visitation.Date = DateTime.Parse(visitationDate);

                    var currentDoctor = context.Doctor.FirstOrDefault(d => d.Name == docName && d.Specialty == docSpecialty &&
                                                                      d.Password == docPassword);

                    visitation.Doctor  = currentDoctor;
                    visitation.Patient = patientToEdit;

                    patientToEdit.Visitations.Add(visitation);
                    Console.WriteLine("Visitation added!");


                    context.SaveChanges();
                }

                else if (answer == "Add medicament")
                {
                    Console.WriteLine("Write medicament name:");
                    string medicamentName = Console.ReadLine();

                    medicament.Name = medicamentName;

                    var patientMedicaments = new PatientMedicament()
                    {
                        Patient    = patientToEdit,
                        Medicament = medicament
                    };

                    patientToEdit.Prescriptions.Add(patientMedicaments);
                    Console.WriteLine("Medicament added!");

                    context.SaveChanges();
                }

                else if (answer == "Add diagnose")
                {
                    Console.WriteLine("Write diagnose name:");
                    string diagnoseName = Console.ReadLine();

                    diagnose.Name    = diagnoseName;
                    diagnose.Patient = patientToEdit;

                    patientToEdit.Diagnoses.Add(diagnose);
                    Console.WriteLine("Diagnose added!");

                    context.SaveChanges();
                }

                else if (answer == "Remove visitation")
                {
                    Console.WriteLine("Write visitation date:");
                    string visitationDate = Console.ReadLine();
                    var    date           = DateTime.Parse(visitationDate);

                    var currentDoctor = context.Doctor
                                        .FirstOrDefault(d => d.Name == docName &&
                                                        d.Specialty == docSpecialty &&
                                                        d.Password == docPassword);

                    var visitationToRemove = context.Visitations
                                             .FirstOrDefault(v => v.Doctor == currentDoctor &&
                                                             v.Patient == patientToEdit);

                    if (patientToEdit.Visitations.Any(v => v == visitationToRemove))
                    {
                        patientToEdit.Visitations.Remove(visitationToRemove);
                        Console.WriteLine("Visitation deleted!");

                        context.SaveChanges();
                    }

                    else
                    {
                        throw new ArgumentException("No such visitation!");
                    }
                }

                else if (answer == "Remove medicament")
                {
                    Console.WriteLine("Write medicament name:");
                    string medicamentName = Console.ReadLine();

                    medicament.Name = medicamentName;

                    var patients = context.PatientMedicaments
                                   .Where(p => p.Patient.PatientId == patientToEdit.PatientId).ToList();

                    var medicaments = context.PatientMedicaments
                                      .Where(m => m.Medicament.MedicamentId == medicament.MedicamentId).ToList();

                    foreach (var patient in patients)
                    {
                        if (context.PatientMedicaments
                            .Any(p => p.Patient.PatientId == patient.PatientId))
                        {
                            context.PatientMedicaments.Remove(patient);

                            context.SaveChanges();
                        }

                        else
                        {
                            throw new ArgumentException("No such patient!");
                        }
                    }

                    foreach (var med in medicaments)
                    {
                        if (context.PatientMedicaments
                            .Any(m => m.MedicamentId == med.MedicamentId))
                        {
                            context.PatientMedicaments.Remove(med);

                            context.SaveChanges();
                        }

                        else
                        {
                            throw new ArgumentException("No such medicament!");
                        }
                    }

                    var medicamentToRemove = context.Medicaments
                                             .Where(m => m.Name == medicament.Name)
                                             .FirstOrDefault();

                    if (context.Medicaments
                        .Any(m => m.MedicamentId == medicamentToRemove.MedicamentId))
                    {
                        context.Medicaments.Remove(medicamentToRemove);
                        context.SaveChanges();

                        Console.WriteLine("Medicament removed!");
                    }

                    else
                    {
                        throw new ArgumentException("No such medicament!");
                    }
                }

                else if (answer == "Remove diagnose")
                {
                    Console.WriteLine("Write diagnose name:");
                    string diagnoseName = Console.ReadLine();

                    var diagnoseToEdit = context.Diagnoses
                                         .FirstOrDefault(d => d.Name == diagnoseName);

                    if (context.Diagnoses.Any(d => d == diagnoseToEdit))
                    {
                        patientToEdit.Diagnoses.Remove(diagnoseToEdit);
                        Console.WriteLine("Diagnose removed!");

                        context.SaveChanges();
                    }
                    else
                    {
                        throw new ArgumentException("No such diagnose!");
                    }
                }
            }

            else
            {
                throw new ArgumentException("There is no such patient in the system!");
            }
        }
Ejemplo n.º 26
0
 public void Initialize()
 {
     _diagnoseEvent = new Diagnose();
 }
Ejemplo n.º 27
0
        public void SendOptionPrice()
        {
            if (!isRunning)
            {
                return;
            }
            if (Symbol.OptionChain != OptionChain.Complete)
            {
                if (!errorOptionChainType)
                {
                    log.Error("Received option price but " + Symbol + " is configured for TimeAndSales = " + Symbol.OptionChain + " in the symbol dictionary.");
                    errorOptionChainType = true;
                }
                return;
            }
            if (!isQuoteInitialized && !VerifyQuote())
            {
                return;
            }

            if (strikePrice == 0D || utcOptionExpiration == default(TimeStamp))
            {
                if (!errorStrikeAndExpiration)
                {
                    log.Error("Received option price but strike or expiration was blank: Strike " + strikePrice + ", " + utcOptionExpiration);
                    errorStrikeAndExpiration = true;
                }
                return;
            }
            tickIO.Initialize();
            tickIO.SetSymbol(Symbol.BinaryIdentifier);
            tickIO.SetTime(Time);
            tickIO.SetOption(optionType, strikePrice, utcOptionExpiration);
            if (Last != 0D)
            {
                tickIO.SetTrade(Last, LastSize);
            }
            if (Bid != 0 && Ask != 0 && BidSize != 0 && AskSize != 0)
            {
                tickIO.SetQuote(Bid, Ask, (short)BidSize, (short)AskSize);
            }
            var box    = tickPool.Create(tickPoolCallerId);
            var tickId = box.TickBinary.Id;

            box.TickBinary    = tickIO.Extract();
            box.TickBinary.Id = tickId;
            if (tickIO.IsTrade && tickIO.Price == 0D)
            {
                log.Warn("Found trade tick with zero price: " + tickIO);
            }
            salesLatency.TryUpdate(box.TickBinary.Symbol, box.TickBinary.UtcTime);
            var eventItem = new EventItem(symbol, EventType.Tick, box);

            agent.SendEvent(eventItem);
            Interlocked.Increment(ref tickCount);
            if (Diagnose.TraceTicks)
            {
                Diagnose.AddTick(diagnoseMetric, ref box.TickBinary);
            }
            if (trace)
            {
                log.Trace("Sent trade tick for " + Symbol + ": " + tickIO);
            }
        }
Ejemplo n.º 28
0
 public void SendTimeAndSales()
 {
     if (!isRunning)
     {
         return;
     }
     if (Symbol.TimeAndSales != TimeAndSales.ActualTrades)
     {
         if (!errorWrongTimeAndSalesType)
         {
             log.Error("Received " + TimeAndSales.ActualTrades + " trade but " + Symbol + " is configured for TimeAndSales = " + Symbol.TimeAndSales + " in the symbol dictionary.");
             errorWrongTimeAndSalesType = true;
         }
         return;
     }
     if (!isTradeInitialized && !VerifyTrade())
     {
         return;
     }
     if (Symbol.QuoteType == QuoteType.Level1)
     {
         if (!isQuoteInitialized && !VerifyQuote())
         {
             if (!errorNeverAnyLevel1Tick)
             {
                 var message = "Found a Trade tick w/o any " + QuoteType.Level1 + " quote yet but " + Symbol +
                               " is configured for QuoteType = " + Symbol.QuoteType + " in the symbol dictionary.";
                 if (Factory.IsAutomatedTest)
                 {
                     log.Notice(message);
                 }
                 else
                 {
                     log.Warn(message);
                 }
                 errorNeverAnyLevel1Tick = true;
             }
         }
         else if (errorNeverAnyLevel1Tick)
         {
             log.Notice("Okay. Found a Level 1 quote tick that resolves the earlier warning message.");
             errorNeverAnyLevel1Tick = false;
         }
     }
     if (Last == 0D)
     {
         log.Error("Found last trade price was set to " + Last + " so skipping this tick.");
         return;
     }
     if (Symbol.TimeAndSales == TimeAndSales.ActualTrades)
     {
         tickIO.Initialize();
         tickIO.SetSymbol(Symbol.BinaryIdentifier);
         tickIO.SetTime(Time);
         tickIO.SetTrade(Last, LastSize);
         if (Symbol.QuoteType == QuoteType.Level1 && isQuoteInitialized && VerifyQuote())
         {
             tickIO.SetQuote(Bid, Ask, (short)BidSize, (short)AskSize);
         }
         var box    = tickPool.Create(tickPoolCallerId);
         var tickId = box.TickBinary.Id;
         box.TickBinary    = tickIO.Extract();
         box.TickBinary.Id = tickId;
         if (tickIO.IsTrade && tickIO.Price == 0D)
         {
             log.Warn("Found trade tick with zero price: " + tickIO);
         }
         salesLatency.TryUpdate(box.TickBinary.Symbol, box.TickBinary.UtcTime);
         var eventItem = new EventItem(symbol, EventType.Tick, box);
         agent.SendEvent(eventItem);
         Interlocked.Increment(ref tickCount);
         if (Diagnose.TraceTicks)
         {
             Diagnose.AddTick(diagnoseMetric, ref box.TickBinary);
         }
         if (trace)
         {
             log.Trace("Sent trade tick for " + Symbol + ": " + tickIO);
         }
     }
 }
Ejemplo n.º 29
0
        private static void FindEnity(string[] commandArgs)
        {
            ValidateLength(commandArgs.Length - 1, 2);
            string entityName = commandArgs[1];
            int    entityId;

            if (!int.TryParse(commandArgs[2], out entityId))
            {
                new ArgumentException($"Argument: \"{commandArgs[2]}\"  is invalid ID!");
            }

            switch (entityName)
            {
            case "patient":
                Patient patient = dbContext.Patients.Include(p => p.Visitations).FirstOrDefault(p => p.Id == entityId);

                if (patient == null)
                {
                    throw new ArgumentException("Patient was not found!");
                }

                // Just for testing.
                foreach (Visitation v in patient.Visitations)
                {
                    Console.WriteLine(v.Patient.FirstName);
                }

                Console.WriteLine(patient.ToString());
                break;

            case "medicament":
                Medicament medicament = dbContext.Medicaments.Find(entityId);

                if (medicament == null)
                {
                    throw new ArgumentException("Medicament was not found!");
                }

                Console.WriteLine(medicament.ToString());
                break;

            case "visitation":
                Visitation visitation = dbContext.Visitations.Find(entityId);

                if (visitation == null)
                {
                    throw new ArgumentException("Patient was not found!");
                }

                Console.WriteLine(visitation.ToString());
                break;

            case "diagnose":
                Diagnose diagnose = dbContext.Diagnoses.Find(entityId);

                if (diagnose == null)
                {
                    throw new ArgumentException("Patient was not found!");
                }

                Console.WriteLine(diagnose.ToString());
                break;

            default:
                throw new ArgumentException($"Entity type: \" {entityName}\" was not found!");
            }
        }
        public static void Main()
        {
            try
            {
                var context = new HospitalContext();

                using (context)
                {
                    //context.Database.Initialize(true);

                    Patient patient = new Patient
                    {
                        FirstName   = "Marrika",
                        LastName    = "Obstova",
                        Adress      = "Luvov most No.1",
                        Email       = "*****@*****.**",
                        DateOfBirth = new DateTime(1990, 05, 07)
                    };

                    Doctor doctor = new Doctor
                    {
                        Name      = "Doctor Frankenstein",
                        Specialty = "Mad scientist"
                    };

                    Visitation visitation = new Visitation
                    {
                        Doctor   = doctor,
                        Comments = "Mnoo zle",
                        Patient  = patient,
                        Date     = DateTime.Now
                    };

                    patient.Visitations.Add(visitation);
                    doctor.Visitations.Add(visitation);

                    Diagnose diagnose = new Diagnose
                    {
                        Name     = "HIV",
                        Comments = "Ot mangalite na luvov most",
                        Patient  = patient
                    };

                    patient.Diagnoses.Add(diagnose);

                    Medicament medicament = new Medicament
                    {
                        Name    = "Paracetamol",
                        Patient = patient
                    };

                    patient.Medicaments.Add(medicament);

                    context.Patients.Add(patient);
                    context.Doctors.Add(doctor);
                    context.Diagnoses.Add(diagnose);
                    context.Visitations.Add(visitation);
                    context.Medicaments.Add(medicament);
                    context.SaveChanges();
                }
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult dbEntityValidationResult in ex.EntityValidationErrors)
                {
                    foreach (DbValidationError dbValidationError in dbEntityValidationResult.ValidationErrors)
                    {
                        Console.WriteLine(dbValidationError.ErrorMessage);
                    }
                }
            }
        }