/// <summary> /// 添加记录操作 /// </summary> protected void AddRecord() { HttpContext context = HttpContext.Current; HttpRequest request = context.Request; HttpResponse response = context.Response; MedicalRecord medicalRecord= new MedicalRecord(); string addTime=request.Params["textAddTime"]; string chiefComplaint=request.Params["textChiefComplaint"]; string confirmedDiagnostic=request.Params["textConfirmedDiagnostic"]; string consumerId=request.Params["textConsumerId"]; string description=request.Params["textDescription"]; string historyPresentIllness=request.Params["textHistoryPresentIllness"]; string inHospitalDiagnostic=request.Params["textInHospitalDiagnostic"]; string phyExamNum=request.Params["textPhyExamNum"]; string physicalExam=request.Params["textPhysicalExam"]; string physicalExamDate=request.Params["textPhysicalExamDate"]; string representor=request.Params["textRepresentor"]; string updateTime=request.Params["textUpdateTime"]; medicalRecord.AddTime=DateTime.Now; if(!String.IsNullOrEmpty(chiefComplaint)) medicalRecord.ChiefComplaint=chiefComplaint; if(!String.IsNullOrEmpty(confirmedDiagnostic)) medicalRecord.ConfirmedDiagnostic=confirmedDiagnostic; if(!String.IsNullOrEmpty(consumerId)) medicalRecord.ConsumerId=consumerId; if(!String.IsNullOrEmpty(description)) medicalRecord.Description=description; if(!String.IsNullOrEmpty(historyPresentIllness)) medicalRecord.HistoryPresentIllness=historyPresentIllness; if(!String.IsNullOrEmpty(inHospitalDiagnostic)) medicalRecord.InHospitalDiagnostic=inHospitalDiagnostic; if(!String.IsNullOrEmpty(phyExamNum)) medicalRecord.PhyExamNum=phyExamNum; if(!String.IsNullOrEmpty(physicalExam)) medicalRecord.PhysicalExam=physicalExam; medicalRecord.PhysicalExamDate=DateTime.Now; medicalRecord.RecordId=Guid.NewGuid().ToString("N"); if(!String.IsNullOrEmpty(representor)) medicalRecord.Representor=representor; medicalRecord.UpdateTime=DateTime.Now; ResultModel result = MedicalRecordBll.Insert(medicalRecord); string jsonString = JsonConvert.SerializeObject(result); response.Write(result); }
/// <summary> /// 插入一条新记录 /// </summary> /// <param name="medicalRecord">MedicalRecord实体</param> /// <returns>插入记录的主键</returns> public static object Insert(MedicalRecord medicalRecord) { Object id = DataAccessUtility.Insert<MedicalRecord>(medicalRecord); return id; }
/// <summary> /// 修改MedicalRecord表中的某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> public static void Update(MedicalRecord medicalRecord) { DataAccessUtility.Update<MedicalRecord>(medicalRecord); }
/// <summary> /// 删除MedicalRecord表中的某条记录 /// </summary> /// <param name="user">要删除记录的对应的实体</param> public static void Delete(MedicalRecord medicalRecord) { DataAccessUtility.Delete<MedicalRecord>(medicalRecord); }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(MedicalRecord medicalRecord, bool isLog) { if (isLog) return Update(medicalRecord); ResultModel result = new ResultModel(); try { MedicalRecordDal.Update(medicalRecord); result.IsSuccess = true; result.ObjectRecordId = medicalRecord.RecordId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =medicalRecord.RecordId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(MedicalRecord medicalRecord) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log.AddTime = DateTime.Now; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.OperationLogId = System.Guid.NewGuid().ToString("N"); log.OperationContent = SymbolicConstant.OPERATIONCONTENT_UPDATE; log.OperationTable = typeof(MedicalRecord).Name; log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_UPDATE; log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; log.UserId = CurrentSession.getUser().UserId; log.ObjectRecordId = medicalRecord.RecordId; MedicalRecordDal.Update(medicalRecord); result.IsSuccess = true; result.ObjectRecordId = medicalRecord.RecordId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ObjectRecordId =medicalRecord.RecordId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 添加一条新记录 /// </summary> /// <param name="medicalRecord">MedicalRecord实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns> public static ResultModel Insert(MedicalRecord medicalRecord, bool isLog) { if (isLog) return Insert(medicalRecord); ResultModel result = new ResultModel(); object id = ""; try { id = MedicalRecordDal.Insert(medicalRecord); result.IsSuccess = true; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_INSERT_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="medicalRecordId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetMedicalRecordById(string medicalRecordId, bool isLog) { if (isLog) return GetMedicalRecordById(medicalRecordId); MedicalRecord medicalRecord = new MedicalRecord(); ResultModel result = new ResultModel(); try { medicalRecord= MedicalRecordDal.GetModel(medicalRecordId); result.Data = medicalRecord; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }