Esempio n. 1
0
        public BaseResponse UpdateAppHospCertInfo(RegNCIInfo request)
        {
            var response = new BaseResponse();
            var caretype = Convert.ToInt16(request.Caretypeid);
            var appHosp  = unitOfWork.GetRepository <NCIA_APPHOSP>().dbSet.Where(x => x.ENTRYTIME == request.ApplyHosTime && x.ISDELETE != true && x.IDNO.ToUpper().Trim() == request.IdNo.ToUpper().Trim() && x.AGENCYRESULT == (int)ApplicationEnum.ExaminationPassed && x.CARETYPE == caretype).FirstOrDefault();

            appHosp.ISDELETE   = true;
            appHosp.UPDATEBY   = "结案作业";
            appHosp.UPDATETIME = DateTime.Now;
            appHosp.LEAVETIME  = request.ipdoutTime;
            unitOfWork.GetRepository <NCIA_APPHOSP>().Update(appHosp);

            var nursingHomeAsstRecord = unitOfWork.GetRepository <NCIA_APPLICANT>().dbSet.FirstOrDefault(m => m.IDNO.ToUpper().Trim() == request.IdNo.ToUpper().Trim() && m.ISDELETE != true);

            nursingHomeAsstRecord.LASTHOSPRESULT = (int)ApplicationEnum.AuditNotPassed;
            unitOfWork.GetRepository <NCIA_APPLICANT>().Update(nursingHomeAsstRecord);

            var supervise = unitOfWork.GetRepository <NCI_SUPERVISE>().dbSet.Where(x => x.APPCERTID == appHosp.APPCERTID && appHosp.APPHOSPID == appHosp.APPHOSPID && x.VALID == true).FirstOrDefault();

            if (supervise != null)
            {
                supervise.VALID = false;
                unitOfWork.GetRepository <NCI_SUPERVISE>().Update(supervise);
                NCI_SUPERVISE model = new NCI_SUPERVISE();
                model.APPCERTID  = appHosp.APPCERTID;
                model.APPHOSPID  = appHosp.APPHOSPID;
                model.REASON     = "结案作业取消资格";
                model.STATUS     = 1;
                model.VALID      = true;
                model.CREATEBY   = "API";
                model.CREATETIME = DateTime.Now;
                unitOfWork.GetRepository <NCI_SUPERVISE>().Insert(model);
            }
            else
            {
                NCI_SUPERVISE model = new NCI_SUPERVISE();
                model.APPCERTID  = appHosp.APPCERTID;
                model.APPHOSPID  = appHosp.APPHOSPID;
                model.REASON     = "结案作业取消资格";
                model.STATUS     = 1;
                model.VALID      = true;
                model.CREATEBY   = "API";
                model.CREATETIME = DateTime.Now;
                unitOfWork.GetRepository <NCI_SUPERVISE>().Insert(model);
            }
            unitOfWork.Save();
            return(response);
        }
