Пример #1
0
        /// <summary>
        /// Generates the final snapshot text representation.
        /// </summary>
        /// <param name="output">The output.</param>
        public void GenerateFinalSnapshotText(OutputBase output)
        {
            output.Headline("Final snapshot content");
            output.EmptyLine();

            if (programPointGraph != null && programPointGraph.End != null && programPointGraph.End.OutSet != null)
            {
                output.CommentLine("Number of memory locations: " + programPointGraph.End.OutSnapshot.NumMemoryLocations());

                Snapshot snapshot = getSnapshot(programPointGraph.End);
                if (snapshot != null)
                {
                    output.CommentLine("Number of variables: " + snapshot.Structure.Readonly.ReadonlyGlobalContext.ReadonlyVariables.Count);
                    output.CommentLine("Number of control variables: " + snapshot.Structure.Readonly.ReadonlyGlobalContext.ReadonlyControllVariables.Count);
                    output.CommentLine("Number of temporary variables: " + snapshot.Structure.Readonly.ReadonlyGlobalContext.ReadonlyTemporaryVariables.Count);
                    output.CommentLine("Number of arrays: " + snapshot.Structure.Readonly.ArrayDescriptors.Count());
                    output.CommentLine("Number of objects: " + snapshot.Structure.Readonly.ObjectDescriptors.Count());

                    SnapshotTextGenerator generator = new SnapshotTextGenerator(output);
                    generator.GenerateSnapshotText(snapshot);
                }
                else
                {
                    output.EmptyLine();
                    output.ProgramPointInfo("", programPointGraph.End);
                }
            }
            else
            {
                output.Error("End point was not reached");
            }
        }
        /// <summary>
        /// 更新医护人员
        /// </summary>
        /// <param name="input">医护人员信息</param>
        /// <returns>是否成功</returns>
        public async Task <OutputBase> Update(AdminDoctorDto input)
        {
            var doctor = await _repository.GetDoctorById(input.Id);

            if (doctor == null)
            {
                return(OutputBase.Fail("该医护人员不存在"));
            }
            if (doctor.Phone != input.Phone && await _repository.GetDoctorByPhone(input.Phone) != null)
            {
                return(OutputBase.Fail("该手机号已经注册"));
            }

            var entity = new Doctor
            {
                Id         = input.Id,
                Brithdate  = input.Brithdate,
                DeptId     = input.DeptId,
                HospitalId = input.HospitalId,
                Name       = input.Name,
                Phone      = input.Phone,
                SelfDesc   = input.SelfDesc,
                Sex        = input.Sex,
                UserType   = input.UserType,
                TitleId    = input.TitleId
            };
            await _repository.Update(entity);

            return(_unitWork.Commit() ? OutputBase.Success("更新成功") : OutputBase.Fail("更新失败"));
        }
        /// <summary>
        /// 添加手环数据
        /// </summary>
        /// <param name="input">输入</param>
        /// <returns></returns>
        public async Task <OutputBase> Add(AddHandRingInput input)
        {
            if (await _patientRepository.GetPatientById(input.PatientId) == null)
            {
                return(OutputBase.Fail("患者不存在"));
            }

            foreach (var item in input.HandRingList)
            {
                if (!await _repository.IsExsit(input.PatientId, item.Date))
                {
                    var entity = new HandRing
                    {
                        Date      = item.Date,
                        Distance  = item.Distance,
                        Energy    = item.Energy,
                        SleepTime = item.SleepTime,
                        Steps     = item.Steps,
                        PatientId = input.PatientId
                    };

                    _repository.Add(entity);
                }
            }
            return(_unitWork.Commit() ? OutputBase.Success("保存成功") : OutputBase.Fail("保存失败"));
        }
