提取适配额外收入核算单元

parent 269a458b
...@@ -9,14 +9,14 @@ public class DeptdicResponse ...@@ -9,14 +9,14 @@ public class DeptdicResponse
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; }
public Deptdic OutDoctorAccounting { get; set; } public string OutDoctorAccounting { get; set; }
public Deptdic OutNurseAccounting { get; set; } public string OutNurseAccounting { get; set; }
public Deptdic OutTechnicAccounting { get; set; } public string OutTechnicAccounting { get; set; }
public Deptdic InpatDoctorAccounting { get; set; } public string InpatDoctorAccounting { get; set; }
public Deptdic InpatNurseAccounting { get; set; } public string InpatNurseAccounting { get; set; }
public Deptdic InpatTechnicAccounting { get; set; } public string InpatTechnicAccounting { get; set; }
public Deptdic LogisticsAccounting { get; set; } public string LogisticsAccounting { get; set; }
public Deptdic SpecialAccounting { get; set; } public string SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
public int IsVerify { get; set; } public int IsVerify { get; set; }
} }
......
...@@ -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);
...@@ -320,13 +320,13 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -320,13 +320,13 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
DoctorName = t.outer.DoctorName, DoctorName = t.outer.DoctorName,
PersonnelNumber = t.outer.PersonnelNumber, PersonnelNumber = t.outer.PersonnelNumber,
Value = t.outer.Fee ?? 0, Value = t.outer.Fee ?? 0,
OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting?.AccountingUnit, OutDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutDoctorAccounting,
OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting?.AccountingUnit, OutNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutNurseAccounting,
OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting?.AccountingUnit, OutTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.OutTechnicAccounting,
InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting?.AccountingUnit, InpatDoctorAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatDoctorAccounting,
InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting?.AccountingUnit, InpatNurseAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatNurseAccounting,
InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting?.AccountingUnit, InpatTechnicAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.InpatTechnicAccounting,
SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting?.AccountingUnit ?? dept, SpecialAccounting = t.inner.FirstOrDefault(f => f.Department == dept)?.SpecialAccounting ?? dept,
EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName, EName = types.FirstOrDefault(w => w.Id == t.outer.TypeId)?.EName,
}; };
}); });
......
...@@ -426,22 +426,38 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId) ...@@ -426,22 +426,38 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
var depts = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId); var depts = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
if (depts == null || !depts.Any()) return null; if (depts == null || !depts.Any()) return null;
var result = depts.GroupBy(t => new { t.HISDeptName, t.Department }).Select(t => new DeptdicResponse string GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptName, UnitType unitType, string source = "")
{ {
HospitalId = hospitalId, if (hISDeptName == "介入室")
HISDeptName = t.Key.HISDeptName, {
Department = t.Key.Department,
OutDoctorAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医生组.ToString() && group.Source == "门诊")), }
OutNurseAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.护理组.ToString() && group.Source == "门诊")), var dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString() && group.Source == source);
OutTechnicAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医技组.ToString() && group.Source == "门诊")),
InpatDoctorAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医生组.ToString() && group.Source == "住院")), if (dic == null)
InpatNurseAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.护理组.ToString() && group.Source == "住院")), dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString());
InpatTechnicAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医技组.ToString() && group.Source == "住院")),
LogisticsAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.行政后勤.ToString())), return dic?.AccountingUnit;
SpecialAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.特殊核算组.ToString())), }
CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1, var result = depts
}); .GroupBy(t => new { t.HISDeptName, t.Department })
.Select(t => new DeptdicResponse
{
HospitalId = hospitalId,
HISDeptName = t.Key.HISDeptName,
Department = t.Key.Department,
OutDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "门诊"),
OutNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "门诊"),
OutTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "门诊"),
InpatDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "住院"),
InpatNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "住院"),
InpatTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "住院"),
LogisticsAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.行政后勤),
SpecialAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.特殊核算组),
CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1,
});
return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department); return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department);
} }
...@@ -472,19 +488,6 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId) ...@@ -472,19 +488,6 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
return ("", new string[] { }); return ("", new string[] { });
} }
private Deptdic GetDeptdic(per_dept_dic dic)
{
if (dic == null) return new Deptdic() { IsVerify = 1 };
return new Deptdic
{
Id = dic.Id,
AccountingUnit = dic.AccountingUnit,
IsVerify = dic.IsVerify ?? 1,
VerifyMessage = dic.VerifyMessage,
};
}
/// <summary> /// <summary>
/// 创建科室核算信息 /// 创建科室核算信息
/// </summary> /// </summary>
......
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