Commit 3a18022c by lcx

二次绩效工作量、门诊住院开单收入修改

parent 86cfe016
...@@ -8,7 +8,7 @@ namespace Performance.DtoModels ...@@ -8,7 +8,7 @@ namespace Performance.DtoModels
public class WorkDetailRequest public class WorkDetailRequest
{ {
public int AllotId { get; set; } public int AllotId { get; set; }
public int SecondId { get; set; } //public int SecondId { get; set; }
public string Source { get; set; } public string Source { get; set; }
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
} }
...@@ -20,7 +20,7 @@ public WorkDetailRequestValidator() ...@@ -20,7 +20,7 @@ public WorkDetailRequestValidator()
RuleSet("Select", () => RuleSet("Select", () =>
{ {
RuleFor(x => x.AllotId).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0); //RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.AccountingUnit).NotNull().NotEmpty(); RuleFor(x => x.AccountingUnit).NotNull().NotEmpty();
}); });
} }
......
...@@ -173,22 +173,25 @@ public void ImportWorkloadData(per_allot allot, object parameters) ...@@ -173,22 +173,25 @@ public void ImportWorkloadData(per_allot allot, object parameters)
/// 查询工作量数据 /// 查询工作量数据
/// </summary> /// </summary>
/// <param name="allotid"></param> /// <param name="allotid"></param>
public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, string accountingunit, string unittype, int hospitalid) public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, string accountingunit, string[] unittypes, int hospitalid)
{ {
using (var connection = context.Database.GetDbConnection()) using (var connection = context.Database.GetDbConnection())
{ {
if (connection.State != ConnectionState.Open) connection.Open(); if (connection.State != ConnectionState.Open) connection.Open();
try try
{ {
string unittype = unittypes.Any(t => !string.IsNullOrEmpty(t) && t.Contains("医生"))
? "医生组"
: unittypes.Any(t => !string.IsNullOrEmpty(t) && t.Contains("护理")) ? "护理组" : "其他组";
string clear = @"SELECT DISTINCT t3.AccountingUnit as Department,ifnull(t1.DoctorName, '未知') DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1 string clear = @"SELECT DISTINCT t3.AccountingUnit as Department,ifnull(t1.DoctorName, '未知') DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1
JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid WHERE t1.allotid = @allotid
AND t3.unittype = @unittype AND t3.unittype in @unittypes
AND t3.accountingunit = @accountingunit AND t3.accountingunit = @accountingunit
AND t1.Source LIKE CONCAT('%',@unittype,'工作量%') AND t1.Source LIKE CONCAT('%',@unittype,'工作量%')
AND T1.IsDelete = 0 AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;"; ORDER BY t1.doctorname,t1.Category;";
return connection.Query<report_original_workload>(clear, new { allotid, accountingunit, unittype, hospitalid }, commandTimeout: 60 * 60); return connection.Query<report_original_workload>(clear, new { allotid, accountingunit, unittypes, unittype, hospitalid }, commandTimeout: 60 * 60);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -201,7 +204,7 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri ...@@ -201,7 +204,7 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri
/// 查询门诊收入数据 /// 查询门诊收入数据
/// </summary> /// </summary>
/// <param name="allotid"></param> /// <param name="allotid"></param>
public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string accountingunit, string unittype, int hospitalid) public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string accountingunit, string[] unittype, int hospitalid)
{ {
using (var connection = context.Database.GetDbConnection()) using (var connection = context.Database.GetDbConnection())
{ {
...@@ -211,7 +214,7 @@ public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string ...@@ -211,7 +214,7 @@ public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string
string clear = $@"SELECT DISTINCT t3.AccountingUnit as Department,ifnull(t1.DoctorName, '未知') DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1 string clear = $@"SELECT DISTINCT t3.AccountingUnit as Department,ifnull(t1.DoctorName, '未知') DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1
JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid WHERE t1.allotid = @allotid
AND t3.unittype = @unittype AND t3.unittype in @unittype
AND t3.accountingunit = @accountingunit AND t3.accountingunit = @accountingunit
AND (t1.Source like '%{source}开单%' OR t1.Source like '%{source}就诊%') AND (t1.Source like '%{source}开单%' OR t1.Source like '%{source}就诊%')
AND T1.IsDelete = 0 AND T1.IsDelete = 0
......
...@@ -509,15 +509,14 @@ public List<TitleValue> DeptDics(int hospitalId, int type) ...@@ -509,15 +509,14 @@ public List<TitleValue> DeptDics(int hospitalId, int type)
/// <returns></returns> /// <returns></returns>
public object DeptWorkloadDetail(WorkDetailRequest request, int userId) public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
{ {
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId); string[] unitTypes = GetUnitType(userId);
if (second == null) if (unitTypes == null || !unitTypes.Any()) return new string[] { };
return null;
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId); var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null) if (allot == null)
return null; return null;
var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, second.UnitType, allot.HospitalId); var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, unitTypes, allot.HospitalId);
if (data != null && data.Any()) if (data != null && data.Any())
{ {
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category }) return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
...@@ -541,9 +540,8 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId) ...@@ -541,9 +540,8 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
/// <returns></returns> /// <returns></returns>
public object DeptIncomeDetail(WorkDetailRequest request, int userId) public object DeptIncomeDetail(WorkDetailRequest request, int userId)
{ {
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId); string[] unitTypes = GetUnitType(userId);
if (second == null) if (unitTypes == null || !unitTypes.Any()) return new string[] { };
return null;
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId); var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null) if (allot == null)
...@@ -552,7 +550,7 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId) ...@@ -552,7 +550,7 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
if (!sources.Contains(request.Source)) if (!sources.Contains(request.Source))
throw new PerformanceException($"数据来源错误,只支持:{string.Join(";", sources)}"); throw new PerformanceException($"数据来源错误,只支持:{string.Join(";", sources)}");
var data = perallotRepository.QueryIncomeData(request.AllotId, request.Source, request.AccountingUnit, second.UnitType, allot.HospitalId); var data = perallotRepository.QueryIncomeData(request.AllotId, request.Source, request.AccountingUnit, unitTypes, allot.HospitalId);
if (data != null && data.Any()) if (data != null && data.Any())
{ {
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category }) return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
...@@ -568,5 +566,27 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId) ...@@ -568,5 +566,27 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
return new string[] { }; return new string[] { };
} }
private string[] GetUnitType(int userId)
{
Dictionary<int, string[]> dict = new Dictionary<int, string[]>
{
{ application.DirectorRole, new string []{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.其他医技组.ToString(), UnitType.医技组.ToString() } },
{ application.NurseRole, new string []{ UnitType.护理组.ToString(), UnitType.其他护理组.ToString() } },
{ application.SpecialRole, new string []{ UnitType.特殊核算组.ToString() } },
{ application.OfficeRole, new string []{ UnitType.行政后勤.ToString() } },
};
var user = perforUserRepository.GetEntity(t => t.ID == userId);
if (user == null)
throw new NotImplementedException("人员ID无效");
var userrole = perforUserroleRepository.GetEntity(t => t.UserID == userId);
var role = perforRoleRepository.GetEntity(t => t.ID == userrole.RoleID);
if (!role.Type.HasValue || !dict.ContainsKey(role.Type.Value))
return new string[] { };
return dict[role.Type.Value];
}
} }
} }
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