Пример #4
0
        /// <summary>
        /// 更新患者
        /// </summary>
        /// <param name="input">患者信息</param>
        /// <returns>是否成功</returns>
        public async Task <OutputBase> Update(AdminPatientDto input)
        {
            var patientContact = await _repository.GetPatientCotactById(input.Id);

            if (input.Phone != patientContact.MobilePhone && await _repository.GetPatientCotactByPhone(input.Phone) != null)
            {
                return(OutputBase.Fail("该手机号已经注册"));
            }

            var patient = new Patient
            {
                Id          = input.Id,
                Brithdate   = input.Brithdate,
                DoctorId    = input.DoctorId == -1 ? null : input.DoctorId,
                HospitalId  = input.HospitalId,
                PatientName = input.PatientName,
                PinyinCode  = Utility.GetFirstPY(input.PatientName),
                Remark      = input.Remark,
                Sex         = input.Sex,
                UserStatus  = input.UserStatus
            };
            await _repository.UpdatePatient(patient);

            var contact = new PatientContact
            {
                MobilePhone  = input.Phone,
                ContatctName = input.PatientName,
                //Password = input.Password,
                PatientId = input.Id
            };
            await _patientContactRepository.Update(contact);

            return(_unitWork.Commit() ? OutputBase.Success("更新成功") : OutputBase.Fail("更新失败"));
        }
        /// <summary>
        /// 新增血压
        /// </summary>
        /// <param name="input">新增血压请求</param>
        /// <returns></returns>
        public async Task <OutputBase> Add(AddBloodPressureInput input)
        {
            var patient = await _patientRepository.Get((int)input.PatientId);

            if (patient == null)
            {
                return(OutputBase.Fail("该患者不存在"));
            }

            var entity = new BloodPressure
            {
                DataSource                = input.DataSource,
                PatientId                 = input.PatientId,
                DiastolicPressure         = input.DiastolicPressure,
                DiastolicPressureIsNormal = ChronicDiseaseUtility.IsDiastolicPressureNormal(input.DiastolicPressure),
                SystolicPressure          = input.SystolicPressure,
                SystolicPressureIsNormal  = ChronicDiseaseUtility.IsSystolicPressureNormal(input.SystolicPressure),
                HeartRate                 = input.HeartRate,
                HeartRateIsNormal         = ChronicDiseaseUtility.IsHeartRateNormal(input.HeartRate)
            };

            _bloodPressureRepository.Add(entity);

            return(_unitWork.Commit() ? OutputBase.Success("已成功录入血压") : OutputBase.Fail("录入血压失败"));
        }
Пример #6
0
        /// <summary>
        /// 新增患者
        /// </summary>
        /// <param name="input">患者信息</param>
        /// <returns>是否成功</returns>
        public async Task <OutputBase> Add(AdminPatientDto input)
        {
            if (await _repository.GetPatientCotactByPhone(input.Phone) != null)
            {
                return(OutputBase.Fail("该手机号已经注册"));
            }

            var patient = new Patient
            {
                Brithdate         = input.Brithdate,
                DialysisPatientId = 0,//默认
                DoctorId          = input.DoctorId == -1 ? null : input.DoctorId,
                HospitalId        = input.HospitalId,
                PatientName       = input.PatientName,
                PinyinCode        = Utility.GetFirstPY(input.PatientName),
                Remark            = input.Remark,
                Sex        = input.Sex,
                UserStatus = input.UserStatus
            };
            var patientId = _repository.Add(patient);
            var contact   = new PatientContact
            {
                MobilePhone       = input.Phone,
                Relationship      = CommConstant.OneselfRelationship,
                ContatctName      = input.PatientName,
                DialysisContactId = 0,//默认
                HospitalId        = input.HospitalId,
                PatientId         = patientId
            };

            _patientContactRepository.Add(contact);

            return(_unitWork.Commit() ? OutputBase.Success("新增成功") : OutputBase.Fail("新增失败"));
        }
