科室字典修改为按月单独存储

parent 9c91da6a
...@@ -230,13 +230,13 @@ public ApiResponse<List<sys_role>> RoleList() ...@@ -230,13 +230,13 @@ public ApiResponse<List<sys_role>> RoleList()
/// <summary> /// <summary>
/// 科室列表 /// 科室列表
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
[Route("department")] [Route("department/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse<List<TitleValue>> Department([FromBody] SetDepartmentRequest request) public ApiResponse<List<TitleValue>> Department(int allotId)
{ {
var department = _userService.Department(request.HospitalID); var department = _userService.Department(allotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "ok", department); return new ApiResponse<List<TitleValue>>(ResponseType.OK, "ok", department);
} }
......
...@@ -868,14 +868,15 @@ public ApiResponse CopyDropDown() ...@@ -868,14 +868,15 @@ public ApiResponse CopyDropDown()
{ {
var result = new List<CopyDrop> var result = new List<CopyDrop>
{ {
new CopyDrop{Label="核算单元及组别",Value="accountings"},
new CopyDrop{Label="科室字典",Value="department"},
new CopyDrop{Label="人员字典",Value="personnels"}, new CopyDrop{Label="人员字典",Value="personnels"},
new CopyDrop{Label="工作量配置",Value="workItems"}, new CopyDrop{Label="工作量配置",Value="workItems"},
new CopyDrop{Label="收入费用类别",Value="drugTypes"}, //new CopyDrop{Label="收入费用类别",Value="drugTypes"},
new CopyDrop{Label="支出费用类别",Value="drugTypeDisburses"}, new CopyDrop{Label="支出费用类别",Value="drugTypeDisburses"},
new CopyDrop{Label="费用类别系数",Value="drugTypeFactors"}, new CopyDrop{Label="费用类别系数",Value="drugTypeFactors"},
/* new CopyDrop{Label="科室类型",Value="deptTypes"},*/ //new CopyDrop{Label="科室类型",Value="deptTypes"},
new CopyDrop{Label="二次绩效配置",Value="agains"}, new CopyDrop{Label="二次绩效配置",Value="agains"},
new CopyDrop{Label="核算单元及组别",Value="accountings"},
}; ; }; ;
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
......
...@@ -129,13 +129,13 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId) ...@@ -129,13 +129,13 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId)
/// <summary> /// <summary>
/// 获取所有科室记录 /// 获取所有科室记录
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
[Route("deptdic/list/{hospitalId}")] [Route("deptdic/list/{allotId}")]
[HttpPost] [HttpPost]
public ApiResponse GetDepartments(int hospitalId) public ApiResponse GetDepartments(int allotId)
{ {
var list = personService.GetDepartments(hospitalId); var list = personService.GetDepartments(allotId);
return new ApiResponse(ResponseType.OK, list); return new ApiResponse(ResponseType.OK, list);
} }
...@@ -194,14 +194,14 @@ public ApiResponse DeleteDeptDic([FromBody] DeptdicResponse request) ...@@ -194,14 +194,14 @@ public ApiResponse DeleteDeptDic([FromBody] DeptdicResponse request)
/// <param name="hospitalId">医院Id</param> /// <param name="hospitalId">医院Id</param>
/// <param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param> /// <param name="type">1系统科室 2标准科室 3核算单元 4行政后勤 5特殊核算组</param>
/// <returns></returns> /// <returns></returns>
[Route("deptdic/{hospitalId}/dict/{type}")] [Route("deptdic/{allotId}/dict/{type}")]
[HttpPost] [HttpPost]
public ApiResponse DeptDics(int hospitalId, int type) public ApiResponse DeptDics(int allotId, int type)
{ {
if (!new int[] { 1, 2, 3, 4, 5 }.Contains(type)) if (!new int[] { 1, 2, 3, 4, 5 }.Contains(type))
return new ApiResponse(ResponseType.ParameterError, "参数错误!"); return new ApiResponse(ResponseType.ParameterError, "参数错误!");
var result = personService.DeptDics(hospitalId, type); var result = personService.DeptDics(allotId, type);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -234,10 +234,10 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro ...@@ -234,10 +234,10 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("person/GetBatchPersonStructrue/{hospitalId}")] [Route("person/GetBatchPersonStructrue/{allotId}")]
public ApiResponse GetBatchPersonStructrue(int hospitalId) public ApiResponse GetBatchPersonStructrue(int allotId)
{ {
var result = personService.GetBatchPersonStructrue(hospitalId); var result = personService.GetBatchPersonStructrue(allotId);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -257,10 +257,10 @@ public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData r ...@@ -257,10 +257,10 @@ public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData r
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("dept/GetDeptStructrue/{hospitalId}")] [Route("dept/GetDeptStructrue/{allotId}")]
public ApiResponse GetDeptStructrue(int hospitalId) public ApiResponse GetDeptStructrue(int allotId)
{ {
var result = personService.GetDepartmentHands(hospitalId); var result = personService.GetDepartmentHands(allotId);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
...@@ -269,10 +269,10 @@ public ApiResponse GetDeptStructrue(int hospitalId) ...@@ -269,10 +269,10 @@ public ApiResponse GetDeptStructrue(int hospitalId)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("dept/SaveDeptHands/{hospitalId}")] [Route("dept/SaveDeptHands/{allotId}")]
public ApiResponse SaveDeptHands(int hospitalId, SaveCollectData request) public ApiResponse SaveDeptHands(int allotId, SaveCollectData request)
{ {
personService.SaveDeptDicHands(hospitalId, request); personService.SaveDeptDicHands(allotId, request);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
......
...@@ -62,11 +62,11 @@ ...@@ -62,11 +62,11 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AccountController.Department(Performance.DtoModels.SetDepartmentRequest)"> <member name="M:Performance.Api.Controllers.AccountController.Department(System.Int32)">
<summary> <summary>
科室列表 科室列表
</summary> </summary>
<param name="request"></param> <param name="allotId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AccountController.DemoUsers"> <member name="M:Performance.Api.Controllers.AccountController.DemoUsers">
...@@ -1724,7 +1724,7 @@ ...@@ -1724,7 +1724,7 @@
<summary> <summary>
获取所有科室记录 获取所有科室记录
</summary> </summary>
<param name="hospitalId"></param> <param name="allotId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.PersonController.CreateDeptDic(Performance.EntityModels.per_dept_dic)"> <member name="M:Performance.Api.Controllers.PersonController.CreateDeptDic(Performance.EntityModels.per_dept_dic)">
......
...@@ -6620,6 +6620,11 @@ ...@@ -6620,6 +6620,11 @@
医院Id 医院Id
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.per_dept_dic.AllotId">
<summary>
AllotId
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.IsVerify"> <member name="P:Performance.EntityModels.per_dept_dic.IsVerify">
<summary> <summary>
0 未通过验证 1 通过验证 0 未通过验证 1 通过验证
......
...@@ -6,6 +6,7 @@ namespace Performance.DtoModels ...@@ -6,6 +6,7 @@ namespace Performance.DtoModels
{ {
public class DeptdicResponse public class DeptdicResponse
{ {
public int AllotId { get; set; }
public int HospitalId { get; set; } public int HospitalId { get; set; }
public string HISDeptName { get; set; } public string HISDeptName { get; set; }
public string Department { get; set; } public string Department { get; set; }
......
...@@ -50,6 +50,10 @@ public class per_dept_dic ...@@ -50,6 +50,10 @@ public class per_dept_dic
/// 医院Id /// 医院Id
/// </summary> /// </summary>
public Nullable<int> HospitalId { get; set; } public Nullable<int> HospitalId { get; set; }
/// <summary>
/// AllotId
/// </summary>
public Nullable<int> AllotId { get; set; }
/// <summary> /// <summary>
/// 0 未通过验证 1 通过验证 /// 0 未通过验证 1 通过验证
......
...@@ -121,6 +121,40 @@ public class AllotService : IAutoInjection ...@@ -121,6 +121,40 @@ public class AllotService : IAutoInjection
this.queryDataService = queryDataService; this.queryDataService = queryDataService;
} }
#region 先取上一个月的绩效Id
/// <summary>
/// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
/// </summary>
/// <param name="allot"></param>
public int GetPrevAllot(int allotId)
{
var allot = _allotRepository.GetEntity(t => t.ID == allotId);
return GetPrevAllot(allot);
}
/// <summary>
/// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
/// </summary>
/// <param name="allot"></param>
public int GetPrevAllot(per_allot allot)
{
var list = _allotRepository.GetEntities(t => t.HospitalId == allot.HospitalId);
if (list == null || !list.Any(t => t.ID == allot.ID))
return -1;
list = list.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
var index = list.IndexOf(list.First(t => t.ID == allot.ID));
// 先取上一个月的绩效Id,若没有取最后一个月的绩效Id,若都不存在则获取allotId为-1的数据
int allotId = index + 1 < list.Count ? list[index + 1].ID : list.First().ID;
if (allotId == allot.ID)
return -1;
return allotId;
}
#endregion
#region 基础功能 #region 基础功能
/// <summary> /// <summary>
......
...@@ -560,7 +560,7 @@ private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType, str ...@@ -560,7 +560,7 @@ private List<HandsonRowData> GetAccountExtra(per_allot allot, int sheetType, str
var unitTypes = new string[] { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.护理组.ToString(), UnitType.特殊核算组.ToString() }; var unitTypes = new string[] { UnitType.医生组.ToString(), UnitType.医技组.ToString(), UnitType.护理组.ToString(), UnitType.特殊核算组.ToString() };
var departments = perforPerdeptdicRepository.GetEntities(t => t.HospitalId == allot.HospitalId && unitTypes.Contains(t.UnitType) && !string.IsNullOrEmpty(t.Department) && t.Department.Replace("无", "").Replace("/", "").Trim() != ""); var departments = perforPerdeptdicRepository.GetEntities(t => t.AllotId == allot.ID && unitTypes.Contains(t.UnitType) && !string.IsNullOrEmpty(t.Department) && t.Department.Replace("无", "").Replace("/", "").Trim() != "");
if (departments == null || !departments.Any()) return handsonRows; if (departments == null || !departments.Any()) return handsonRows;
var data = departments.GroupBy(t => t.Department).Select(t => new var data = departments.GroupBy(t => t.Department).Select(t => new
......
...@@ -90,7 +90,7 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath) ...@@ -90,7 +90,7 @@ public bool ExtractData(int userId, int allotId, out string resultFilePath)
result = false; result = false;
return result; return result;
} }
var depts = _perforPerdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId); var depts = _perforPerdeptdicRepository.GetEntities(w => w.AllotId == allot.ID);
IWorkbook workbook = null; IWorkbook workbook = null;
try try
......
...@@ -1546,7 +1546,7 @@ public void CheckGatherData(int allotId, SaveGatherData saveGather) ...@@ -1546,7 +1546,7 @@ public void CheckGatherData(int allotId, SaveGatherData saveGather)
var data = saveGather.Data; var data = saveGather.Data;
var departments = perdeptdicRepository.GetEntities(w => w.HospitalId == allot.HospitalId); var departments = perdeptdicRepository.GetEntities(w => w.AllotId == allot.ID);
if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典"); if (departments == null || !departments.Any()) throw new PerformanceException("未配置科室字典");
var notExistsDeptData = data.Where(w => !departments.Select(t => t.Department).Contains(w[0])); var notExistsDeptData = data.Where(w => !departments.Select(t => t.Department).Contains(w[0]));
......
...@@ -741,7 +741,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin ...@@ -741,7 +741,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
var allot = perallotRepository.GetEntity(t => t.ID == allotId); var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var drugTypes = cofdrugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId); var drugTypes = cofdrugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
var deptDic = perdeptdicRepository.GetEntities(t => t.HospitalId == allot.HospitalId); var deptDic = perdeptdicRepository.GetEntities(t => t.AllotId == allot.ID);
var moduleSheet = exmoduleRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.SheetType == (int)SheetType.Income); var moduleSheet = exmoduleRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.SheetType == (int)SheetType.Income);
if (moduleSheet == null || !moduleSheet.Any()) return null; if (moduleSheet == null || !moduleSheet.Any()) return null;
...@@ -786,6 +786,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin ...@@ -786,6 +786,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
UnitType = defauleUnittype, UnitType = defauleUnittype,
Source = source, Source = source,
HospitalId = allot.HospitalId, HospitalId = allot.HospitalId,
AllotId = allot.ID,
IsVerify = 0, IsVerify = 0,
VerifyMessage = "抽取前科室校验后补增科室", VerifyMessage = "抽取前科室校验后补增科室",
CreateUser = 1 CreateUser = 1
......
...@@ -99,7 +99,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -99,7 +99,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var dict = new Dictionary<ExDataDict, object>(); var dict = new Dictionary<ExDataDict, object>();
logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle); logService.ReturnTheLog(allotId, groupName, 3, "", 5, 1, isSingle);
queryService.ClearConnectionPools(); queryService.ClearConnectionPools();
queryService.ClearHistoryData(allot.ID, groupName, isSingle); queryService.ClearHistoryData(allot.ID, groupName, isSingle);
...@@ -107,7 +107,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName, ...@@ -107,7 +107,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var data = exresultRepository.GetEntities(t => t.AllotId == allotId); var data = exresultRepository.GetEntities(t => t.AllotId == allotId);
data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict)); data.AddRange(queryService.Handler(hospitalId, allot, groupName, isSingle, ref dict));
var standData = StandDataFormat(hospitalId, data); var standData = StandDataFormat(hospitalId, allotId, data);
dictionaryService.Handler(hospitalId, allot, groupName, isSingle); dictionaryService.Handler(hospitalId, allot, groupName, isSingle);
...@@ -275,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr ...@@ -275,10 +275,11 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr
/// <summary> /// <summary>
/// 标准数据格式, 匹配科室字典 /// 标准数据格式, 匹配科室字典
/// </summary> /// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="results"></param> /// <param name="results"></param>
/// <returns></returns> /// <returns></returns>
private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> results) private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<ex_result> results)
{ {
if (results == null || !results.Any()) return new List<ExtractTransDto>(); if (results == null || !results.Any()) return new List<ExtractTransDto>();
...@@ -290,7 +291,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -290,7 +291,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>(); var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>();
var dict = personService.GetDepartments(hospitalId)?.ToList(); var dict = personService.GetDepartments(allotId)?.ToList();
if (dict == null || !dict.Any()) if (dict == null || !dict.Any())
{ {
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
......
...@@ -52,7 +52,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style, ...@@ -52,7 +52,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
if (departments == null || !departments.Any()) return; if (departments == null || !departments.Any()) return;
var standardDict = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId && departments.Contains(t.Department)) ?? new List<per_dept_dic>(); var standardDict = perdeptdicRepository.GetEntities(t => t.AllotId == allotId && departments.Contains(t.Department)) ?? new List<per_dept_dic>();
WriteSheetDataNonexistent(sheet, cellStyle, point, columns, departments, standardDict, costTransfers, costTransferItems); WriteSheetDataNonexistent(sheet, cellStyle, point, columns, departments, standardDict, costTransfers, costTransferItems);
} }
......
...@@ -452,53 +452,12 @@ public List<sys_role> RoleList(int userId) ...@@ -452,53 +452,12 @@ public List<sys_role> RoleList(int userId)
/// 科室列表 /// 科室列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<TitleValue> Department(int hospitalId) public List<TitleValue> Department(int allotId)
{ {
//var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId); var list = _perdeptdicRepository.GetEntities(t => t.AllotId == allotId);
//var result = new List<string>();
//if (allotList != null)
//{
// var idList = allotList.Select(s => s.ID).ToList();
// //var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department);
// //if (department != null && department.Count() > 0)
// // result.AddRange(department);
// var department = _imaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.DoctorAccountingUnit);
// if (department != null && department.Count() > 0)
// result.AddRange(department);
// // 特殊科室
// department = _imspecialunitRepository.GetEntities(t => !string.IsNullOrEmpty(t.AccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.AccountingUnit);
// if (department != null && department.Count() > 0)
// result.AddRange(department);
// if (result != null && result.Any())
// {
// result = result.Distinct().OrderBy(t => t).ToList();
// }
//}
var list = _perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
if (list == null || !list.Any()) return new List<TitleValue>(); if (list == null || !list.Any()) return new List<TitleValue>();
var result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t).ToList(); var result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t).ToList();
//// 补充行政科室
//var states = new int[] { (int)AllotStates.Archive, (int)AllotStates.GenerateAccomplish };
//var allots = _perallotRepository.GetEntities(w => w.HospitalId == hospitalId && states.Contains(w.States));
//if (allots != null && allots.Any())
//{
// var allot = allots.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).FirstOrDefault();
// if (allot != null)
// {
// var types = new int[] { (int)UnitType.行政中层, (int)UnitType.行政后勤 };
// var accounts = _resaccountRepository.GetEntities(w => w.AllotID == allot.ID && w.UnitType.HasValue && types.Contains(w.UnitType.Value));
// if (accounts != null && accounts.Any())
// {
// result.AddRange(accounts.Select(w => w.AccountingUnit));
// }
// }
//}
return result?.Select(t => new TitleValue { Title = t, Value = t }).ToList(); return result?.Select(t => new TitleValue { Title = t, Value = t }).ToList();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment