/// <summary>
        /// 职工入院登记修改
        /// </summary>
        /// <param name="uiParam"></param>
        public void ModifyWorkerHospitalization(HospitalizationModifyUiParam uiParam)
        { //his登陆
            var userBase = _serviceBasicService.GetUserBaseInfo(uiParam.UserId);

            userBase.TransKey = uiParam.TransKey;
            var param = GetWorkerHospitalizationModify(uiParam, userBase);

            //医保执行
            _workerMedicalInsuranceRepository.ModifyWorkerHospitalization(param);
            // 回参构建
            var xmlData = new HospitalizationModifyXml()
            {
                MedicalInsuranceHospitalizationNo = param.MedicalInsuranceHospitalizationNo,
            };
            //var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            //var saveXml = new SaveXmlDataParam()
            //{
            //    User = param.User,
            //    MedicalInsuranceBackNum = "zyzlxgall",
            //    MedicalInsuranceCode = "23",
            //    BusinessId = param.BusinessId,
            //    BackParam = strXmlBackParam
            //};
            ////存基层
            //_webBasicRepository.SaveXmlData(saveXml);
            var paramStr  = "";
            var queryData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(
                new QueryMedicalInsuranceResidentInfoParam
            {
                BusinessId       = param.BusinessId,
                OrganizationCode = param.User.OrganizationCode
            });

            if (!string.IsNullOrWhiteSpace(queryData.AdmissionInfoJson))
            {
                var data =
                    JsonConvert.DeserializeObject <WorKerHospitalizationRegisterParam>(queryData
                                                                                       .AdmissionInfoJson);
                if (!string.IsNullOrWhiteSpace(param.AdmissionDate))
                {
                    data.AdmissionDate = param.AdmissionDate;
                }
                if (!string.IsNullOrWhiteSpace(param.AdmissionMainDiagnosis))
                {
                    data.AdmissionMainDiagnosis = param.AdmissionMainDiagnosis;
                }
                if (!string.IsNullOrWhiteSpace(param.AdmissionMainDiagnosisIcd10))
                {
                    data.AdmissionMainDiagnosisIcd10 = param.AdmissionMainDiagnosisIcd10;
                }
                if (!string.IsNullOrWhiteSpace(param.DiagnosisIcd10Three))
                {
                    data.DiagnosisIcd10Three = param.DiagnosisIcd10Three;
                }
                if (!string.IsNullOrWhiteSpace(param.DiagnosisIcd10Two))
                {
                    data.DiagnosisIcd10Two = param.DiagnosisIcd10Two;
                }
                if (!string.IsNullOrWhiteSpace(param.InpatientDepartmentCode))
                {
                    data.InpatientDepartmentCode = param.InpatientDepartmentCode;
                }
                if (!string.IsNullOrWhiteSpace(param.BedNumber))
                {
                    data.BedNumber = param.BedNumber;
                }
                data.Id  = queryData.Id;
                paramStr = JsonConvert.SerializeObject(data);
            }
            var saveData = new MedicalInsuranceDto
            {
                AdmissionInfoJson = paramStr,
                BusinessId        = queryData.BusinessId,
                Id       = queryData.Id,
                IsModify = true,
            };

            _medicalInsuranceSqlRepository.SaveMedicalInsurance(param.User, saveData);
            //日志
            var logParam = new AddHospitalLogParam();

            logParam.User            = param.User;
            logParam.RelationId      = queryData.Id;
            logParam.JoinOrOldJson   = queryData.AdmissionInfoJson;
            logParam.ReturnOrNewJson = paramStr;
            logParam.Remark          = "医保入院登记修改";
            _systemManageRepository.AddHospitalLog(logParam);
        }
        /// <summary>
        /// 门诊费用录入
        /// </summary>
        public OutpatientDepartmentCostInputDto OutpatientDepartmentCostInput(GetOutpatientPersonParam param)
        {
            OutpatientDepartmentCostInputDto resultData = null;
            //获取门诊病人数据
            var outpatientPerson = _serviceBasicService.GetOutpatientPerson(param);

            if (outpatientPerson == null)
            {
                throw new Exception("his中未获取到当前病人!!!");
            }
            //if (string.IsNullOrWhiteSpace(outpatientPerson.IdCardNo)) throw new Exception("当前病人的身份证号码不能为空!!!");
            var inputParam = new OutpatientDepartmentCostInputParam()
            {
                AllAmount    = outpatientPerson.MedicalTreatmentTotalCost,
                IdentityMark = param.IdentityMark,
                AfferentSign = param.AfferentSign,
                Operators    = param.User.UserName
            };

            //医保数据写入
            resultData = _outpatientDepartmentRepository.OutpatientDepartmentCostInput(inputParam);
            if (resultData == null)
            {
                throw new Exception("门诊费用医保执行失败!!!");
            }

            param.IsSave = true;
            param.Id     = Guid.NewGuid();
            //保存门诊病人
            _serviceBasicService.GetOutpatientPerson(param);
            //中间层数据写入
            var saveData = new MedicalInsuranceDto
            {
                AdmissionInfoJson = JsonConvert.SerializeObject(param),
                BusinessId        = param.UiParam.BusinessId,
                Id                                = Guid.NewGuid(),
                IsModify                          = false,
                InsuranceType                     = 999,
                MedicalInsuranceState             = MedicalInsuranceState.MedicalInsuranceHospitalized,
                MedicalInsuranceHospitalizationNo = resultData.DocumentNo,
                AfferentSign                      = param.AfferentSign,
                IdentityMark                      = param.IdentityMark
            };

            //存中间库
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(param.User, saveData);

            //日志写入
            _systemManageRepository.AddHospitalLog(new AddHospitalLogParam()
            {
                User            = param.User,
                JoinOrOldJson   = JsonConvert.SerializeObject(inputParam),
                ReturnOrNewJson = JsonConvert.SerializeObject(resultData),
                RelationId      = param.Id,
                BusinessId      = param.UiParam.BusinessId,
                Remark          = "[R][OutpatientDepartment]门诊病人结算"
            });
            //获取病人的基础信息
            var userInfoData = _residentMedicalInsuranceRepository.GetUserInfo(new ResidentUserInfoParam()
            {
                IdentityMark = param.IdentityMark,
                AfferentSign = param.AfferentSign,
            });
            //回参构建
            var xmlData = new OutpatientDepartmentCostXml()
            {
                AccountBalance = userInfoData.InsuranceType == "342" ? userInfoData.ResidentInsuranceBalance : userInfoData.WorkersInsuranceBalance,
                MedicalInsuranceOutpatientNo = resultData.DocumentNo,
                CashPayment          = resultData.SelfPayFeeAmount,
                SettlementNo         = resultData.DocumentNo,
                AllAmount            = outpatientPerson.MedicalTreatmentTotalCost,
                PatientName          = outpatientPerson.PatientName,
                AccountAmountPay     = 0,
                MedicalInsuranceType = userInfoData.InsuranceType == "310" ? "1" : userInfoData.InsuranceType,
            };

            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = param.User,
                MedicalInsuranceBackNum = "zydj",
                MedicalInsuranceCode    = "48",
                BusinessId = param.UiParam.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId = param.User.UserId,
                ReimbursementExpensesAmount = resultData.ReimbursementExpensesAmount,
                SelfPayFeeAmount            = resultData.SelfPayFeeAmount,
                OtherInfo    = JsonConvert.SerializeObject(resultData),
                Id           = saveData.Id,
                SettlementNo = resultData.DocumentNo,
                MedicalInsuranceAllAmount = outpatientPerson.MedicalTreatmentTotalCost,
                SettlementTransactionId   = param.User.TransKey,
                MedicalInsuranceState     = MedicalInsuranceState.HisSettlement
            };

            //更新中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);

            return(resultData);
        }
        /// <summary>
        /// 入院登记
        /// </summary>
        /// <returns></returns>
        public void HospitalizationRegister(ResidentHospitalizationRegisterUiParam param)
        { //his登陆
            var userBase = _webserviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取医保病人
            var inpatientData = _webserviceBasicService.GetInpatientInfo(infoData);
            var registerParam = GetResidentHospitalizationRegisterParam(param, inpatientData);
            var residentData  = _residentMedicalInsuranceRepository.HospitalizationRegister(registerParam);
            var saveData      = new MedicalInsuranceDto
            {
                AdmissionInfoJson = JsonConvert.SerializeObject(registerParam),
                BusinessId        = param.BusinessId,
                Id            = Guid.NewGuid(),
                InsuranceType = 342,
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceInpatientNo,
                MedicalInsuranceState             = MedicalInsuranceState.MedicalInsuranceHospitalized,
                AfferentSign = param.AfferentSign,
                IdentityMark = param.IdentityMark
            };

            //保存中间库
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(userBase, saveData);
            //回参构建
            var xmlData = new HospitalizationRegisterXml()
            {
                MedicalInsuranceType = "10",
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceInpatientNo,
                InsuranceNo = null,
            };
            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = userBase,
                MedicalInsuranceBackNum = "CXJB002",
                MedicalInsuranceCode    = "21",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            //更新中间库
            saveData.MedicalInsuranceState = MedicalInsuranceState.HisHospitalized;
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(userBase, saveData);
            //日志
            var logParam = new AddHospitalLogParam
            {
                User            = userBase,
                RelationId      = saveData.Id,
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(residentData),
                BusinessId      = param.BusinessId,
                Remark          = "医保入院登记;TransactionId:" + userBase.TransKey
            };

            _systemManageRepository.AddHospitalLog(logParam);
            //保存入院数据
            infoData.IsSave = true;
            _webserviceBasicService.GetInpatientInfo(infoData);
        }
