package enums import "gdyb/utils" const ( // ErrorCode // 登录注册错误 6000+ ErrorCodeLoginTimeout = 6001 ErrorCodeNotLogin = 6002 ErrorCodePermissionDenied = 6003 ErrorCodeMobileRegistered = 6004 ErrorCodePasswordEmpty = 60052503 ErrorCodeVerificationCodeWrong = 6006 ErrorCodeRegisterFail = 6007 ErrorCodeInvalidToken = 6008 ErrorCodeAccountOrPasswordWrong = 6009 ErrorCodeMissingOrg = 6010 ErrorCodeMissingOrgApp = 6011 ErrorCodeAccountOrVerCodeWrong = 6012 ErrorCodeMobileNotExit = 6013 ErrorCodeUserNotExist = 6014 ErrorCodeUserWasForbidden = 6015 ErrorCodeNeverCreateTypeApp = 6016 ErrorCodeContactSuperAdminCreateTypeApp = 6017 ErrorCodeRepeatCreateOrg = 901 // 数据验证错误 7000+ ErrorCodeMobileFormat = 7001 ErrorCodeTelphoneFormat = 7002 ErrorCodeParamWrong = 7003 ErrorCodeParamFormatWrong = 7004 // 数据库操作错误 8000+ ErrorCodeDBCreate = 8001 ErrorCodeDBUpdate = 8002 ErrorCodeDBDelete = 8003 ErrorCodeDBSelectNoResult = 8004 ErrorCodeDataException = 8005 ErrorDrugDataException = 8006 // 业务逻辑操作错误 9000+ ErrorCodeRoleNotExist = 9001 ErrorCodeAdminUserNotExist = 9002 ErrorCodeMobileDidUsedInApp = 9003 ErrorCodeMissingUserName = 9004 ErrorCodeOldPasswordWrong = 9005 ErrorCodeCannotRemoveRole = 9006 ErrorCodeRoleMobileIsSuperAdmin = 9007 ErrorCodeGetQiniuUpToken = 1001 ErrorCodeCreatePatient = 1002 ErrorCodeDialysisNoExist = 1003 ErrorCodeIdCardNoExist = 1004 ErrorCodePatientNoExist = 1005 ErrorCodeUpdatePatient = 1006 ErrorCodeDialysisSolutionExist = 1007 ErrorCodeDialysisSolutionCreate = 1008 ErrorCodeDialysisSolutionUpdate = 1009 ErrorCodeDialysisSolutionNotExist = 1010 ErrorCodeParentDialysisSolutionNotExist = 1011 ErrorCodeAlReadyHadChildSolution = 1012 ErrorCodeCanntCreateChildChildSolution = 1013 ErrorCodeDialysisSolutionUsed = 1014 ErrorCodeCreateDryWeightFail = 1015 ErrorCodeCreateDoctorAdviceFail = 1016 ErrorCodeDoctorAdviceNotExist = 1017 ErrorCodeUpdateDoctorAdviceFail = 1018 ErrorCodeLongTimeAdviceNotCanntEdit = 1019 ErrorCodeAdviceStoped = 1020 ErrorCodeParentAdviceNotExist = 1021 ErrorCodeStopAdviceFail = 1022 ErrorCodeDeleteAdviceFail = 1023 ErrorCodeDialysisSolutionDelete = 1024 ErrorCodeDeviceNumberNotTheZone = 1025 ErrorCodeCreateScheduleFail = 1026 ErrorCodeCantSetScheduleAgainOneDay = 1027 ErrorCodeCantSetScheduleBeforeNow = 1028 ErrorCodeScheduleNotExist = 1029 ErrorCodeDeleteScheduleFail = 1030 ErrorCodeChangeScheduleFail = 1031 ErrorCodePatientPhoneUsed = 1032 ErrorCodeAdviceExced = 1033 ErrorCodeAdviceChecked = 1034 ErrorCodePointScheduleExist = 1035 ErrorCodeExceAndCheckNotOneUser = 1036 ErrorCodeCanotEditOtherAdvice = 1037 ErrorCodeEditLapsetoFail = 1038 ErrorCodeAdviceCheckBeforeExce = 1039 ErrorCodeAdviceExceBeforeStart = 1040 ErrorCodeDelScheduleFailByDialysis = 1041 ErrorCodeNotSelectLapsetoType = 1042 ErrorCodeNotSelectLapsetoTime = 1043 ErrorCodeEquitNoExist = 1045 ErrorCodeInspectionDateExit = 1201 ErrorCodeInspectionAddFail = 1202 ErrorCodeInspectionEditFail = 1204 ErrorCodeInspectionDateNotExit = 1203 ErrorCodeInspectionDeleteFail = 1205 ErrorCodeMonitorCreate = 1128 ErrorCodeMonitorNotExist = 1129 ErrorCodeMonitorUpdate = 1130 ErrorDialysisOrderNoStart = 1132 ErrorDialysisOrderNoEND = 1133 ErrorDialysisOrderRepeatStart = 1134 ErrorDialysisOrderRepeatBed = 1136 ErrorCodeDialysisPermissionDeniedModify = 1135 ErrorCodeNotSubscibe = 4003 ErrorCodeServeNotExist = 4004 ErrorCodeInvoiceExist = 4005 ErrorCodeApplyInvoiceFail = 4006 ErrorCodeHetongHad = 4007 ErrorCodeCreateHetongFail = 4008 ErrorCodePatientReachLimit = 4009 ErrorCodeDeviceZoneNotExist = 9021 ErrorCodeDeviceZoneNameRepeat = 9022 ErrorCodeDeviceGroupNotExist = 9023 ErrorCodeDeviceGroupNameRepeat = 9024 ErrorCodeDeviceNumberNotExist = 9025 ErrorCodeDeviceNumberRepeat = 9026 ErrorCodeDeviceNotExist = 9027 ErrorCodeDeviceZoneCannotDisable = 9028 ErrorCodeDeviceNumberCannotDisableCuzDevice = 9029 ErrorCodeDeviceNumberCannotDisableCuzSchedule = 9030 ErrorCodeDeviceNumberCannotDisableCuzSchTemplate = 9031 ErrorCommitFail = 90000 ErrorCodeCreateStockInFail = 20001 ErrorCodeCreateReturnFail = 50001 ErrorCodeCreateStockOutFail = 50002 ErrorCodeCreateCancelStockFail = 50003 ErrorCodeScheduleTemplateNotExist = 10001 ErrorCodeSystemError = 6666 ErrorCodeProductError = 6667 ErrorCodeFieldExist = 100001 ErrorCodeCreateConfig = 100002 ErrorCodeUpdateConfig = 100003 ErrorCodeDoubleCheckWrong = 200003 ErrorCodeDoubleCheckUserWrong = 200004 ErrorCodeGoodNoStockInError = 200005 ErrorCodeCancelStockFail = 200006 ErrorCodeDeleteGoodTypeFail = 200007 ErrorCodeDeleteGoodInfoFail = 200008 ErrorCodeDeleteFail = 200009 ErrorCodeKeyFail = 200010 ErrorCodeDeleteStockInRecordFail = 200011 ErrorCodeNameWrong = 200012 ErrorCodeParamEmptyWrong = 200013 ErrorCodeParamAdviceEmptyWrong = 200014 ErrorCodeParamTemplateNOEXISTWrong = 200015 ErrorCodeDeleteDealerWrong = 200016 ErrorCodeDeleteManufacturerWrong = 200017 ErrorCodeGoodTypeNameExistError = 200018 ErrorCodeGoodInfoNameExistError = 200019 ErrorCodePrescriptionPermissionDeniedModify = 200020 ErrorCodeAdvicePermissionDeniedModify = 200021 ErrorCodePrescriptionException = 200022 ErrorCodeNotDocking = 200023 ErrorCodeAdviceTypeWrong = 200024 ErrorCodeCreateAdvice = 200025 ErrorCodePatientDialysisOrder = 20026 ErrorSchedualcRepeatBed = 20027 ErrorCodeChangeMode = 20028 ErrorCodeChangeDeviceNumber = 20029 ErrorCodeHisIdExist = 20030 ErrorCodePreExist = 20031 ErrorCodeOrgNoExist = 20032 ErrorCodeRegisterExist = 20033 ErrorCodeRepeatCreateStaffException = 20034 ErrorCodeForbidden = 20035 ErrorCodeRoleNameIsExist = 20036 ErrorCodeRole = 20037 ErrorCodeAdminUserIsExit = 20038 ErrorCodePhone = 20039 ErrorCodeLogOut = 20049 ErrorCodeExportError = 20050 ErrorCodeOrgNoPatient = 20051 ErrorCodeDoctorAdviceEmpty = 20052 ErrorCodeOpenStocktWrong = 20053 ErrorCodeDrugRepeatDataException = 20054 ErrorCodeIDCartNo = 20055 ErrorCodeRegisterOneException = 20066 ErrorCodeRegisterTwoException = 20067 ErrorCodeCreatePreOrderException = 20068 ErrorCodeCalOrderException = 20069 ErrorCodeGdybOneException = 20070 ErrorCodeRegisterThreeException = 20071 ErrorCodeRegisterRepeatException = 20072 ErrorCodeAmountAccountException = 20073 ErrorCodeReadCardException = 20074 ErrorCodeNoPateintException = 20075 ErrorCodeHisFailedException = 20076 ErrorCodeHisOrderNoExistParamWrong = 30000 ErrorCodePreSettleFaildParamWrong = 30001 ErrorDrugPreSettleFaildParamWrong = 30002 ErrorDrugReturnFaildParamWrong = 30003 ErrorDoctorLoginFaildParamWrong = 30004 ErrorNoReadCardException = 30005 ErrorCodeParamSickTypeWrong = 30006 ErrorPsnRecordNoExistWrong = 30007 ErrorCodeInHospitalNoExistDataException = 30008 ErrorCodeHospitalNoExistDataException = 30009 ErrorCodeHospitalExistDataException = 300010 ErrorCodeHisPatientParamWrong = 300004 ErrorCodeOrderParamWrong = 300005 ErrorCodeHisPatientNoRegException = 4000000 ErrorCodeCreateOrderExceptionT = 200680000 ) var ErrCodeMsgs = map[int]string{ // 登录注册错误 ErrorCodeLoginTimeout: "登录超时", ErrorCodeNotLogin: "未登录", ErrorCodePermissionDenied: "权限不足", ErrorCodeMobileRegistered: "手机号已被注册", ErrorCodePasswordEmpty: "密码为空", ErrorCodeVerificationCodeWrong: "验证码错误", ErrorCodeRegisterFail: "注册失败", ErrorCodeInvalidToken: "令牌无效", ErrorCodeAccountOrPasswordWrong: "账号或密码错误", ErrorCodeMissingOrg: "未创建机构", ErrorCodeMissingOrgApp: "未创建任何应用", ErrorCodeAccountOrVerCodeWrong: "账号或验证码错误", ErrorCodeMobileNotExit: "手机号不存在", ErrorCodeUserNotExist: "用户不存在", ErrorCodeUserWasForbidden: "该用户被禁用", ErrorCodeNeverCreateTypeApp: "未创建此种应用", ErrorCodeContactSuperAdminCreateTypeApp: "请联系超级管理员开通此种应用", // 数据验证错误 ErrorCodeMobileFormat: "手机号格式错误", ErrorCodeTelphoneFormat: "电话格式错误", ErrorCodeParamWrong: "参数错误", ErrorCodeParamFormatWrong: "参数格式错误", // 数据库操作错误 ErrorCodeDBCreate: "数据库创建出错", ErrorCodeDBUpdate: "数据库更新出错", ErrorCodeDBDelete: "数据库删除出错", ErrorCodeDBSelectNoResult: "查询无结果", ErrorCodeDataException: "数据异常", ErrorDrugDataException: "", // 业务逻辑操作错误 ErrorCodeRoleNotExist: "角色不存在", ErrorCodeAdminUserNotExist: "管理员不存在", ErrorCodeMobileDidUsedInApp: "该手机号已在该应用中被注册为管理员", ErrorCodeMissingUserName: "缺少用户名", ErrorCodeOldPasswordWrong: "原密码不正确", ErrorCodeCannotRemoveRole: "该角色下存在用户,不能删除该角色", ErrorCodeRoleMobileIsSuperAdmin: "该手机号已注册为超级管理员", ErrorCodeGetQiniuUpToken: "获取七牛uptoken失败", ErrorCodeCreatePatient: "创建患者失败", ErrorCodeDialysisNoExist: "患者透析号重复!", ErrorCodeIdCardNoExist: "身份证号重复!", ErrorCodePatientNoExist: "患者信息不存在!", ErrorCodeUpdatePatient: "修改患者信息失败", ErrorCodeDialysisSolutionExist: "该处方已经存在", ErrorCodeDialysisSolutionCreate: "创建处方失败", ErrorCodeDialysisSolutionUpdate: "修改处方失败", ErrorCodeDialysisSolutionNotExist: "该处方不存在", ErrorCodeParentDialysisSolutionNotExist: "上级处方不存在", ErrorCodeAlReadyHadChildSolution: "所选处方已经存在子方案", ErrorCodeCanntCreateChildChildSolution: "子方案不能添加子方案", ErrorCodeDialysisSolutionUsed: "处方已被使用,不能删除", ErrorCodeCreateDryWeightFail: "添加干体重失败", ErrorCodeCreateDoctorAdviceFail: "添加医嘱失败", ErrorCodeUpdateDoctorAdviceFail: "修改医嘱信息失败", ErrorCodeDoctorAdviceNotExist: "医嘱不存在", ErrorCodeLongTimeAdviceNotCanntEdit: "长期医嘱不能修改!", ErrorCodeAdviceStoped: "所选医嘱已停止", ErrorCodeParentAdviceNotExist: "上级医嘱不存在", ErrorCodeDeleteAdviceFail: "删除医嘱失败", ErrorCodeStopAdviceFail: "停止医嘱失败", ErrorCodeDialysisSolutionDelete: "删除方案失败", ErrorCodeDeviceNumberNotTheZone: "所选机号不在选择分区中", ErrorCodeCreateScheduleFail: "添加排班失败", ErrorCodeCantSetScheduleAgainOneDay: "同一天不可有两次排班", ErrorCodeCantSetScheduleBeforeNow: "不能给今天之前的日期排班", ErrorCodeScheduleNotExist: "排班不存在", ErrorCodePointScheduleExist: "所先位置排班已经存在", ErrorCodeDeleteScheduleFail: "取消排班失败", ErrorCodeChangeScheduleFail: "修改排班失败", ErrorCodePatientPhoneUsed: "手机号已经存在", ErrorCodeAdviceExced: "医嘱已经执行", ErrorCodeAdviceCheckBeforeExce: "核对医嘱不能在执行医嘱之前", ErrorCodeAdviceExceBeforeStart: "执行医嘱不能在开始之前", ErrorCodeAdviceChecked: "医嘱已经核对", ErrorCodeExceAndCheckNotOneUser: "核对与执行不能是同一人", ErrorCodeCanotEditOtherAdvice: "不能修改非本人添加的医嘱", ErrorCodeEditLapsetoFail: "转归失败", ErrorCodeDelScheduleFailByDialysis: "已经上机透析,不能取消排班", ErrorCodeNotSelectLapsetoType: "请选择转归状态", ErrorCodeNotSelectLapsetoTime: "请选择转归时间", ErrorCodeInspectionDateExit: "当天已经存在检验检查记录", ErrorCodeInspectionAddFail: "添加记录失败", ErrorCodeInspectionDateNotExit: "当天不存在检验检查记录", ErrorCodeInspectionEditFail: "修改记录失败", ErrorCodeInspectionDeleteFail: "删除记录失败", ErrorCodeDeviceZoneNotExist: "设备分区不存在", ErrorCodeDeviceZoneNameRepeat: "该分区名已存在", ErrorCodeDeviceGroupNotExist: "设备分组不存在", ErrorCodeDeviceGroupNameRepeat: "该分组名已存在", ErrorCodeDeviceNumberNotExist: "机号不存在", ErrorCodeDeviceNumberRepeat: "该机号已存在", ErrorCodeDeviceNotExist: "该设备不存在", ErrorCodeDeviceZoneCannotDisable: "该分区存在床位号,不能删除", ErrorCodeDeviceNumberCannotDisableCuzDevice: "该床位存在设备,不能删除", ErrorCodeDeviceNumberCannotDisableCuzSchedule: "该床位尚有排班安排,不能删除", ErrorCodeDeviceNumberCannotDisableCuzSchTemplate: "排班模板在该床位尚有排班安排,不能删除", ErrorCodeNotSubscibe: "没有订阅服务或服务已过期,请先购买服务!", ErrorCodeServeNotExist: "服务订单不存在!", ErrorCodeInvoiceExist: "已经申请了发票!", ErrorCodeApplyInvoiceFail: "申请发票失败!", ErrorCodeHetongHad: "合同已经存在!", ErrorCodeCreateHetongFail: "合同创建失败", ErrorCodePatientReachLimit: "患者数已达到当前服务版本病人数,需要升级到更高的版本", ErrorCodeMonitorCreate: "创建监测失败", ErrorCodeMonitorNotExist: "监测记录不存在", ErrorCodeMonitorUpdate: "修改监测失败", ErrorCodeDialysisPermissionDeniedModify: "您没有权限修改其他医护的数据!", ErrorDialysisOrderNoStart: "尚未上机,无法执行下机操作", ErrorDialysisOrderNoEND: "已处于下机状态", ErrorDialysisOrderRepeatStart: "已上机", ErrorDialysisOrderRepeatBed: "该床位已有患者上机,请选择其他床位", //ErrorCodeScheduleTemplateNotExist: "排班模板不存在", ErrorCodeSystemError: "系统异常", ErrorCodeProductError: "该服务商品已丢失", ErrorCodeScheduleTemplateNotExist: "排班模板不存在", ErrorCodeCreateStockInFail: "入库失败", //ErrorCodeSystemError: "系统异常", //ErrorCodeProductError: "该服务商品已丢失", ErrorCodeFieldExist: "配置字段已存在", ErrorCodeCreateConfig: "创建配置失败", ErrorCodeUpdateConfig: "修改配置失败", ErrorCommitFail: "提交失败", ErrorCodeDoubleCheckWrong: "核对已完成, 无法再次提交", ErrorCodeDoubleCheckUserWrong: "你已完成核对,不能重复核对", ErrorCodeGoodNoStockInError: "该商品尚未入库", ErrorCodeCancelStockFail: "出库退库失败", ErrorCodeDeleteGoodTypeFail: "该类型存在商品信息,无法删除", ErrorCodeDeleteGoodInfoFail: "该商品已经入库或者出库无法删除", ErrorCodeDeleteFail: "删除失败", ErrorCodeKeyFail: "关键字不能为空", ErrorCodeDeleteStockInRecordFail: "该记录已经有出库或退货操作,无法删除", ErrorCodeNameWrong: "该模版名字已存在", ErrorCodeParamEmptyWrong: "模版名称不能为空", ErrorCodeParamAdviceEmptyWrong: "医嘱名称不能为空", ErrorCodeDeleteDealerWrong: "该经销商所属商品已入库无法删除", ErrorCodeDeleteManufacturerWrong: "该厂商所属商品已入库无法删除", ErrorCodeGoodTypeNameExistError: "该商品类型名字已存在", ErrorCodeGoodInfoNameExistError: "该规格名称名字已存在", ErrorCodePrescriptionPermissionDeniedModify: "您没有权限修改透析处方数据", ErrorCodeAdvicePermissionDeniedModify: "您没有权限添加医嘱", ErrorCodePrescriptionException: "上机失败,请先开处方", ErrorCodeNotDocking: "该地区尚未对接", ErrorCodeAdviceTypeWrong: "请选择医嘱模版类型", ErrorCodeCreateAdvice: "你没有权限开医嘱", ErrorCodePatientDialysisOrder: "该病人已经上机,无法临时排班", ErrorSchedualcRepeatBed: "该床位已经有人排班,无法临时排班", ErrorCodeChangeMode: "该患者今天已上机治疗,请在透析记录中进行调整透析模式", ErrorCodeChangeDeviceNumber: "该患者今天已上机治疗,请在透析记录中进行调整机号", ErrorCodeHisIdExist: "该his_id已被占用,请重新输入", ErrorCodePreExist: "没有该权限", ErrorCodeRepeatCreateOrg: "该账号已创建过机构了", ErrorCodeOrgNoExist: "该机构不存在", ErrorCodeRegisterExist: "该账号已经注册,请登录", ErrorCodeRepeatCreateStaffException: "该员工已经存在无法继续添加", ErrorCodeForbidden: "你已经被管理员禁用,无法使用该系统", ErrorCodeRoleNameIsExist: "该角色已经不存在", ErrorCodeRole: "尚未配置角色,无访问权限", ErrorCodeAdminUserIsExit: "用户不存在", ErrorCodePhone: "请填写正确的联系电话", ErrorCodeLogOut: "退出", ErrorCodeExportError: "导入出错,请下载并查看相关日志", ErrorCodeOrgNoPatient: "暂无病人", ErrorCodeDoctorAdviceEmpty: "没有更多了", ErrorCodeOpenStocktWrong: "未开启自动扣减功能,无法出库", ErrorCodeDrugRepeatDataException: "该药已经存在,无法添加", ErrorCodeIDCartNo: "身份证不能为空", ErrorCodeRegisterOneException: "无参保信息", ErrorCodeRegisterTwoException: "挂号失败", ErrorCodeCalOrderException: "结算失败", ErrorCodeGdybOneException: "获取人员信息失败", ErrorCodeRegisterThreeException: "就诊信息上传失败", ErrorCodeRegisterRepeatException: "患者一天只能挂号一次", ErrorCodeAmountAccountException: "结算失败", ErrorCodeReadCardException: "读卡失败", ErrorCodeNoPateintException: "读卡失败!请先在系统录入患者信息或检查患者身份证信息是否正确,再重新读卡", ErrorCodeHisFailedException: "获取人员信息失败", ErrorCodePreSettleFaildParamWrong: "预结算失败", ErrorCodeHisOrderNoExistParamWrong: "订单不存在", ErrorDrugPreSettleFaildParamWrong: "备案失败", ErrorDrugReturnFaildParamWrong: "撤销失败", ErrorDoctorLoginFaildParamWrong: "登记失败", ErrorNoReadCardException: "无法读取除社保卡以外的卡", ErrorCodeParamSickTypeWrong: "医生所开处方的疾病类型不能为空", ErrorPsnRecordNoExistWrong: "人员备案信息不存在", ErrorCodeInHospitalNoExistDataException: "入院记录不存在", ErrorCodeHospitalNoExistDataException: "请先办理出院才能进行结算", ErrorCodeHospitalExistDataException: "该患者已经入院,请选办理出院结算后再进行办理入院操作", ErrorCodeHisPatientParamWrong: "订单正在结算、请先结算完成", ErrorCodeOrderParamWrong: "该就诊号存在已结算记录,请先退费后再进行退号操作", ErrorCodeHisPatientNoRegException: "该患者尚未挂号,请先挂号", ErrorCodeCreateOrderExceptionT: "记账失败", } type SGJError struct { Code int } func (e *SGJError) Error() string { value, ok := ErrCodeMsgs[e.Code] if ok { return value } else { return "未知错误" } } func MakeSuccessResponseJSON(data map[string]interface{}) map[string]interface{} { json := make(map[string]interface{}) if data != nil { json["data"] = data } else { json["data"] = make(map[string]interface{}) } json["state"] = 1 json["code"] = 0 return json } func MakeFailResponseJSON(errMsg string, errCode int) map[string]interface{} { json := make(map[string]interface{}) json["msg"] = errMsg json["code"] = errCode json["state"] = 0 return json } func MakeFailResponseJSONWithSGJError(err *SGJError) map[string]interface{} { if err == nil { utils.WarningLog("MakeFailResponseJSONWithSGJError 参数err 不能为空") return nil } return MakeFailResponseJSON(err.Error(), err.Code) } func MakeFailResponseJSONWithSGJErrorCode(code int) map[string]interface{} { err := &SGJError{Code: code} return MakeFailResponseJSON(err.Error(), err.Code) }