/// <summary>
        /// 添加登记健康信息
        /// </summary>
        /// <param name="HealthInfoAddViewModel"></param>

        public void addHealthRegisterInfo(HealthInfoAddViewModel healthViewModel)
        {
            var insertInfo = _IMapper.Map <HealthInfoAddViewModel, StudentRegisterHeath_Info>(healthViewModel);

            healthRegisterRepository.Add(insertInfo);
            healthRegisterRepository.SaveChanges();                                           //保存数据
            //var insertHealth = healthRegisterRepository.getByidNumber(insertInfo.Idnumber);//查询插入的 mapper中加密
            var facultystaff = facultystaffInfoRepository.getByidNumber(insertInfo.Idnumber); //查询白绑定的基础信息

            if (facultystaff != null)                                                         //不为空复制键值
            {
                facultystaff.StudentRegisterHeath_InfoId = insertInfo.id;
                facultystaffInfoRepository.Update(facultystaff);
            }
            else
            {
                var studentInfo = studentInfoRepository.getByidNumber(insertInfo.Idnumber);
                if (studentInfo != null)
                {
                    studentInfo.StudentRegisterHeath_InfoId = insertInfo.id;
                    studentInfoRepository.Update(studentInfo);
                }
            }
            healthRegisterRepository.SaveChanges();
        }
        //Except_Info_Employ
        public void addExceptEmployService(ExceptEmployAddViewModel exceptEmployAddViewModel)
        {
            var insertmodel = _IMapper.Map <ExceptEmployAddViewModel, Except_Info_Employ>(exceptEmployAddViewModel);
            var employinfo  = facultystaffInfoRepository.getByidNumber(Dtol.Helper.MD5.Md5Hash(exceptEmployAddViewModel.Idnumber));

            insertmodel.facultystaff_InfoId = employinfo.id;
            exceptEmployRepository.Add(insertmodel);
            exceptEmployRepository.SaveChanges();


            //判断是否是教师  当教师发生异常,则提醒:分管领导(教务主任)、校医
            //如果是  后勤、食堂人员身体异常,则提醒:分管领导(总务主任)、校医、

            string StaffCode = employinfo.StaffCode;
            List <ExpectBindMsgModel> lsits = new List <ExpectBindMsgModel>();

            if (!employinfo.DepartName.Contains("餐厅") && !employinfo.StaffName.Contains("物业"))
            {
                lsits = sQLRepository.GetJZGByStaffCode(StaffCode, " DepartName like '%教务主任%' or DepartName like '%校医%' ");
            }
            if (employinfo.DepartName.Contains("餐厅") || employinfo.StaffName.Contains("物业"))
            {
                lsits = sQLRepository.GetJZGByStaffCode(StaffCode, " DepartName like '%总务主任%' or DepartName like '%校医%' ");
            }


            foreach (var item in lsits)
            {
                string unionid       = item.unionid;
                string serviceOpenid = "";
                serviceOpenid = sQLRepository.GetOpenidByUnionid(unionid);
                if (!string.IsNullOrEmpty(serviceOpenid))
                {
                    SendMessageModel msg = new SendMessageModel();
                    msg.touser      = serviceOpenid;
                    msg.miniprogram = JsonConvert.DeserializeObject("{\"appid\":\"wx1b4d3e31ba3454d6\",\"pagepath\":\"pages/home/home\"}");
                    msg.template_id = "PLcY90Q4RtD8fDplfP-Vfh_8oVy7l4ABUtFmX_Tm9Jw";
                    msg.url         = "";
                    msg.data        = JsonConvert.DeserializeObject("{\"first\":{\"value\":\"" + item.name + ",你好!\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"根据本时段人员健康信息填报情况," +
                                                                    employinfo.StaffName + "岗位" + employinfo.Name + "出现身体异常情况,请予以重点关注。\",\"color\":\"#173177\"}," + "\"keyword2\":{\"value\":\"" + item.name + "\"," +
                                                                    "\"color\":\"#173177\"},\"remark\":{\"value\":\"请尽快处理。\",\"color\":\"#173177\"}}");

                    string postData = JsonConvert.SerializeObject(msg);
                    string url      = "https://tbl.bhteda.com/api/Message/SendMessageTest";

                    string abc = GetPage(url, postData);
                }
            }
        }
Beispiel #3
0
        public int SaveImageFileInfo(FileImageUploadViewModel fileUploadViewModel)
        {
            var UploadFile = _IMapper.Map <FileImageUploadViewModel, UserFiles_Info>(fileUploadViewModel);

            //验证身份证号存在
            var student = _studentInfoRepository.getByidNumber(Dtol.Helper.MD5.Md5Hash(fileUploadViewModel.Idnumber));

            var employ = _facultystaffInfoRepository.getByidNumber(Dtol.Helper.MD5.Md5Hash(fileUploadViewModel.Idnumber));

            if (student == null && employ == null)
            {
                return(0);
            }

            //先把图片上传上去
            _imageRepository.Add(UploadFile);
            _imageRepository.SaveChanges();

            return(UploadFile.id);
        }