Commit 3604709a by 钟博

Cof_drugtype表中补全HospitalId字段内容

parent 4030fe47
...@@ -258,7 +258,7 @@ public ConfigController(ConfigService configService, AllotService allotService) ...@@ -258,7 +258,7 @@ public ConfigController(ConfigService configService, AllotService allotService)
[HttpPost] [HttpPost]
public ApiResponse GetDrugtypeList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request) public ApiResponse GetDrugtypeList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{ {
var list = _configService.GetDrugtypeList(request.AllotID); var list = _configService.GetDrugtypeList(request.HospitalId,request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list); return new ApiResponse(ResponseType.OK, "ok", list);
} }
......
...@@ -9,6 +9,8 @@ public class DrugpropRequest ...@@ -9,6 +9,8 @@ public class DrugpropRequest
{ {
public int ID { get; set; } public int ID { get; set; }
public int HospitalId { get; set; }
public int AllotID { get; set; } public int AllotID { get; set; }
/// <summary> /// <summary>
/// 药占比最大范围(小于) /// 药占比最大范围(小于)
...@@ -43,6 +45,7 @@ public DrugpropRequestValidator() ...@@ -43,6 +45,7 @@ public DrugpropRequestValidator()
RuleSet("Insert", () => RuleSet("Insert", () =>
{ {
RuleFor(x => x.HospitalId).NotNull().GreaterThan(0);
RuleFor(x => x.AllotID).NotNull().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
}); });
......
...@@ -20,7 +20,12 @@ public class cof_drugtype ...@@ -20,7 +20,12 @@ public class cof_drugtype
/// </summary> /// </summary>
[Key] [Key]
public int ID { get; set; } public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
......
...@@ -318,9 +318,9 @@ public class ConfigService : IAutoInjection ...@@ -318,9 +318,9 @@ public class ConfigService : IAutoInjection
/// 获取cof_drugprop列表 /// 获取cof_drugprop列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<cof_drugtype> GetDrugtypeList(int allotId) public List<cof_drugtype> GetDrugtypeList(int HospitalId, int allotId)
{ {
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId); var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId && t.HospitalId==HospitalId);
return list; return list;
} }
...@@ -333,6 +333,7 @@ public cof_drugtype DrugtypeInsert(DrugpropRequest request) ...@@ -333,6 +333,7 @@ public cof_drugtype DrugtypeInsert(DrugpropRequest request)
{ {
var entity = new cof_drugtype var entity = new cof_drugtype
{ {
HospitalId = request.HospitalId,
AllotID = request.AllotID, AllotID = request.AllotID,
Charge = request.Charge, Charge = request.Charge,
ChargeType = request.ChargeType ChargeType = request.ChargeType
...@@ -715,7 +716,7 @@ public void Copy(per_allot allot) ...@@ -715,7 +716,7 @@ public void Copy(per_allot allot)
if (cofDrugtype == null || cofDrugtype.Count == 0) if (cofDrugtype == null || cofDrugtype.Count == 0)
{ {
var drugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1); var drugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
var newAgains = drugtype.Select(t => new cof_drugtype { AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType }); var newAgains = drugtype.Select(t => new cof_drugtype {HospitalId=allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
_drugtypeRepository.AddRange(newAgains.ToArray()); _drugtypeRepository.AddRange(newAgains.ToArray());
} }
...@@ -838,7 +839,7 @@ private void CopyAprData(int prevAllotId, int allotId) ...@@ -838,7 +839,7 @@ private void CopyAprData(int prevAllotId, int allotId)
} }
} }
public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId) public HandsonTable GetHrpDeptHands(int HospitalId, int AllotId)
{ {
var result = new HandsonTable((int)SheetType.Unidentifiable, HrpDept.Select(t => t.Value).ToArray(), HrpDept.Select(t => new collect_permission var result = new HandsonTable((int)SheetType.Unidentifiable, HrpDept.Select(t => t.Value).ToArray(), HrpDept.Select(t => new collect_permission
{ {
...@@ -858,7 +859,7 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId) ...@@ -858,7 +859,7 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json); var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in HrpDept join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList(); var cells = (from conf in HrpDept join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells)); rowDatas.Add(new HandsonRowData(i, cells));
i++; i++;
} }
...@@ -866,9 +867,9 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId) ...@@ -866,9 +867,9 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
return result; return result;
} }
public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData request) public void SaveDepttypeHands(int hospitalId, int allotId, SaveCollectData request)
{ {
var dicData = CreateDataRow(hospitalId,allotId, request, HrpDept); var dicData = CreateDataRow(hospitalId, allotId, request, HrpDept);
List<cof_hrp_department> depts = new List<cof_hrp_department>(); List<cof_hrp_department> depts = new List<cof_hrp_department>();
foreach (var item in dicData) foreach (var item in dicData)
...@@ -884,7 +885,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques ...@@ -884,7 +885,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques
} }
perforCofHrpDeptRepository.Execute("delete from cof_hrp_department where HospitalId=@hospitalId and allotid = @allotid" perforCofHrpDeptRepository.Execute("delete from cof_hrp_department where HospitalId=@hospitalId and allotid = @allotid"
, new {hospitalId, allotId }); , new { hospitalId, allotId });
perforCofHrpDeptRepository.AddRange(depts.ToArray()); perforCofHrpDeptRepository.AddRange(depts.ToArray());
} }
...@@ -897,7 +898,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques ...@@ -897,7 +898,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques
// 创建固定数据列 // 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r); Dictionary<string, string> baseData = CreateBaseData(request, config, r);
baseData.Add(nameof(cof_hrp_department.AllotId), allotId.ToString()); baseData.Add(nameof(cof_hrp_department.AllotId), allotId.ToString());
baseData.Add(nameof(cof_hrp_department.HospitalId),hospitalId.ToString()); baseData.Add(nameof(cof_hrp_department.HospitalId), hospitalId.ToString());
allData.Add(baseData); allData.Add(baseData);
} }
......
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