Esempio n. 2
0
        public BaseResponse UpdateYearCert(AuditYearCertModel request)
        {
            var response = new BaseResponse();

            if (request.HospStatus == 6 && request.CertStatus == 6)  //  强制修改护理险资格为无效
            {
                var appcert = unitOfWork.GetRepository <NCIA_APPCERT>().dbSet.Where(x => x.CERTNO == request.CertNo && x.APPCERTID == request.CertAppcertid && x.ISDELETE != true).FirstOrDefault();
                appcert.STATUS     = 9;
                appcert.UPDATETIME = DateTime.Now;
                unitOfWork.GetRepository <NCIA_APPCERT>().Update(appcert);

                var appHosp = unitOfWork.GetRepository <NCIA_APPHOSP>().dbSet.Where(x => x.ENTRYTIME == request.Entrytime && x.APPHOSPID == request.AppHospid && x.ISDELETE != true).FirstOrDefault();
                appHosp.UPDATETIME   = DateTime.Now;
                appHosp.AGENCYRESULT = 9;
                unitOfWork.GetRepository <NCIA_APPHOSP>().Update(appHosp);

                var nursingHomeAsstRecord = unitOfWork.GetRepository <NCIA_APPLICANT>().dbSet.FirstOrDefault(m => m.IDNO == request.IdNo && m.ISDELETE != true);
                nursingHomeAsstRecord.LASTCERTRESULT = (int)ApplicationEnum.AuditNotPassed;
                nursingHomeAsstRecord.LASTHOSPRESULT = (int)ApplicationEnum.AuditNotPassed;
                unitOfWork.GetRepository <NCIA_APPLICANT>().Update(nursingHomeAsstRecord);

                var supervise = unitOfWork.GetRepository <NCI_SUPERVISE>().dbSet.Where(x => x.APPCERTID == request.CertAppcertid && appHosp.APPHOSPID == request.AppHospid && x.VALID == true).FirstOrDefault();
                if (supervise != null)
                {
                    supervise.VALID = false;
                    unitOfWork.GetRepository <NCI_SUPERVISE>().Update(supervise);
                    NCI_SUPERVISE model = new NCI_SUPERVISE();
                    model.APPCERTID  = request.CertAppcertid;
                    model.APPHOSPID  = request.AppHospid;
                    model.REASON     = request.Reason;
                    model.STATUS     = 1;
                    model.VALID      = true;
                    model.CREATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    model.CREATETIME = DateTime.Now;
                    unitOfWork.GetRepository <NCI_SUPERVISE>().Insert(model);
                }
                else
                {
                    NCI_SUPERVISE model = new NCI_SUPERVISE();
                    model.APPCERTID  = request.CertAppcertid;
                    model.APPHOSPID  = request.AppHospid;
                    model.REASON     = request.Reason;
                    model.STATUS     = 1;
                    model.VALID      = true;
                    model.CREATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    model.CREATETIME = DateTime.Now;
                    unitOfWork.GetRepository <NCI_SUPERVISE>().Insert(model);
                }
            }
            else if (request.CertStatus == 9 && request.HospStatus == 9)
            {
                var appcert = unitOfWork.GetRepository <NCIA_APPCERT>().dbSet.Where(x => x.CERTNO == request.CertNo && x.APPCERTID == request.CertAppcertid && x.ISDELETE != true).FirstOrDefault();
                appcert.UPDATETIME = DateTime.Now;
                appcert.STATUS     = 6;
                unitOfWork.GetRepository <NCIA_APPCERT>().Update(appcert);

                var appHosp = unitOfWork.GetRepository <NCIA_APPHOSP>().dbSet.Where(x => x.ENTRYTIME == request.Entrytime && x.APPHOSPID == request.AppHospid && x.ISDELETE != true).FirstOrDefault();
                appHosp.UPDATETIME   = DateTime.Now;
                appHosp.AGENCYRESULT = 6;
                unitOfWork.GetRepository <NCIA_APPHOSP>().Update(appHosp);
                var nursingHomeAsstRecord = unitOfWork.GetRepository <NCIA_APPLICANT>().dbSet.FirstOrDefault(m => m.IDNO == request.IdNo && m.ISDELETE != true);
                nursingHomeAsstRecord.LASTCERTRESULT = (int)ApplicationEnum.ExaminationPassed;
                nursingHomeAsstRecord.LASTHOSPRESULT = (int)ApplicationEnum.ExaminationPassed;
                unitOfWork.GetRepository <NCIA_APPLICANT>().Update(nursingHomeAsstRecord);

                var supervise = unitOfWork.GetRepository <NCI_SUPERVISE>().dbSet.Where(x => x.APPCERTID == request.CertAppcertid && appHosp.APPHOSPID == request.AppHospid && x.VALID == true).FirstOrDefault();
                if (supervise != null)
                {
                    supervise.VALID = false;
                    unitOfWork.GetRepository <NCI_SUPERVISE>().Update(supervise);

                    NCI_SUPERVISE model = new NCI_SUPERVISE();
                    model.APPCERTID  = request.CertAppcertid;
                    model.APPHOSPID  = request.AppHospid;
                    model.REASON     = request.Reason;
                    model.STATUS     = 0;
                    model.VALID      = true;
                    model.CREATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    model.CREATETIME = DateTime.Now;
                    unitOfWork.GetRepository <NCI_SUPERVISE>().Insert(model);
                }
                else
                {
                    NCI_SUPERVISE model = new NCI_SUPERVISE();
                    model.APPCERTID  = request.CertAppcertid;
                    model.APPHOSPID  = request.AppHospid;
                    model.REASON     = request.Reason;
                    model.STATUS     = 0;
                    model.VALID      = true;
                    model.CREATEBY   = SecurityHelper.CurrentPrincipal.EmpNo;
                    model.CREATETIME = DateTime.Now;
                    unitOfWork.GetRepository <NCI_SUPERVISE>().Insert(model);
                }
            }

            unitOfWork.Save();
            return(response);
        }