Commit ea61b185 by ruyun.zhang@suvalue.com

科室字典显示

parents cf5db7db 17cb0ca0
...@@ -10,14 +10,14 @@ public class DeptdicResponse ...@@ -10,14 +10,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 string OutDoctorAccounting { get; set; } public Deptdic OutDoctorAccounting { get; set; }
public string OutNurseAccounting { get; set; } public Deptdic OutNurseAccounting { get; set; }
public string OutTechnicAccounting { get; set; } public Deptdic OutTechnicAccounting { get; set; }
public string InpatDoctorAccounting { get; set; } public Deptdic InpatDoctorAccounting { get; set; }
public string InpatNurseAccounting { get; set; } public Deptdic InpatNurseAccounting { get; set; }
public string InpatTechnicAccounting { get; set; } public Deptdic InpatTechnicAccounting { get; set; }
public string LogisticsAccounting { get; set; } public Deptdic LogisticsAccounting { get; set; }
public string SpecialAccounting { get; set; } public Deptdic SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
public int IsVerify { get; set; } public int IsVerify { get; set; }
} }
......
...@@ -41,7 +41,7 @@ public static decimal TryDecimal(string inValue, decimal defaultValue = default( ...@@ -41,7 +41,7 @@ public static decimal TryDecimal(string inValue, decimal defaultValue = default(
{ {
return decimal.TryParse(input?.ToString(), out decimal tmpvalue) ? tmpvalue : null; return decimal.TryParse(input?.ToString(), out decimal tmpvalue) ? tmpvalue : null;
} }
catch (Exception ex) catch (Exception)
{ {
throw; throw;
} }
...@@ -84,7 +84,7 @@ public static T To<T>(object value, T defaultValue = default(T)) ...@@ -84,7 +84,7 @@ public static T To<T>(object value, T defaultValue = default(T))
return (T)Convert.ChangeType(value, type); return (T)Convert.ChangeType(value, type);
return (T)value; return (T)value;
} }
catch (Exception ex) catch (Exception)
{ {
return defaultValue; return defaultValue;
} }
......
...@@ -308,7 +308,6 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List< ...@@ -308,7 +308,6 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<
{ {
t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department); t.HISDeptName = WriteDataHelper.HasValue(t.HISDeptName, t.Department);
}); });
var data = new List<ExtractTransDto>(); var data = new List<ExtractTransDto>();
foreach (var item in results) foreach (var item in results)
{ {
...@@ -322,13 +321,13 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List< ...@@ -322,13 +321,13 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<
DoctorName = item.DoctorName, DoctorName = item.DoctorName,
PersonnelNumber = item.PersonnelNumber, PersonnelNumber = item.PersonnelNumber,
Value = item.Fee ?? 0, Value = item.Fee ?? 0,
OutDoctorAccounting = firstDic?.OutDoctorAccounting, OutDoctorAccounting = firstDic?.OutDoctorAccounting?.AccountingUnit,
OutNurseAccounting = firstDic?.OutNurseAccounting, OutNurseAccounting = firstDic?.OutNurseAccounting?.AccountingUnit,
OutTechnicAccounting = firstDic?.OutTechnicAccounting, OutTechnicAccounting = firstDic?.OutTechnicAccounting?.AccountingUnit,
InpatDoctorAccounting = firstDic?.InpatDoctorAccounting, InpatDoctorAccounting = firstDic?.InpatDoctorAccounting?.AccountingUnit,
InpatNurseAccounting = firstDic?.InpatNurseAccounting, InpatNurseAccounting = firstDic?.InpatNurseAccounting?.AccountingUnit,
InpatTechnicAccounting = firstDic?.InpatTechnicAccounting, InpatTechnicAccounting = firstDic?.InpatTechnicAccounting?.AccountingUnit,
SpecialAccounting = firstDic?.SpecialAccounting ?? dept, SpecialAccounting = firstDic?.SpecialAccounting?.AccountingUnit ?? dept,
EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName, EName = types.FirstOrDefault(w => w.Id == item.TypeId)?.EName,
}; };
data.Add(d); data.Add(d);
......
...@@ -423,24 +423,33 @@ public IEnumerable<DeptdicResponse> GetDepartments(int allotId) ...@@ -423,24 +423,33 @@ public IEnumerable<DeptdicResponse> GetDepartments(int allotId)
var allot = perallotRepository.GetEntity(t => t.ID == allotId); var allot = perallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null || !depts.Any()) return null; if (allot == null || !depts.Any()) return null;
Func<per_dept_dic, string> getDeptdic = (dic) => dic?.AccountingUnit; Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptName, UnitType unitType, string source = "")
var result = depts.GroupBy(t => new { t.HISDeptName, t.Department }).Select(t => new DeptdicResponse
{ {
AllotId = allotId, var dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString() && group.Source == source);
HospitalId = allot.HospitalId, if (dic == null)
HISDeptName = t.Key.HISDeptName, dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString());
Department = t.Key.Department, if (dic == null) return new Deptdic() { IsVerify = 1 };
OutDoctorAccounting = getDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医生组.ToString() && group.Source == "门诊")), return new Deptdic { Id = dic.Id, AccountingUnit = dic.AccountingUnit, IsVerify = dic.IsVerify ?? 1, VerifyMessage = dic.VerifyMessage, };
OutNurseAccounting = getDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.护理组.ToString() && group.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 == "住院")), var result = depts
InpatNurseAccounting = getDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.护理组.ToString() && group.Source == "住院")), .GroupBy(t => new { t.HISDeptName, t.Department })
InpatTechnicAccounting = getDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医技组.ToString() && group.Source == "住院")), .Select(t => new DeptdicResponse
LogisticsAccounting = getDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && UnitTypeUtil.Office.Contains(group.UnitType))), {
SpecialAccounting = getDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.特殊核算组.ToString())), HospitalId = allot.HospitalId,
CreateTime = t.Max(group => group.CreateTime), HISDeptName = t.Key.HISDeptName,
IsVerify = t.Min(w => w.IsVerify) ?? 1, 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);
} }
......
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