Пример #7
0
        /// <summary>
        /// 同步患者联系人(新增或修改)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <OutputBase> AddOrUpdate(AddPatientContactSync sync)
        {
            var patient = await _patientRepository.Get(sync.DialysisPatientId, sync.HospitalId);

            if (patient == null)
            {
                return(OutputBase.Fail("不存在该患者"));
            }

            var patientContact = await _repository.Get(sync.DialysisContactId, sync.HospitalId);

            if (patientContact == null)
            {
                var entity = Mapper.Map <AddPatientContactSync, PatientContact>(sync);
                entity.PatientId = patient.Id;
                _repository.Add(entity);
            }
            else
            {
                patientContact.PatientId  = patient.Id;
                patientContact.UpdateTime = DateTime.Now;
                Mapper.Map(sync, patientContact);
            }

            return(_unitWork.Commit() ? OutputBase.Success("保存成功") : OutputBase.Fail("保存失败"));
        }
        /// <summary>
        /// 新增医护人员
        /// </summary>
        /// <param name="input">医护人员信息</param>
        /// <returns>是否成功</returns>
        public async Task <OutputBase> Add(AdminDoctorDto input)
        {
            if (await _repository.GetDoctorByPhone(input.Phone) != null)
            {
                return(OutputBase.Fail("该手机号已经注册"));
            }

            var doctor = new Doctor
            {
                Brithdate        = input.Brithdate,
                DeptId           = input.DeptId,
                HospitalId       = input.HospitalId,
                Name             = input.Name,
                Phone            = input.Phone,
                SelfDesc         = input.SelfDesc,
                Sex              = input.Sex,
                UserType         = input.UserType,
                TitleId          = input.TitleId,
                DialysisDoctorId = string.Empty,//默认
                IsDelete         = false
            };

            _repository.Add(doctor);

            return(_unitWork.Commit() ? OutputBase.Success("新增成功") : OutputBase.Fail("新增失败"));
        }
        /// <summary>
        /// 同步体重
        /// </summary>
        /// <param name="sync"></param>
        /// <returns></returns>
        public async Task <OutputBase> Add(AddWeightSync sync)
        {
            if (await _repository.IsExist(sync.DialysisWeightId, sync.HospitalId))
            {
                return(OutputBase.Fail("此体重数据已存在"));
            }

            var patient = await _patientRepository.Get(sync.DialysisPatientId, sync.HospitalId);

            if (patient == null)
            {
                return(OutputBase.Fail("此患者不存在"));
            }

            var weight = Mapper.Map <AddWeightSync, Weight>(sync);

            #region 兼容华墨数据,华墨数据库中测量方式透后为1,我们平台统一为2
            if (sync.MeasureType == 1)
            {
                weight.MeasureType = (int)MeasureTypeEnum.透后;
            }
            #endregion
            weight.PatientId = patient.Id;
            _repository.Add(weight);
            return(_unitWork.Commit() ? OutputBase.Success("保存成功") : OutputBase.Fail("保存失败"));
        }
Пример #10
0
        public void SchlangenArtV_BR()
        {
            var pxMap = new List <(int, int)>();

            OutputBase.GenerischeOrder(pxMap, 5, 4, PixelArrangement.SNV_BR);

            Assert.Equal((4, 3), pxMap[0]);
            Assert.Equal((4, 2), pxMap[1]);
            Assert.Equal((4, 1), pxMap[2]);
            Assert.Equal((4, 0), pxMap[3]);
            Assert.Equal((3, 0), pxMap[4]);
            Assert.Equal((3, 1), pxMap[5]);
            Assert.Equal((3, 2), pxMap[6]);
            Assert.Equal((3, 3), pxMap[7]);
            Assert.Equal((2, 3), pxMap[8]);
            Assert.Equal((2, 2), pxMap[9]);
            Assert.Equal((2, 1), pxMap[10]);
            Assert.Equal((2, 0), pxMap[11]);
            Assert.Equal((1, 0), pxMap[12]);
            Assert.Equal((1, 1), pxMap[13]);
            Assert.Equal((1, 2), pxMap[14]);
            Assert.Equal((1, 3), pxMap[15]);
            Assert.Equal((0, 3), pxMap[16]);
            Assert.Equal((0, 2), pxMap[17]);
            Assert.Equal((0, 1), pxMap[18]);
            Assert.Equal((0, 0), pxMap[19]);
        }
