public async Task <IActionResult> SubmitData([FromBody] SubmitDataInput input) { var user = await _usersService.GetCurrentUserAsync(); if (string.IsNullOrEmpty(input.id))//新建医嘱 { if (string.IsNullOrEmpty(input.patientId)) { return(BadRequest("患者主键未传值!")); } var patient = await _patientApp.GetForm(input.patientId); if (patient == null) { return(BadRequest("患者主键有误!")); } var drug = await _drugsApp.GetForm(input.orderCode); if (drug == null) { return(BadRequest("药品主键有误!")); } if (input.orderAmount == null || Math.Abs(input.orderAmount.ToFloat(3)) < 0.01) { return(BadRequest("药品剂量有误!")); } var entity = new OrdersEntity { F_Id = Common.GuId(), F_Pid = patient.F_Id, F_DialysisNo = patient.F_DialysisNo, F_RecordNo = patient.F_RecordNo, F_OrderType = input.orderType ?? "药疗", F_OrderStartTime = input.orderStartTime ?? DateTime.Now, F_OrderCode = input.orderCode, F_OrderText = drug.F_DrugName, F_OrderUnitAmount = drug.F_DrugMiniAmount.ToFloat(2).ToString(CultureInfo.CurrentCulture), F_OrderUnitSpec = drug.F_DrugMiniSpec, F_OrderAmount = input.orderAmount, F_OrderFrequency = input.orderFrequency, F_OrderAdministration = input.orderAdministration, F_IsTemporary = input.isTemporary, F_DoctorOrderTime = DateTime.Now, F_CreatorTime = DateTime.Now, F_CreatorUserId = user.F_Id, F_Doctor = user.F_RealName }; _ordersApp.InsertForm(entity); return(Ok(new { id = entity.F_Id })); } else//修改医嘱 { } return(Ok(new { id = "" })); }
/// <summary> /// 获取二维码内容 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <IActionResult> GetBarcodeStr(BaseInput input) { var entity = await _patientApp.GetForm(input.KeyValue); if (entity == null) { return(BadRequest("患者主键有误!")); } var data = new { barcodeStr = input.KeyValue }; return(Ok(data)); }
public async Task <IActionResult> SubmitFormCreatePatVisit([FromBody] BaseInput input) { //总数 int count = 0; //新增数 int addnum = 0; //SettingApp settingApp = new SettingApp(); //var list = keyValue.ToJArrayObject().Select(t =>t.Value<string>("F_Id")); foreach (var id in input.KeyValue.ToJArrayObject().Select(t => t.Value <string>("F_Id"))) { var schedule = await _dialysisScheduleApp.GetForm(id); count++; var patient = await _patientApp.GetForm(schedule.F_PId); //判断是否存在申请单 if (_patVisitApp.GetList().Count(t => t.F_Pid == patient.F_Id && t.F_VisitDate == schedule.F_VisitDate) > 0) { continue; } //查询透析参数 var settings = (await _settingApp.GetList(schedule.F_PId)).OrderByDescending(t => t.F_CreatorTime); if (string.IsNullOrEmpty(schedule.F_DialysisType)) { schedule.F_DialysisType = "HD"; } var firstSetting = settings.FirstOrDefault(t => t.F_DialysisType == schedule.F_DialysisType); PatVisitEntity entity; if (firstSetting != null) { entity = new PatVisitEntity { F_VisitDate = schedule.F_VisitDate, F_VisitNo = schedule.F_VisitNo, F_BirthDay = patient.F_BirthDay, F_Pid = patient.F_Id, F_DialysisBedNo = schedule.F_DialysisBedNo, F_DialysisNo = patient.F_DialysisNo, F_DialysisType = schedule.F_DialysisType, F_EnabledMark = true, F_Gender = patient.F_Gender, F_GroupName = schedule.F_GroupName, F_HeparinAddAmount = firstSetting.F_HeparinAddAmount, F_HeparinAmount = firstSetting.F_HeparinAmount, F_HeparinType = firstSetting.F_HeparinType, F_HeparinUnit = firstSetting.F_HeparinUnit, F_AccessName = firstSetting.F_AccessName, F_BloodSpeed = firstSetting.F_BloodSpeed, F_Ca = firstSetting.F_Ca, F_K = firstSetting.F_K, F_Na = firstSetting.F_Na, F_Hco3 = firstSetting.F_Hco3, F_LowCa = firstSetting.F_LowCa, F_DialysateTemperature = firstSetting.F_DialysateTemperature, F_DialyzerType1 = firstSetting.F_DialyzerType1, F_DialyzerType2 = firstSetting.F_DialyzerType2, F_DilutionType = firstSetting.F_DilutionType, F_EstimateHours = firstSetting.F_EstimateHours, F_VascularAccess = firstSetting.F_VascularAccess, F_InpNo = patient.F_PatientNo, F_RecordNo = patient.F_RecordNo, F_IsCritical = false, F_Name = patient.F_Name, F_PatientSourse = null }; } else { entity = new PatVisitEntity { F_VisitDate = schedule.F_VisitDate, F_VisitNo = schedule.F_VisitNo, F_BirthDay = patient.F_BirthDay, F_Pid = patient.F_Id, F_DialysisBedNo = schedule.F_DialysisBedNo, F_DialysisNo = patient.F_DialysisNo, F_DialysisType = schedule.F_DialysisType, F_EnabledMark = true, F_Gender = patient.F_Gender, F_GroupName = schedule.F_GroupName, F_HeparinAddAmount = null, F_HeparinAmount = null, F_HeparinType = null, F_HeparinUnit = null, F_InpNo = patient.F_PatientNo, F_RecordNo = patient.F_RecordNo, F_IsCritical = false, F_Name = patient.F_Name, F_PatientSourse = null }; } await _patVisitApp.SubmitForm(entity, new object()); addnum++; } return(Success("操作成功,新增治疗单 " + addnum + " 个 , 总数:" + count)); }
public async Task <string> GetReport(string patientId, string keyword, DateTime startDate, DateTime endDate, int classType, int statusType) { var list = GetFilterFee(patientId, keyword, startDate, endDate.AddDays(1), classType, statusType); var feeCategory = new FeeCategory(); foreach (var item in list.Select(t => new { t.F_ItemClass, t.F_ItemId, t.F_ItemCode, t.F_ItemName, t.F_ItemSpec, t.F_Amount, t.F_Charges, t.F_Costs, t.F_ItemUnit })) { var billsum = feeCategory.BillSummaries.FirstOrDefault(t => t.FeeType == item.F_ItemClass); if (billsum == null) { billsum = new BillSummary { FeeType = item.F_ItemClass, Costs = 0f, BillDetails = new List <BillDetail>() }; feeCategory.BillSummaries.Add(billsum); } billsum.Costs = billsum.Costs + item.F_Costs.ToFloat(2); var bill = billsum.BillDetails.FirstOrDefault(t => t.ItemId == item.F_ItemId); if (bill == null) { bill = new BillDetail { ItemId = item.F_ItemId, ItemCode = item.F_ItemCode, ItemName = item.F_ItemName, ItemSpec = item.F_ItemSpec, Amount = item.F_Amount.ToFloat(2), Charges = item.F_Charges.ToFloat(2), Price = item.F_Charges.ToFloat(2), Costs = item.F_Costs.ToFloat(2), Unit = item.F_ItemUnit }; billsum.BillDetails.Add(bill); } else { bill.Amount = bill.Amount + item.F_Amount.ToFloat(2); bill.Charges = bill.Charges + item.F_Charges.ToFloat(2); bill.Costs = bill.Costs + item.F_Costs.ToFloat(2); } } //基本信息 var first = list.FirstOrDefault(); if (first != null) { var patient = await _patientApp.GetForm(patientId); if (feeCategory.BirthDay != null) { feeCategory.BirthDay = patient.F_BirthDay.ToChineseDateString(); feeCategory.AgeString = ((int)((DateTime.Now - patient.F_BirthDay.ToDate()).TotalDays / 365)).ToString() + "岁"; } feeCategory.Costs = list.Sum(t => t.F_Costs).ToFloat(2); feeCategory.DialysisNo = patient.F_DialysisNo.ToString(); feeCategory.EndDate = list.Max(t => t.F_BillingDateTime).ToChineseDateString(); //json.Value<DateTime>("endDate").ToChineseDateString(); feeCategory.Gender = patient.F_Gender; feeCategory.HospialName = await _organizeApp.GetHospitalName(); feeCategory.HospialLogo = await _organizeApp.GetHospitalLogo(); feeCategory.IdNo = patient.F_IdNo; feeCategory.InsuranceNo = patient.F_InsuranceNo; feeCategory.Name = patient.F_Name; feeCategory.PatientNo = patient.F_PatientNo; feeCategory.RecordNo = patient.F_RecordNo; feeCategory.StartDate = list.Min(t => t.F_BillingDateTime).ToChineseDateString();//json.Value<DateTime>("startDate").ToChineseDateString(); } return(GetBillReport(new List <FeeCategory> { feeCategory })); }
public async Task <IActionResult> GetFormJson(string keyValue) { var data = await _patientApp.GetForm(keyValue); return(Content(data.ToJson())); }
public async Task <IActionResult> SubmitData([FromBody] SubmitDataInput input) { if (input == null || string.IsNullOrEmpty(input.patientId)) { return(BadRequest("患者ID未传值!")); } var userId = _usersService.GetCurrentUserId(); if (string.IsNullOrEmpty(input.id))//新建 { var entity = new PunctureEntity { F_Id = Common.GuId(), F_CreatorTime = System.DateTime.Now, F_CreatorUserId = userId, F_Nurse = userId, F_OperateTime = input.operateTime ?? System.DateTime.Now, F_IsSuccess = input.isSucess, F_EnabledMark = true, F_Point1 = input.point1, F_Point2 = input.point2, F_Pid = input.patientId }; var patient = await _patientApp.GetForm(entity.F_Pid); if (patient != null) { var visitDate = entity.F_OperateTime.ToDate().Date; var patVisit = _patVisitApp.GetList().FirstOrDefault(t => t.F_Pid == patient.F_Id && t.F_VisitDate == visitDate);//patient.F_Id, visitDate if (patVisit != null) { //更新治疗单 穿刺者信息 patVisit.F_PuncturePerson = userId; await _patVisitApp.UpdateForm(patVisit); } else { return(BadRequest(patient.F_Name + "(" + visitDate.ToDateString() + ")无透析记录!")); } } else { return(BadRequest("患者ID有误!")); } await _punctureApp.InsertForm(entity); return(Ok(entity.F_Id)); } else { var entity = new PunctureEntity { F_LastModifyTime = DateTime.Now, F_LastModifyUserId = userId }; await _punctureApp.UpdateForm(entity); return(Ok(entity.F_Id)); } }
public async Task <IActionResult> CopyModel([FromBody] BaseInput input) { var patient = await _patientApp.GetForm(input.KeyValue); if (patient == null) { return(Error("患者ID有误")); } //查询已有记录 var list = await _settingApp.GetSelectList(input.KeyValue); //查询本医生透析参数模板 var source = await _settingModelApp.GetList(_userApp.GetCurrentUserId()); if (source.Count == 0) { return(Success("无透析参数模板。")); } var count = 0; foreach (var item in source) { if (list.Count(t => t.F_DialysisType.Equals(item.F_DialysisType)) > 0) { //已有这种透析模式透析参数 continue; } if (!string.IsNullOrEmpty(item.F_DialyzerType1))//查询透析器是否在用 { var m = await _materialApp.GetForm(item.F_DialyzerType1); if (m == null || m.F_EnabledMark == false || m.F_DeleteMark == true) { //删除模板 跳过循环 await _settingModelApp.DeleteForm(item.F_Id); continue; } } if (!string.IsNullOrEmpty(item.F_DialyzerType2))//查询灌流器是否在用 { var m = await _materialApp.GetForm(item.F_DialyzerType2); if (m == null || m.F_EnabledMark == false || m.F_DeleteMark == true) { //删除模板 跳过循环 await _settingModelApp.DeleteForm(item.F_Id); continue; } } if (!string.IsNullOrEmpty(item.F_HeparinType))//查询抗凝剂信息 { var drug = await _drugsApp.GetForm(item.F_HeparinType); if (drug == null || drug.F_EnabledMark == false || drug.F_DeleteMark == true) { //删除模板 跳过循环 await _settingModelApp.DeleteForm(item.F_Id); continue; } } var entity = new SettingEntity { F_AccessName = item.F_AccessName, F_BloodSpeed = item.F_BloodSpeed, F_Ca = item.F_Ca, F_DialysateTemperature = item.F_DialysateTemperature, F_DialysisType = item.F_DialysisType, F_DialyzerType1 = item.F_DialyzerType1, F_DialyzerType2 = item.F_DialyzerType2, F_DilutionType = item.F_DilutionType, F_EstimateHours = item.F_EstimateHours, F_EnabledMark = true, F_ExchangeAmount = item.F_ExchangeAmount, F_ExchangeSpeed = item.F_ExchangeSpeed, F_Hco3 = item.F_Hco3, F_HeparinAddAmount = item.F_HeparinAddAmount, F_HeparinAddSpeedUnit = item.F_HeparinAddSpeedUnit, F_HeparinAmount = item.F_HeparinAmount, F_HeparinType = item.F_HeparinType, F_HeparinUnit = item.F_HeparinUnit, F_IsDefault = false, F_K = item.F_K, F_LowCa = item.F_LowCa, F_Na = item.F_Na, F_Pid = input.KeyValue, F_VascularAccess = item.F_VascularAccess }; await _settingApp.SubmitForm(entity, new object()); count++; } return(Success("已添加" + count.ToString() + "条记录")); }
/// <summary> /// 今日就诊-首页 记录单卡片 /// </summary> /// <returns></returns> public async Task <IActionResult> GetCardList(GetCardListInput input) { var query = _patVisitApp.GetList() //input.visitDate, input.groupName, input.visitNo .Where(t => t.F_VisitDate == input.visitDate && t.F_GroupName == input.groupName && t.F_VisitNo == input.visitNo) .Select(t => new { t.F_Id, t.F_Pid, t.F_DialysisType, t.F_GroupName, t.F_DialysisBedNo, t.F_DialyzerType1, t.F_HeparinType, t.F_HeparinAmount, t.F_HeparinUnit, t.F_DialysisStartTime, t.F_DialysisEndTime, t.F_VascularAccess, t.F_AccessName }); var list = query.ToList(); //床位排序 var beds = await _dialysisMachineApp.GetItemList(input.groupName); var result = new List <GetCardListOutput>(); //存储肝素、透析器字典 Hashtable table = new Hashtable(); foreach (var item in list) { if (item.F_HeparinType != null && !table.ContainsKey(item.F_HeparinType)) { var drug = await _drugsApp.GetForm(item.F_HeparinType); table.Add(item.F_HeparinType, drug?.F_DrugName); } if (item.F_DialyzerType1 != null && !table.ContainsKey(item.F_DialyzerType1)) { var m = await _materialApp.GetForm(item.F_DialyzerType1); table.Add(item.F_DialyzerType1, m?.F_MaterialName); } var output = new GetCardListOutput { id = item.F_Id, groupName = item.F_GroupName, bedNo = item.F_DialysisBedNo, dialysisType = item.F_DialysisType, dialysisStartTime = item.F_DialysisStartTime, dialysisEndTime = item.F_DialysisEndTime, vascularAccess = item.F_VascularAccess, accessName = item.F_AccessName, heparinAmount = item.F_HeparinAmount, heparinUnit = item.F_HeparinUnit, heparinType = item.F_HeparinType == null ? "" : table[item.F_HeparinType].ToString(), dialyzerType = item.F_DialyzerType1 == null ? "" : table[item.F_DialyzerType1].ToString() }; if (item.F_Pid == null) { continue; } else { var patient = await _patientApp.GetForm(item.F_Pid); if (patient == null) { continue; } output.patientId = patient.F_Id; if (patient.F_BirthDay != null) { output.patientAge = (DateTime.Today - patient.F_BirthDay.ToDate()).TotalDays.ToInt() / 365; } output.patientName = patient.F_Name; output.beInfected = "+".Equals(patient.F_Tp) || "+".Equals(patient.F_Hiv) || "+".Equals(patient.F_HBsAg) || "+".Equals(patient.F_HBeAg) || "+".Equals(patient.F_HBeAb);//阳性患者判断规则 output.headIcon = patient.F_HeadIcon; } var bed = beds.First(t => t.F_DialylisBedNo.Equals(item.F_DialysisBedNo)); if (bed == null) { output.sortNo = 999; } else { output.sortNo = bed.F_ShowOrder.ToInt(); } if (item.F_DialysisStartTime == null) { output.percent = 0; } else if (item.F_DialysisEndTime != null) { output.percent = 100; } else { output.percent = ((DateTime.Now - item.F_DialysisStartTime.ToDate()).TotalHours / 4).ToFloat(2); } result.Add(output); } var data = result.OrderBy(t => t.sortNo); return(Ok(data)); }
public async Task <IActionResult> SubmitDrugOrder([FromBody] SubmitDrugOrderInput input) { var patient = await _patientApp.GetForm(input.Pid); var drug = await _drugsApp.GetForm(input.Items.First().OrderCode); var user = await _usersService.GetCurrentUserAsync(); var list = new List <OrdersEntity>(); var firstEntity = new OrdersEntity { F_Pid = patient.F_Id, F_SubIndex = 0, F_DialysisNo = patient.F_DialysisNo, F_RecordNo = patient.F_RecordNo, F_OrderType = "药疗", F_OrderStartTime = input.OrderStartTime?.ToDate() ?? DateTime.Now, F_OrderCode = drug.F_Id, F_OrderText = drug.F_DrugName, F_OrderSpec = drug.F_DrugSpec, F_OrderUnitAmount = drug.F_DrugMiniAmount.ToFloat(2).ToString(CultureInfo.InvariantCulture), F_OrderUnitSpec = drug.F_DrugMiniSpec, F_OrderAmount = input.Items.First().OrderAmount, F_OrderFrequency = input.OrderFrequency, F_OrderAdministration = input.OrderAdministration, F_IsTemporary = input.IsTemporary, F_Doctor = user.F_RealName, F_DoctorOrderTime = DateTime.Now, F_OrderStatus = 0, F_EnabledMark = true }; firstEntity.Create(); list.Add(firstEntity); for (int i = 1; i < input.Items.Count; i++) { drug = await _drugsApp.GetForm(input.Items[i].OrderCode); var entity = new OrdersEntity { F_Pid = patient.F_Id, F_ParentId = firstEntity.F_Id, F_SubIndex = i, F_DialysisNo = patient.F_DialysisNo, F_RecordNo = patient.F_RecordNo, F_OrderType = "药疗", F_OrderStartTime = input.OrderStartTime?.ToDate() ?? DateTime.Now, F_OrderCode = drug.F_Id, F_OrderText = drug.F_DrugName, F_OrderSpec = drug.F_DrugSpec, F_OrderUnitAmount = drug.F_DrugMiniAmount.ToFloat(2).ToString(), F_OrderUnitSpec = drug.F_DrugMiniSpec, F_OrderAmount = input.Items[i].OrderAmount, F_OrderFrequency = input.OrderFrequency, F_OrderAdministration = input.OrderAdministration, F_IsTemporary = input.IsTemporary, F_Doctor = user.F_RealName, F_DoctorOrderTime = firstEntity.F_DoctorOrderTime, F_OrderStatus = 0, F_EnabledMark = true }; entity.Create(); list.Add(entity); } await _ordersApp.InsertBatch(list); return(Success("操作成功。")); }
public async Task <IActionResult> GetPagedList(BaseInputPaged input) { if (string.IsNullOrEmpty(input.orderType)) { input.orderType = "desc"; } PatientEntity patient = null; if (string.IsNullOrEmpty(input.keyValue)) { patient = await _patientApp.GetRandom(); } else { patient = await _patientApp.GetForm(input.keyValue); } if (patient == null) { return(BadRequest("患者ID有误")); } var pagination = new Pagination { rows = input.rows, page = input.page, sidx = input.orderField ?? "F_ContentTime", sord = input.orderType }; Hashtable table = new Hashtable(); var list = await _medicalRecordApp.GetListByPid(pagination, patient.F_Id); foreach (var item in list) { if (!table.ContainsKey(item.F_CreatorUserId)) { var user = await _usersService.FindUserAsync(item.F_CreatorUserId); table.Add(item.F_CreatorUserId, user?.F_RealName ?? ""); } item.F_CreatorUserId = table[item.F_CreatorUserId] + ""; } var data = new { patient = new { name = patient.F_Name, gender = patient.F_Gender, ageStr = patient.F_BirthDay == null ? "" : ((DateTime.Now - patient.F_BirthDay.ToDate()).TotalDays.ToInt() / 365).ToString() + "岁", maritalStatus = patient.F_MaritalStatus, beInfected = "+".Equals(patient.F_Tp) || "+".Equals(patient.F_Hiv) || "+".Equals(patient.F_HBsAg) || "+".Equals(patient.F_HBeAg) || "+".Equals(patient.F_HBeAb),//阳性患者判断规则 dialysisNo = patient.F_DialysisNo, primaryDisease = patient.F_PrimaryDisease, diagnosis = patient.F_Diagnosis, headIcon = patient.F_HeadIcon }, rows = list.OrderByDescending(t => t.F_ContentTime).Select(t => new { id = t.F_Id, title = t.F_Title, content = t.F_Content, contentTime = t.F_ContentTime, isAudit = t.F_AuditFlag, creatorUser = t.F_CreatorUserId }), pagination.total, pagination.page, pagination.records }; return(Ok(data)); }
/// <summary> /// 批量写入数据 /// </summary> /// <param name="pids"></param> /// <param name="itemids"></param> public async Task CreateRecords(string pids, string itemids) { //var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity; //claimsIdentity.CheckArgumentIsNull(nameof(claimsIdentity)); var user = await _usersService.GetCurrentUserAsync(); var pidsParam = pids.ToJArrayObject(); var itemidsParam = itemids.ToJArrayObject(); var labItemList = new List <LabItemEntity>(); foreach (var item in itemidsParam) { var itemId = item.Value <string>("id"); var entity = await _labItemApp.GetForm(itemId); if (entity != null) { labItemList.Add(entity); } } //var user = OperatorProvider.Provider.GetCurrent(); var patients = new List <PatientEntity>(); foreach (var group in labItemList.GroupBy(t => t.F_CuvetteNo)) { foreach (var item in pidsParam) { var pId = item.Value <string>("id"); var patient = patients.FirstOrDefault(t => t.F_Id == pId); if (patient == null) { patient = await _patientApp.GetForm(pId); if (patient == null) { continue; } patients.Add(patient); } //var claimUserId = claimsIdentity?.FindFirst(t => t.Type == ClaimTypes.NameIdentifier)); //var claimUserName = claimsIdentity?.FindFirst(t => t.Type == ClaimTypes.Name)); var masterEntity = new LabSheetEntity { F_Id = Common.GuId(), F_CreatorTime = DateTime.Now, F_CreatorUserId = user?.F_Id, F_RequestDate = DateTime.Today, F_RequestId = long.Parse(Common.CreateNo()), F_Pid = patient.F_Id, F_Name = patient.F_Name, F_BeInfected = "+".Equals(patient.F_Tp) || "+".Equals(patient.F_Hiv) || "+".Equals(patient.F_HBsAg) || "+".Equals(patient.F_HBeAg) || "+".Equals(patient.F_HBeAb), F_DialysisNo = patient.F_DialysisNo, F_RecordNo = patient.F_RecordNo, F_PatientNo = patient.F_RecordNo, F_Gender = patient.F_Gender, F_BirthDay = patient.F_BirthDay, F_InsuranceNo = patient.F_InsuranceNo, F_IdNo = patient.F_IdNo, F_MaritalStatus = patient.F_MaritalStatus, F_IdealWeight = patient.F_IdealWeight, F_Height = patient.F_Height, F_PrimaryDisease = patient.F_PrimaryDisease, F_Diagnosis = patient.F_Diagnosis, F_SampleType = group.First().F_SampleType, F_Container = group.First().F_Container, F_Status = 1, F_DoctorId = user?.F_Id, F_DoctorName = user?.F_RealName, F_OrderTime = DateTime.Now }; await _service.InsertAsync(masterEntity); var details = new List <LabSheetItemsEntity>(); foreach (var child in group) { details.Add(new LabSheetItemsEntity { F_Id = Common.GuId(), F_CreatorTime = masterEntity.F_CreatorTime, F_CreatorUserId = user?.F_Id, F_RequestId = masterEntity.F_RequestId, F_Code = child.F_Code, F_Name = child.F_Name, F_EnName = child.F_EnName, F_ShortName = child.F_ShortName, F_SampleType = child.F_SampleType, F_Container = child.F_Container, F_CuvetteNo = child.F_CuvetteNo, F_Type = child.F_Type, F_ThirdPartyCode = child.F_ThirdPartyCode, F_IsExternal = child.F_IsExternal, F_Sorter = child.F_Sorter, F_IsPeriodic = child.F_IsPeriodic, F_TimeInterval = child.F_TimeInterval }); } await _detailService.InsertAsync(details); } } }
public async Task <string> GetReport(string keyValue) { var result = new StringBuilder(); result.Append(""); //查询医院名称 var hospitalName = await _organizeApp.GetHospitalName(); //查询患者基本信息 var patient = await _patientApp.GetForm(keyValue);// patientApp.GetList(keyValue).FirstOrDefault(); //查询所有病程记录 var list = from m in GetList() where m.F_AuditFlag == true && m.F_Pid == keyValue select new { m.F_Title, m.F_ContentTime, m.F_Content, m.F_CreatorUserId, m.F_AuditTime }; //字符 十进制 转义字符 //" " " //& & & //< < < //> > > //不断开空格(non - breaking space)   //构建页眉 result.Append("<div class=\"price-title\">" + "病 程 记 录" + "</div>"); result.Append("<div class=\"price-subtitle\">" + hospitalName + "</div>"); result.Append("<div class=\"price-info\">"); result.Append("<table class=\"form\">"); result.Append("<tr>"); result.Append("<th class=\"formTitle\">" + "姓名" + "</th>"); result.Append("<td class=\"formValue\" style=\"padding-right: 20px;\">"); result.Append("<input type=\"text\" class=\"form-control\" value=\"" + patient.F_Name + "\"/>"); result.Append("</td>"); //result.Append("</tr>"); //result.Append("<tr>"); result.Append("<th class=\"formTitle\">" + "性别" + "</th>"); result.Append("<td class=\"formValue\" style=\"padding-right: 20px;\">"); result.Append("<input type=\"text\" class=\"form-control\" value=\"" + patient.F_Gender + "\"/>"); result.Append("</td>"); //result.Append("</tr>"); //result.Append("<tr>"); result.Append("<th class=\"formTitle\">" + "年龄" + "</th>"); result.Append("<td class=\"formValue\" style=\"padding-right: 20px;\">"); result.Append("<input type=\"text\" class=\"form-control\" value=\"" + (patient.F_BirthDay == null ? " " : (DateTime.Now.Subtract((DateTime)patient.F_BirthDay).Days / 365).ToString()) + "岁\"/>"); result.Append("</td>"); result.Append("<th class=\"formTitle\">" + "透析号" + "</th>"); result.Append("<td class=\"formValue\" style=\"padding-right: 20px;\">"); result.Append("<input type=\"text\" class=\"form-control\" value=\"" + patient.F_DialysisNo + "\"/>"); result.Append("</td>"); result.Append("</tr>"); result.Append("</table>"); result.Append("<hr style=\"height:1px;border:none;border-top:1px solid #555555;\" />"); result.Append("</div>"); //病历内容 foreach (var item in list.ToList().OrderBy(t => t.F_ContentTime)) { result.Append("<div class=\"price-table-content\">"); result.Append("<table>"); result.Append("<tbody>"); //第一行 时间 标题 result.Append("<tr>"); result.Append("<td>"); result.Append(item.F_ContentTime.ToDateTimeString() + " " + item.F_Title); result.Append("</td>"); //result.Append("<td>"); //result.Append(item.F_Title); //result.Append("</td>"); result.Append("</tr>"); //第二行 正文 result.Append("<tr>"); result.Append("<td>"); result.Append("<div>"); result.Append(item.F_Content); result.Append("</div>"); result.Append("</td>"); result.Append("</tr>"); //第三行 签名 时间 result.Append("<tr>"); result.Append("<td>"); result.Append(" 医师签名:"); var user = await _usersService.FindUserAsync(item.F_CreatorUserId);// userApp.GetForm(item.F_CreatorUserId); if (user == null || string.IsNullOrWhiteSpace(user.F_RealName)) { result.Append(" "); } else { result.Append(user.F_RealName + ""); } result.Append(" 签名时间:" + item.F_AuditTime.ToDateTimeString()); result.Append("</td>"); result.Append("</tr>"); result.Append("</tbody>"); result.Append("</table>"); result.Append("</div>"); } result.Append("<br>"); result.Append("<br>"); return(result.ToString()); }
public async Task <IActionResult> AddFee([FromBody] AddFeeInput input) { var patient = await _patientApp.GetForm(input.PatientId); if (patient == null) { return(BadRequest("患者Id有误!")); } var drugDict = _drugsApp; var materials = _materialApp; var treatments = _treatmentApp; var user = await _usersService.GetCurrentUserAsync(); var billingDateTime = DateTime.Now; var totalCosts = 0f; var list = new List <BillingEntity>(); foreach (var item in input.Items.FindAll(t => t.Amount > 0 && (t.BillType == 1 || t.BillType == 2 || t.BillType == 3))) { var entity = new BillingEntity { F_Id = Common.GuId(), F_Pid = input.PatientId, F_DialylisNo = patient.F_DialysisNo, F_PName = patient.F_Name, F_PGender = patient.F_Gender, F_BillingDateTime = billingDateTime, F_BillingPersonId = user.F_Id, F_BillingPerson = user.F_RealName, F_CreatorTime = DateTime.Now, F_CreatorUserId = user.F_Id, F_EnabledMark = true }; switch (item.BillType) { case 1: entity.F_ItemClass = "药品"; var findDrug = await drugDict.GetForm(item.ItemId); if (findDrug != null) { entity.F_ItemId = item.ItemId; entity.F_ItemCode = findDrug.F_DrugCode; entity.F_ItemName = findDrug.F_DrugName; entity.F_ItemSpec = findDrug.F_DrugSpec; entity.F_ItemUnit = findDrug.F_DrugUnit; entity.F_Amount = item.Amount; entity.F_Charges = entity.F_Costs = item.Amount * findDrug.F_Charges; entity.F_Supplier = findDrug.F_DrugSupplier; list.Add(entity); } break; case 2: entity.F_ItemClass = "耗材"; var findMaterials = await materials.GetForm(item.ItemId); if (findMaterials != null) { entity.F_ItemId = item.ItemId; entity.F_ItemCode = findMaterials.F_MaterialCode; entity.F_ItemName = findMaterials.F_MaterialName; entity.F_ItemSpec = findMaterials.F_MaterialSpec; entity.F_ItemUnit = findMaterials.F_MaterialUnit; entity.F_Amount = item.Amount; entity.F_Charges = entity.F_Costs = item.Amount * findMaterials.F_Charges; entity.F_Supplier = findMaterials.F_MaterialSupplier; list.Add(entity); } break; case 3: entity.F_ItemClass = "诊疗"; var treatmentEntity = await treatments.GetForm(item.ItemId); if (treatmentEntity != null) { entity.F_ItemId = item.ItemId; entity.F_ItemCode = treatmentEntity.F_TreatmentCode; entity.F_ItemName = treatmentEntity.F_TreatmentName; entity.F_ItemSpec = treatmentEntity.F_TreatmentSpec; entity.F_ItemUnit = treatmentEntity.F_TreatmentUnit; entity.F_Amount = item.Amount; entity.F_Charges = entity.F_Costs = item.Amount * treatmentEntity.F_Charges; //entity.F_Supplier = findtreatments; list.Add(entity); } break; } } await _billingApp.InsertList(list); totalCosts = list.Sum(t => t.F_Costs).ToFloat(2); var data = new { totalCosts }; return(Ok(data)); }