Example #1
0
        public int SaveBjcaSign(MED_BJCA_SIGN item)
        {
            int result = dapper.Set <MED_BJCA_SIGN>().Save(item) == true ? 1 : 0;

            dapper.SaveChanges();

            return(result);
        }
Example #2
0
        /// <summary>
        /// 保存CA数据
        /// </summary>
        private void OnCustomSave(object sender, EventArgs e)
        {
            if (sender is MED_BJCA_SIGN)
            {
                MED_BJCA_SIGN curCA = sender as MED_BJCA_SIGN;

                string patientId = ExtendApplicationContext.Current.PatientContextExtend.PatientID;
                int    visitId   = ExtendApplicationContext.Current.PatientContextExtend.VisitID;
                int    operId    = ExtendApplicationContext.Current.PatientContextExtend.OperID;

                // 获取最新的CA数据
                curCA.PATIENT_ID  = patientId;
                curCA.VISIT_ID    = visitId;
                curCA.OPER_ID     = operId;
                curCA.SIGNDOCNAME = DocName;//ExtendApplicationContext.Current.CurrentDocName;
                curCA.SIGNDATE    = AccountService.GetServerTime();
                CommonService.SaveBjcaSign(curCA);
            }
        }
Example #3
0
        /// <summary>
        /// 保存CA数据
        /// </summary>
        private void OnCustomSave(object sender, EventArgs e)
        {
            if (sender is MED_BJCA_SIGN)
            {
                MED_BJCA_SIGN curCA = sender as MED_BJCA_SIGN;

                string patientId = ExtendAppContext.Current.PatientInformationExtend.PATIENT_ID;
                int    visitId   = ExtendAppContext.Current.PatientInformationExtend.VISIT_ID;
                int    operId    = ExtendAppContext.Current.PatientInformationExtend.OPER_ID;

                // 获取最新的CA数据
                curCA.PATIENT_ID  = patientId;
                curCA.VISIT_ID    = visitId;
                curCA.OPER_ID     = operId;
                curCA.SIGNDOCNAME = ExtendAppContext.Current.CurrentDocName;
                curCA.SIGNDATE    = CommonService.ClientInstance.GetServerTime();
                curCA.ModelStatus = AnesWorkStation.Domain.ModelStatus.Add;
                CareDocService.ClientInstance.SaveBjcaSign(curCA);
            }
        }
Example #4
0
        public RequestResult <int> SaveBjcaSign(MED_BJCA_SIGN item)
        {
            string address = "PacuCommon/SaveBjcaSign";

            return(BaseRepository.PostCallApi <MED_BJCA_SIGN>(address, item));
        }
Example #5
0
 public RequestResult <bool> SaveBjcaSign(MED_BJCA_SIGN row)
 {
     return(Success(_careDocService.SaveBjcaSign(row)));
 }
Example #6
0
        /// <summary>
        /// 执行签名
        /// </summary>
        private bool SignData()
        {
            _docDataStr = GetDocControlString();
            BJCA_TS_CLIENTCOMLib.BJCATSEngine tss = new BJCA_TS_CLIENTCOMLib.BJCATSEngine(); //加盖时间戳控件
            string signvalue = axXTXApp1.SOF_SignData(this._containerName, _docDataStr);     //2.对原文 进行签名;
            // string signvalue = @"MEUCIA+dyFVNMDOm03hfzm7vMjur0OCx08PW3SOcMMEfu0G2AiEAqF9jUD5arcpj/BExl3uMYmb1UQdW2D6bhTM89HEX+Rg=";
            string time_req       = tss.CreateTimeStampRequest(_docDataStr);                 //3.获取时间戳请求;
            string timestampValue = tss.CreateTimeStamp(time_req);                           //4.加盖时间戳。
            string usercert       = axXTXApp1.SOF_ExportUserCert(_containerName);
            string certSN         = axXTXApp1.SOF_GetCertInfo(usercert, 2);                  //客户端证书编号,certSN;--电子签名验证时需要。
            string controlID      = this.Name;
            string end            = axXTXApp1.SOF_GetCertInfo(usercert, 12);

            end = end.Substring(0, 4) + '-' + end.Substring(4, 2) + '-' + end.Substring(6, 2);
            DateTime endDate = Convert.ToDateTime(end);
            DateTime curDate = DateTime.Now;
            int      day     = ((TimeSpan)(endDate - curDate)).Days;

            if (day < 0)
            {
                day = Math.Abs(day);
                Dialog.MessageBox("您的证书已经过期" + day + "天,请联系管理员更新证书!");
                return(false);
            }
            else if (day <= 3)
            {
                if (day == 0)
                {
                    Dialog.MessageBox("您的证书明天过期,请及时联系管理员更新证书!");
                }
                else
                {
                    Dialog.MessageBox("您的证书还有" + day + "天过期,请及时联系管理员更新证书!");
                }
            }
            if (string.IsNullOrEmpty(time_req))
            {
                time_req       = "0";
                timestampValue = "0";
            }
            if (string.IsNullOrEmpty(signvalue))//|| string.IsNullOrEmpty(time_req)
            {
                Dialog.MessageBox("无法连接数字签名服务器,请联系管理员!");
                return(false);
            }

            if (null != this.OnCustomSave)
            {
                MED_BJCA_SIGN curCA = new MED_BJCA_SIGN()
                {
                    SIGNID         = Guid.NewGuid().ToString(),
                    SIGNNAME       = _certname,
                    SIGNTYPE       = 0,
                    CERTSN         = certSN,
                    SIGNVALUE      = StringHelper.Str2Arr(signvalue),
                    TIMESTAMPVALUE = StringHelper.Str2Arr(timestampValue),
                    SIGNCERT       = StringHelper.Str2Arr(usercert),
                    SIGNIMAGE      = StringHelper.Str2Arr(ImageBase64),
                    ORGDATA        = StringHelper.Str2Arr(_docDataStr),
                    CONTROLID      = controlID,
                };

                try
                {
                    // 将数据保存的操作放到handle中
                    this.OnCustomSave(curCA, null);
                }
                catch (Exception ex)
                {
                    MedicalSystem.Anes.Core.Log.LogHelper.WriteErrLog("保存签名图片失败", ex);
                    Dialog.MessageBox("保存签名图片失败!");
                    return(false);
                }
            }

            return(true);
        }