Пример #11
0
        /// <summary>
        /// Generates the warnings report.
        /// </summary>
        /// <param name="output">The output.</param>
        public void GenerateWarnings(OutputBase output)
        {
            output.Headline("Warnings");
            output.EmptyLine();
            output.CommentLine("Total number of warnings: " + GetNumberOfWarnings());


            if (IsFirstPhaseStarted)
            {
                output.CommentLine("Number of analysis warnings in the first phase: " + (analysisWarnings.Count));
                output.CommentLine("Number of security warnings in the first phase: " + (securityWarnings.Count));
            }
            if (IsSecondPhaseStarted)
            {
                output.CommentLine("Number of warnings in the second phase: " + secondPhaseWarnings.Count);
            }

            if (IsFirstPhaseStarted)
            {
                GenerateWarningsOutput(output, analysisWarnings, "First phase analysis warnings");
                GenerateWarningsOutput(output, securityWarnings, "First phase security warnings");
            }
            if (IsSecondPhaseStarted)
            {
                GenerateWarningsOutput(output, secondPhaseWarnings, "Second phase analysis warnings", true);
            }
        }
Пример #12
0
        public void ReMapSubPixelTest()
        {
            byte R = 88, G = 55, B = 44;

            (byte, byte, byte)RGBPx = (R, G, B);

            // interner Test:
            Assert.NotEqual(R, G);
            Assert.NotEqual(R, B);
            Assert.NotEqual(G, B);

            // Reihenfolge RGB - unverändert
            var erg1 = OutputBase.ReMapSubPixel(RGBPx, SubPixelOrder.RGB);

            Assert.Equal((R, G, B), erg1);

            // Reihenfolge BGR - verändert
            var erg2 = OutputBase.ReMapSubPixel(RGBPx, SubPixelOrder.BGR);

            Assert.Equal((B, G, R), erg2);

            // Reihenfolge GRB - verändert
            var erg3 = OutputBase.ReMapSubPixel(RGBPx, SubPixelOrder.GRB);

            Assert.Equal((G, R, B), erg3);
        }
Пример #13
0
        public void MappedOutputTest()
        {
            // Test: R ist 0, G ist 0,5 und B ist 1.
            RGBPixel[,] px = { { new RGBPixel(0f, 0.5f, 1f), new RGBPixel(0f, 0.5f, 1f) },
                               { new RGBPixel(0f, 0.5f, 1f), new RGBPixel(0f, 0.5f, 1f) } };

            var pxMap = new List <(int, int)>();

            OutputBase.GenerischeOrder(pxMap, 2, 2, PixelArrangement.LNH_TL);

            byte[] erg = OutputBase.MappedOutput(pxMap, px, SubPixelOrder.RGB);
            // Prüfe, ob auch die Reihenfolge oben beibehalten wurde
            Assert.Equal(0, erg[0]);
            Assert.Equal(127, erg[1]);
            Assert.Equal(255, erg[2]);
            Assert.Equal(0, erg[3]);
            Assert.Equal(127, erg[4]);
            Assert.Equal(255, erg[5]);
            Assert.Equal(0, erg[6]);
            Assert.Equal(127, erg[7]);
            Assert.Equal(255, erg[8]);
            Assert.Equal(0, erg[9]);
            Assert.Equal(127, erg[10]);
            Assert.Equal(255, erg[11]);
        }
Пример #14
0
        private static void writeFields(string name, object obj, System.Type c, Dictionary <Ice.Object, object> objectTable,
                                        OutputBase output)
        {
            if (!c.Equals(typeof(object)))
            {
                //
                // Write the superclass first.
                //
                writeFields(name, obj, c.BaseType, objectTable, output);

                //
                // Write the declared fields of the given class.
                //
                FieldInfo[] fields =
                    c.GetFields(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);

                for (int i = 0; i < fields.Length; i++)
                {
                    string fieldName = (name != null ? name + '.' + fields[i].Name : fields[i].Name);

                    try
                    {
                        object val = fields[i].GetValue(obj);
                        writeValue(fieldName, val, objectTable, output);
                    }
                    catch (System.UnauthorizedAccessException)
                    {
                        Debug.Assert(false);
                    }
                }
            }
        }
Пример #15
0
        public void Set_Filename(string name)
        {
            var obj = new OutputBase();

            Assert.IsNotNull(obj);
            obj.Filename = name;
            Assert.AreEqual(name, obj.Filename);
        }
        /// <summary>
        /// 删除医院
        /// </summary>
        /// <param name="id">医院Id</param>
        /// <returns>是否成功</returns>
        public OutputBase Delete(long id)
        {
            //if (await _repository.GetHospitalById(id) == null)
            //    return OutputBase.Fail("该医院已删除");
            _repository.Delete(id);

            return _unitWork.Commit() ? OutputBase.Success("删除成功") : OutputBase.Fail("删除失败");
        }