示例#4
0
        /// <summary>
        /// 门诊异地划卡
        /// </summary>
        /// <param name="param"></param>
        public WorkerHospitalSettlementCardBackDto YdOutpatientPayCard(GetYdOutpatientPayCardParam param)
        {
            var resultData = new WorkerHospitalSettlementCardBackDto();
            var outputData =
                XmlSerializeHelper.YdDeSerializer <YdOutpatientPayCardXml>(param.SettlementJson);
            //YdOutpatientPayCardXml
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            //门诊病人信息存储
            var id = Guid.NewGuid();
            var outpatientParam = new GetOutpatientPersonParam()
            {
                User    = userBase,
                UiParam = param,
                Id      = id,
                IsSave  = true,
            };
            var outpatientPerson = _serviceBasicService.GetOutpatientPerson(outpatientParam);

            if (outpatientPerson == null)
            {
                throw new Exception("his中未获取到当前病人!!!");
            }
            //储存明细
            var outpatientDetailPerson = _serviceBasicService.GetOutpatientDetailPerson(new OutpatientDetailParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
                IsSave     = true,
                PatientId  = id.ToString()
            });
            var queryResidentParam = new QueryMedicalInsuranceResidentInfoParam()
            {
                BusinessId = param.BusinessId,
            };

            //日志写入
            _systemManageRepository.AddHospitalLog(new AddHospitalLogParam()
            {
                User            = userBase,
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(outputData),
                RelationId      = outpatientParam.Id,
                BusinessId      = param.BusinessId,
                Remark          = outputData.SerialNumber + "异地刷卡支付"
            });
            //获取医保病人信息
            var residentData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(queryResidentParam);

            if (residentData.MedicalInsuranceState != MedicalInsuranceState.MedicalInsurancePreSettlement)
            {
                throw new Exception("当前病人未办理预结算,不能办理结算!!!");
            }
            //存中间库

            var updateData = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId           = userBase.UserId,
                SelfPayFeeAmount = CommonHelp.ValueToDouble(outpatientPerson.MedicalTreatmentTotalCost - outputData.AccountPayAmount),
                OtherInfo        = JsonConvert.SerializeObject(resultData),
                Id           = residentData.Id,
                SettlementNo = outputData.SerialNumber,
                MedicalInsuranceAllAmount = outpatientPerson.MedicalTreatmentTotalCost,
                SettlementTransactionId   = userBase.UserId,
                MedicalInsuranceState     = MedicalInsuranceState.MedicalInsuranceSettlement,
                SettlementType            = "2",
                PatientId = id.ToString()
            };

            //存入中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateData);

            // 回参构建
            var xmlData = new OutpatientDepartmentCostXml()
            {
                AccountBalance = param.AccountBalance,
                MedicalInsuranceOutpatientNo = outputData.SerialNumber,
                CashPayment          = outputData.CashPayAmount,
                SettlementNo         = outputData.SerialNumber,
                AllAmount            = CommonHelp.ValueToDouble(outpatientPerson.MedicalTreatmentTotalCost),
                PatientName          = outpatientPerson.PatientName,
                AccountAmountPay     = outputData.AccountPayAmount,
                MedicalInsuranceType = "1",
            };
            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = userBase,
                MedicalInsuranceBackNum = "zydj",
                MedicalInsuranceCode    = "48",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            var updateParamData = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId = param.UserId,
                Id     = residentData.Id,
                MedicalInsuranceState = MedicalInsuranceState.HisSettlement,
                IsHisUpdateState      = true
            };

            //  更新中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParamData);
            resultData.AccountBalance = param.AccountBalance;
            resultData.AccountPayment = outputData.AccountPayAmount;
            resultData.CashPayment    = outputData.CashPayAmount;

            return(resultData);
        }
