@Test public void testModifyDiagnoseTemplate() throws Exception { }
@Override public CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam){ int count = 0; Integer roleId = diagnoseTemplateParam.getRoleId(); String newName = diagnoseTemplateParam.getNewName(); String pastName = diagnoseTemplateParam.getName(); List<DiagnoseParam> diagnoseParams = diagnoseTemplateParam.getDiagnoseList(); if(newName == null || pastName == null) return CommonResult.fail(ResultCode.E_805); if(diagnoseTemplateMapper.getDiagnoseTemplateByName(pastName) == null) return CommonResult.fail(ResultCode.E_800); if (!newName.equals(pastName)){ if(diagnoseTemplateMapper.getDiagnoseTemplateByName(newName) != null) return CommonResult.fail(ResultCode.E_806); diagnoseTemplateMapper.updateName(pastName, newName); } List<String> existedDiseaseIcdCodes = diagnoseTemplateMapper.listDiseaseIcdCodesByTemplateName(newName); for(DiagnoseParam diagnoseParam: diagnoseParams) { if(existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { HashMap disease = diseaseMapper.getDiseaseByIcdCode(diagnoseParam.getIcdCode()); Byte type; if(disease.get("type").equals("中医疾病")) type = 0; else type = 1; count = diagnoseTemplateMapper.insert(diagnoseParam.getIcdCode(), (String)disease.get("name"), type, roleId, newName); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) count = diagnoseTemplateMapper.deleteByDiseaseIcdCode(leftDiseaseIcdCode); } return CommonResult.success(count); }
DiagnoseTemplateServiceImpl implements DiagnoseTemplateService { @Override public CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam){ int count = 0; Integer roleId = diagnoseTemplateParam.getRoleId(); String newName = diagnoseTemplateParam.getNewName(); String pastName = diagnoseTemplateParam.getName(); List<DiagnoseParam> diagnoseParams = diagnoseTemplateParam.getDiagnoseList(); if(newName == null || pastName == null) return CommonResult.fail(ResultCode.E_805); if(diagnoseTemplateMapper.getDiagnoseTemplateByName(pastName) == null) return CommonResult.fail(ResultCode.E_800); if (!newName.equals(pastName)){ if(diagnoseTemplateMapper.getDiagnoseTemplateByName(newName) != null) return CommonResult.fail(ResultCode.E_806); diagnoseTemplateMapper.updateName(pastName, newName); } List<String> existedDiseaseIcdCodes = diagnoseTemplateMapper.listDiseaseIcdCodesByTemplateName(newName); for(DiagnoseParam diagnoseParam: diagnoseParams) { if(existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { HashMap disease = diseaseMapper.getDiseaseByIcdCode(diagnoseParam.getIcdCode()); Byte type; if(disease.get("type").equals("中医疾病")) type = 0; else type = 1; count = diagnoseTemplateMapper.insert(diagnoseParam.getIcdCode(), (String)disease.get("name"), type, roleId, newName); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) count = diagnoseTemplateMapper.deleteByDiseaseIcdCode(leftDiseaseIcdCode); } return CommonResult.success(count); } }
DiagnoseTemplateServiceImpl implements DiagnoseTemplateService { @Override public CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam){ int count = 0; Integer roleId = diagnoseTemplateParam.getRoleId(); String newName = diagnoseTemplateParam.getNewName(); String pastName = diagnoseTemplateParam.getName(); List<DiagnoseParam> diagnoseParams = diagnoseTemplateParam.getDiagnoseList(); if(newName == null || pastName == null) return CommonResult.fail(ResultCode.E_805); if(diagnoseTemplateMapper.getDiagnoseTemplateByName(pastName) == null) return CommonResult.fail(ResultCode.E_800); if (!newName.equals(pastName)){ if(diagnoseTemplateMapper.getDiagnoseTemplateByName(newName) != null) return CommonResult.fail(ResultCode.E_806); diagnoseTemplateMapper.updateName(pastName, newName); } List<String> existedDiseaseIcdCodes = diagnoseTemplateMapper.listDiseaseIcdCodesByTemplateName(newName); for(DiagnoseParam diagnoseParam: diagnoseParams) { if(existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { HashMap disease = diseaseMapper.getDiseaseByIcdCode(diagnoseParam.getIcdCode()); Byte type; if(disease.get("type").equals("中医疾病")) type = 0; else type = 1; count = diagnoseTemplateMapper.insert(diagnoseParam.getIcdCode(), (String)disease.get("name"), type, roleId, newName); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) count = diagnoseTemplateMapper.deleteByDiseaseIcdCode(leftDiseaseIcdCode); } return CommonResult.success(count); }  }
DiagnoseTemplateServiceImpl implements DiagnoseTemplateService { @Override public CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam){ int count = 0; Integer roleId = diagnoseTemplateParam.getRoleId(); String newName = diagnoseTemplateParam.getNewName(); String pastName = diagnoseTemplateParam.getName(); List<DiagnoseParam> diagnoseParams = diagnoseTemplateParam.getDiagnoseList(); if(newName == null || pastName == null) return CommonResult.fail(ResultCode.E_805); if(diagnoseTemplateMapper.getDiagnoseTemplateByName(pastName) == null) return CommonResult.fail(ResultCode.E_800); if (!newName.equals(pastName)){ if(diagnoseTemplateMapper.getDiagnoseTemplateByName(newName) != null) return CommonResult.fail(ResultCode.E_806); diagnoseTemplateMapper.updateName(pastName, newName); } List<String> existedDiseaseIcdCodes = diagnoseTemplateMapper.listDiseaseIcdCodesByTemplateName(newName); for(DiagnoseParam diagnoseParam: diagnoseParams) { if(existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { HashMap disease = diseaseMapper.getDiseaseByIcdCode(diagnoseParam.getIcdCode()); Byte type; if(disease.get("type").equals("中医疾病")) type = 0; else type = 1; count = diagnoseTemplateMapper.insert(diagnoseParam.getIcdCode(), (String)disease.get("name"), type, roleId, newName); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) count = diagnoseTemplateMapper.deleteByDiseaseIcdCode(leftDiseaseIcdCode); } return CommonResult.success(count); }  @Override CommonResult saveDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam); @Override CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam); @Override CommonResult listMyDiagnoseTemplate(Integer roleId); CommonResult deleteMyDiagnoseTemplate(Integer roleId, String diagnoseTemplateName); }
DiagnoseTemplateServiceImpl implements DiagnoseTemplateService { @Override public CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam){ int count = 0; Integer roleId = diagnoseTemplateParam.getRoleId(); String newName = diagnoseTemplateParam.getNewName(); String pastName = diagnoseTemplateParam.getName(); List<DiagnoseParam> diagnoseParams = diagnoseTemplateParam.getDiagnoseList(); if(newName == null || pastName == null) return CommonResult.fail(ResultCode.E_805); if(diagnoseTemplateMapper.getDiagnoseTemplateByName(pastName) == null) return CommonResult.fail(ResultCode.E_800); if (!newName.equals(pastName)){ if(diagnoseTemplateMapper.getDiagnoseTemplateByName(newName) != null) return CommonResult.fail(ResultCode.E_806); diagnoseTemplateMapper.updateName(pastName, newName); } List<String> existedDiseaseIcdCodes = diagnoseTemplateMapper.listDiseaseIcdCodesByTemplateName(newName); for(DiagnoseParam diagnoseParam: diagnoseParams) { if(existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { HashMap disease = diseaseMapper.getDiseaseByIcdCode(diagnoseParam.getIcdCode()); Byte type; if(disease.get("type").equals("中医疾病")) type = 0; else type = 1; count = diagnoseTemplateMapper.insert(diagnoseParam.getIcdCode(), (String)disease.get("name"), type, roleId, newName); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) count = diagnoseTemplateMapper.deleteByDiseaseIcdCode(leftDiseaseIcdCode); } return CommonResult.success(count); }  @Override CommonResult saveDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam); @Override CommonResult modifyDiagnoseTemplate(DiagnoseTemplateParam diagnoseTemplateParam); @Override CommonResult listMyDiagnoseTemplate(Integer roleId); CommonResult deleteMyDiagnoseTemplate(Integer roleId, String diagnoseTemplateName);  }