Пример #17
0
        public void Set_Running(bool running)
        {
            var obj = new OutputBase();

            Assert.IsNotNull(obj);
            obj.Running = running;
            Assert.AreEqual(running, obj.Running);
        }
Пример #18
0
        public void Set_Pos(int pos)
        {
            var obj = new OutputBase();

            Assert.IsNotNull(obj);
            obj.Pos = pos;
            Assert.AreEqual(pos, obj.Pos);
        }
Пример #19
0
 private static void writeName(string name, OutputBase output)
 {
     if (name != null)
     {
         output.nl();
         output.print(name + " = ");
     }
 }
        /// <summary>
        /// 新增血压
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public OutputBase Add(AddBloodPressureInput input)
        {
            var bloodPressure = Mapper.Map <AddBloodPressureInput, BloodPressure>(input);

            bloodPressure.MeasureType   = (int)MeasureTypeEnum.日常;
            bloodPressure.MeasureMethod = (int)MeasureMethodEnum.App;
            _repository.Add(bloodPressure);
            return(_unitWork.Commit() ? OutputBase.Success("保存成功") : OutputBase.Fail("保存失败"));
        }
Пример #21
0
        /// <summary>
        /// Generates the warnings output.
        /// </summary>
        /// <typeparam name="T">Type of the warning</typeparam>
        /// <param name="output">The output.</param>
        /// <param name="warnings">The warnings.</param>
        /// <param name="headLine">The head line.</param>
        /// <param name="displayTaintFlows">if set to <c>true</c> the display taint flows.</param>
        public void GenerateWarningsOutput <T>(OutputBase output, IReadOnlyCollection <T> warnings, string headLine, bool displayTaintFlows = false) where T : AnalysisWarning
        {
            output.line();
            output.Headline(headLine);
            if (warnings.Count == 0)
            {
                output.line();
                output.comment("No warnings");
                output.line();
            }
            string fileName = "/";
            bool   dedent   = false;

            foreach (var s in warnings)
            {
                if (fileName != s.FullFileName)
                {
                    if (dedent)
                    {
                        output.Dedent();
                    }
                    output.line();
                    fileName = s.FullFileName;
                    output.head2("File: " + fileName);

                    output.Indent();
                    dedent = true;

                    output.line();
                    output.line();
                }
                output.variableInfoLine(s.ToString());
                output.Indent();
                output.line();
                output.hint("Called from: ");
                output.comment(s.ProgramPoint.OwningPPGraph.Context.ToString());
                if (s is AnalysisTaintWarning && displayTaintFlows)
                {
                    output.line();
                    output.hint("Taint propagation: ");
                    output.Indent();
                    output.line();
                    output.comment(((AnalysisTaintWarning)(object)s).TaintFlow);
                    output.Dedent();
                }
                output.Dedent();

                output.line();
            }

            if (dedent)
            {
                output.Dedent();
            }
            output.line();
        }