示例#5
0
        /// <summary>
        /// 取消医保出院结算
        /// </summary>
        /// <param name="param"></param>
        /// <param name="infoParam"></param>
        /// <returns></returns>
        public void LeaveHospitalSettlementCancel(LeaveHospitalSettlementCancelParam param,
                                                  LeaveHospitalSettlementCancelInfoParam infoParam)
        {
            var cancelLimit = param.CancelLimit;

            if (param.CancelLimit == "1")
            {
                Cancel(param);
                var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
                {
                    UserId = infoParam.User.UserId,
                    Id     = infoParam.Id,
                    CancelTransactionId   = infoParam.User.TransKey,
                    MedicalInsuranceState = MedicalInsuranceState.MedicalInsurancePreSettlement
                };
                //存入中间层
                _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);
                //添加日志
                var logParam = new AddHospitalLogParam()
                {
                    JoinOrOldJson = JsonConvert.SerializeObject(param),
                    User          = infoParam.User,
                    Remark        = "居民住院结算取消",
                    RelationId    = infoParam.Id,
                    BusinessId    = infoParam.BusinessId
                };
                _systemManageRepository.AddHospitalLog(logParam);
                //回参构建
                var xmlData = new HospitalizationRegisterXml()
                {
                    MedicalInsuranceHospitalizationNo = param.MedicalInsuranceHospitalizationNo,
                };
                var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                var saveXml         = new SaveXmlDataParam()
                {
                    User = infoParam.User,
                    MedicalInsuranceBackNum = "CXJB011",
                    MedicalInsuranceCode    = "42",
                    BusinessId = infoParam.BusinessId,
                    BackParam  = strXmlBackParam
                };
                //存基层
                _webBasicRepository.SaveXmlData(saveXml);
            }
            else if (param.CancelLimit == "2") //取消入院登记并删除资料
            {
                Cancel(param);
                //回参构建
                var xmlData = new HospitalizationRegisterCancelXml()
                {
                    MedicalInsuranceHospitalizationNo = param.MedicalInsuranceHospitalizationNo
                };
                var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                var saveXml         = new SaveXmlDataParam()
                {
                    User = infoParam.User,
                    MedicalInsuranceBackNum = "CXJB004",
                    MedicalInsuranceCode    = "22",
                    BusinessId = infoParam.BusinessId,
                    BackParam  = strXmlBackParam
                };
                //存基层
                _webBasicRepository.SaveXmlData(saveXml);
            }
            void Cancel(LeaveHospitalSettlementCancelParam paramc)
            {
                var xmlStr = XmlHelp.SaveXml(paramc);

                if (xmlStr)
                {
                    int result = MedicalInsuranceDll.CallService_cxjb("CXJB011");
                    if (result == 1)
                    {
                        var data = XmlHelp.DeSerializerModel(new IniDto(), true);
                    }
                }
            }
        }