Example #7
0
        /// <summary>
        /// 保存签名数据
        /// </summary>
        /// <param name="patientId"></param>
        /// <param name="visitId"></param>
        /// <param name="operId"></param>
        /// <param name="signDocName"></param>
        /// <param name="controlId"></param>
        /// <param name="signImage"></param>
        /// <returns></returns>
        public int SaveSignData(string patientId, decimal visitId, decimal operId, string signDocName, string signName, string controlId, string signImage)
        {
            int result = 0;

            try
            {
                MED_BJCA_SIGN bjcaSign = new MED_BJCA_SIGN();

                //保证GUID 唯一
                do//先执行一次,再判断。
                {
                    bjcaSign.SIGNID = Guid.NewGuid().ToString();

                    bjcaSign.SIGNNAME = signName;

                    bjcaSign.SIGNDOCNAME = signDocName;

                    bjcaSign.SIGNDATE = DateTime.Now;

                    bjcaSign.SIGNTYPE = 0;

                    bjcaSign.CERTSN = null;

                    bjcaSign.SIGNVALUE = null;

                    bjcaSign.TIMESTAMPVALUE = null;

                    bjcaSign.SIGNCERT = null;

                    bjcaSign.SIGNIMAGE = Str2Arr(signImage);

                    bjcaSign.PATIENT_ID = patientId;

                    bjcaSign.VISIT_ID = (int)visitId;

                    bjcaSign.OPER_ID = (int)operId;

                    bjcaSign.ORGDATA = null;

                    bjcaSign.CONTROLID = controlId;
                }while (dapper.Set <MED_BJCA_SIGN>().Single(d => d.SIGNID == bjcaSign.SIGNID) != null);


                if (dapper.Set <MED_BJCA_SIGN>().Single(d => d.PATIENT_ID == bjcaSign.PATIENT_ID && d.VISIT_ID == bjcaSign.VISIT_ID &&
                                                        d.OPER_ID == bjcaSign.OPER_ID && d.OPER_ID == bjcaSign.OPER_ID && d.SIGNDOCNAME == bjcaSign.SIGNDOCNAME &&
                                                        d.CONTROLID == bjcaSign.CONTROLID) == null)
                {
                    result = dapper.Set <MED_BJCA_SIGN>().Insert(bjcaSign) ? 1 : 0;
                }
                else
                {
                    result = dapper.Set <MED_BJCA_SIGN>().Update(bjcaSign) > 0 ? 1 : 0;
                }

                dapper.SaveChanges();
            }
            catch (Exception ex)
            {
                Logger.Error("保存签名数据错误SaveSignData:", ex);
            }


            return(result);
        }
Example #8
0
 public RequestResult <int> SaveBjcaSign(MED_BJCA_SIGN item)
 {
     return(Success(_commonService.SaveBjcaSign(item)));
 }