Пример #22
0
        public void Create()
        {
            var obj = new OutputBase();

            Assert.IsNotNull(obj);
            Assert.IsNull(obj.Filename);

            Assert.AreEqual(default(int), obj.Pos);
            Assert.AreEqual(false, obj.Running);
        }
        /// <summary>
        /// 新增体重
        /// </summary>
        /// <param name="input">体重输入</param>
        /// <returns>是否成功</returns>
        public OutputBase Add(AddWeightInput input)
        {
            var weight      = Mapper.Map <AddWeightInput, Weight>(input);
            var measureTime = DateTime.Now;

            weight.MeasureTime = measureTime;
            _repository.Add(weight);

            return(_unitWork.Commit() ? OutputBase.Success("新增报警记录成功") : OutputBase.Fail("新增报警记录失败"));
        }
        private void Init(string config_path)
        {
            var config_instance = Config.LoadPPShowConfig(config_path);

            ListenOfs = new List <OutputWrapper>();
            PlayOfs   = new List <OutputWrapper>();

            foreach (var o in config_instance.output_list)
            {
                PlayOfs.Add(new OutputWrapper
                {
                    formatter = new OutputFormatter(o.output_format),
                    outputter = OutputBase.Create(o.output_file)
                });
            }

            foreach (var o in config_instance.listen_list)
            {
                ListenOfs.Add(new OutputWrapper
                {
                    formatter = new OutputFormatter(o.output_format),
                    outputter = OutputBase.Create(o.output_file)
                });
            }

            List <float> acc_list = new List <float>();

            foreach (var o in ListenOfs)
            {
                acc_list = acc_list.Concat(
                    from n in o.formatter.GetAccuracyArray()
                    where !acc_list.Contains(n)
                    select n
                    ).ToList();
            }

            foreach (var o in PlayOfs)
            {
                acc_list = acc_list.Concat(
                    from n in o.formatter.GetAccuracyArray()
                    where !acc_list.Contains(n)
                    select n
                    ).ToList();
            }

            if (acc_list.Count == 0)
            {
                Log.Warn("No pp query in PPShowConfig.json,defualt add 100%acc to get info.");
                acc_list.Add(100);
            }

            InfoOutputter = new InfoOutputter(acc_list);

            InfoOutputter.OnOutputEvent += OnOutput;
        }
        /// <summary>
        /// 保存患教
        /// </summary>
        /// <param name="input">患教输入</param>
        /// <returns>是否保存成功</returns>
        public async Task <OutputBase> Add(AddPatientEduInput input)
        {
            var doctor = await _doctorRepository.GetDoctorById(input.DoctorId);

            if (doctor == null)
            {
                return(OutputBase.Fail("医生Id参数不正确,该医护人员不存在"));
            }
            if (input.PatientIds.Count < 1)
            {
                return(OutputBase.Fail("患者Id数组参数个数不能为0"));
            }
            if (input.CourseList.Count < 1)
            {
                return(OutputBase.Fail("课程列表参数个数不能为0"));
            }
            string content = string.Format("{0}医生向您发送了新的课程", doctor.Name);

            var patientEduList = new List <PatientEducation>();

            foreach (var patientId in input.PatientIds)
            {
                var batchNumber = DateTime.Now.ToString(CommConstant.FullTimeFormatString);
                foreach (var course in input.CourseList)
                {
                    _repository.Add(course, patientId, input.DoctorId, batchNumber);
                }

                var messageEntity = new Message
                {
                    IsRead    = false,
                    OuterId   = batchNumber + input.DoctorId.ToString().PadLeft(18, '0') + patientId.ToString().PadLeft(18, '0'),
                    Content   = content,
                    ReceiveId = patientId,
                    Title     = "患教课程",
                    Type      = (int)MessageTypeEnum.患教课程,
                    SendId    = input.DoctorId,
                    SendName  = doctor.Name,
                    Url       = string.Empty,
                    AppType   = (int)AppTypeEnum.Patient
                };
                _messageRepository.Add(messageEntity);

                #region 异步发送JPush Notification、Message
                ThreadPool.QueueUserWorkItem(delegate
                {
                    new JPushMessage(AppTypeEnum.Patient, (int)JPushKeyEnum.PatientEducation, patientId.ToString(), content, messageEntity.OuterId, _optionsAccessor.IsDevModel).SendPush();
                    new JPushNotification(AppTypeEnum.Patient, (int)JPushKeyEnum.PatientEducation, patientId.ToString(), content, messageEntity.OuterId, _optionsAccessor.IsDevModel).SendPush();
                });
                #endregion
            }

            return(_unitWork.Commit() ? OutputBase.Success("保存成功") : OutputBase.Fail("保存失败"));
        }
Пример #26
0
        /// <summary>
        /// Rung graph walking with printing info into given output
        /// </summary>
        /// <param name="output">Output for info generated when walking graph</param>
        public void Run(OutputBase output)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            Output = output;
            var visitedPoints = new HashSet <ProgramPointBase>();

            walkCall(_entryGraph, visitedPoints);
        }
Пример #27
0
        /// <summary>
        /// 同步透析下机
        /// </summary>
        /// <param name="sync"></param>
        /// <returns></returns>
        public async Task <OutputBase> AddDialysisOff(AddDialysisOffSync sync)
        {
            var dialysis = await _repository.Get(sync.DialysisRecordId, sync.HospitalId);

            if (dialysis == null)
            {
                return(OutputBase.Fail("不存在透析上机记录"));
            }

            dialysis.ConfirmedUFV         = sync.ConfirmedUFV;
            dialysis.StartTime            = sync.StartTime;
            dialysis.OffSystolicPressure  = sync.OffSystolicPressure;
            dialysis.OffDiastolicPressure = sync.OffDiastolicPressure;
            dialysis.OffPulseRate         = sync.OffPulseRate;
            dialysis.OffBreath            = sync.OffBreath;
            dialysis.PostWeight           = sync.PostWeight;
            dialysis.ActualUFV            = sync.ActualUFV;
            dialysis.EndTime  = sync.EndTime;
            dialysis.OffNurse = sync.OffNurse;
            dialysis.Summary  = sync.Summary;

            #region 添加下机Message
            var endTime = sync.EndTime.GetValueOrDefault();
            var content = string.Format("下机时间: {0}", endTime.ToString(CommConstant.TimeFormatString));
            var message = new Domain.Models.Message
            {
                AppType   = (int)AppTypeEnum.Patient,
                Content   = content,
                IsRead    = false,
                ReceiveId = dialysis.PatientId,
                SendId    = 0,
                SendName  = "系统",
                Title     = "透析前下机测量",
                Type      = (int)MessageTypeEnum.透析下机,
                OuterId   = dialysis.Id.ToString()
            };
            _messageRepository.Add(message);
            #endregion

            if (!_unitWork.Commit())
            {
                OutputBase.Fail("保存失败");
            }

            #region 向患者端异步发送下机JPush
            ThreadPool.QueueUserWorkItem(delegate
            {
                new JPushMessage(AppTypeEnum.Patient, (int)JPushKeyEnum.DialysisOff, dialysis.PatientId.ToString(), content, dialysis.Id.ToString(), _optionsAccessor.IsDevModel).SendPush();
                new JPushNotification(AppTypeEnum.Patient, (int)JPushKeyEnum.DialysisOff, dialysis.PatientId.ToString(), content, dialysis.Id.ToString(), _optionsAccessor.IsDevModel).SendPush();
            });
            #endregion

            return(OutputBase.Success("保存成功"));
        }
        /// <summary>
        /// 删除医护人员
        /// </summary>
        /// <param name="dialysisDoctorId">透析医护人员Id(华墨系统Id)</param>
        /// <param name="hospitalId">医院Id</param>
        /// <returns>是否保存成功</returns>
        public async Task <OutputBase> DeleteDoctor(long hospitalId, string dialysisDoctorId)
        {
            var doctor = await _repository.Get(dialysisDoctorId, hospitalId);

            if (doctor == null)
            {
                return(OutputBase.Fail("该医生不存在"));
            }
            _repository.Delete(doctor);
            return(_unitWork.Commit() ? OutputBase.Success("删除成功") : OutputBase.Fail("该医生不存在"));
        }
        /// <summary>
        /// 更新课程类别
        /// </summary>
        /// <param name="model">课程类别信息</param>
        /// <returns>是否成功</returns>
        public async Task <OutputBase> Update(AdminCourseCategoryDto model)
        {
            var entity = new Dictionary
            {
                Description = model.Description,
                Name        = model.Name,
                Id          = model.Id
            };
            await _systemRepository.UpdateDictionary(entity);

            return(_unitWork.Commit() ? OutputBase.Success("更新课程类别成功") : OutputBase.Fail("更新课程类别失败"));
        }
Пример #30
0
        /// <summary>
        /// 新增患者
        /// </summary>
        /// <param name="input">患者信息</param>
        /// <returns>是否成功</returns>
        public OutputBase Add(AdminPatientDto input)
        {
            var patient = new Patient
            {
                Brithdate   = input.Brithdate,
                PatientName = input.PatientName,
                Sex         = input.Sex,
            };
            var patientId = _repository.Add(patient);

            return(_unitWork.Commit() ? OutputBase.Success("新增成功") : OutputBase.Fail("新增失败"));
        }