@Test public void testInsertRecipeTemplate() throws Exception { }
@Override public CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam){ int count = 0; Integer roleId = recipeTemplateParam.getRoleId(); Byte scope = recipeTemplateParam.getScope(); String name = recipeTemplateParam.getNewName(); if (roleId == null || scope == null || name == null){ return CommonResult.fail(ResultCode.E_801); } if(0 != recipeTemplateMapper.getRecipeTemplateByRoleIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_806); List<RecipeParam> recipeParams = recipeTemplateParam.getMedicines(); for(RecipeParam recipeParam : recipeParams){ RecipeTemplate recipeTemplate = new RecipeTemplate(); recipeTemplate.setName(name); recipeTemplate.setRoleId(roleId); recipeTemplate.setDepartmentId(132); recipeTemplate.setScope(scope); String medicineCode = medicineMapper.getCodeById(recipeParam.getMedicineId()); recipeTemplate.setMedicineCode(medicineCode); recipeTemplate.setType(recipeParam.getMedicineType()); recipeTemplate.setDosage(recipeParam.getDosage()); recipeTemplate.setDosageUnit(recipeParam.getMedicineUnit()); recipeTemplate.setFrequency(recipeParam.getFrequency()); recipeTemplate.setAmount(recipeParam.getAmount()); count = recipeTemplateMapper.insertSelective(recipeTemplate); if(count <= 0) return CommonResult.success(count); } return CommonResult.success(count); }
RecipeTemplateManagementServiceImpl implements RecipeTemplateManagementService { @Override public CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam){ int count = 0; Integer roleId = recipeTemplateParam.getRoleId(); Byte scope = recipeTemplateParam.getScope(); String name = recipeTemplateParam.getNewName(); if (roleId == null || scope == null || name == null){ return CommonResult.fail(ResultCode.E_801); } if(0 != recipeTemplateMapper.getRecipeTemplateByRoleIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_806); List<RecipeParam> recipeParams = recipeTemplateParam.getMedicines(); for(RecipeParam recipeParam : recipeParams){ RecipeTemplate recipeTemplate = new RecipeTemplate(); recipeTemplate.setName(name); recipeTemplate.setRoleId(roleId); recipeTemplate.setDepartmentId(132); recipeTemplate.setScope(scope); String medicineCode = medicineMapper.getCodeById(recipeParam.getMedicineId()); recipeTemplate.setMedicineCode(medicineCode); recipeTemplate.setType(recipeParam.getMedicineType()); recipeTemplate.setDosage(recipeParam.getDosage()); recipeTemplate.setDosageUnit(recipeParam.getMedicineUnit()); recipeTemplate.setFrequency(recipeParam.getFrequency()); recipeTemplate.setAmount(recipeParam.getAmount()); count = recipeTemplateMapper.insertSelective(recipeTemplate); if(count <= 0) return CommonResult.success(count); } return CommonResult.success(count); } }
RecipeTemplateManagementServiceImpl implements RecipeTemplateManagementService { @Override public CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam){ int count = 0; Integer roleId = recipeTemplateParam.getRoleId(); Byte scope = recipeTemplateParam.getScope(); String name = recipeTemplateParam.getNewName(); if (roleId == null || scope == null || name == null){ return CommonResult.fail(ResultCode.E_801); } if(0 != recipeTemplateMapper.getRecipeTemplateByRoleIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_806); List<RecipeParam> recipeParams = recipeTemplateParam.getMedicines(); for(RecipeParam recipeParam : recipeParams){ RecipeTemplate recipeTemplate = new RecipeTemplate(); recipeTemplate.setName(name); recipeTemplate.setRoleId(roleId); recipeTemplate.setDepartmentId(132); recipeTemplate.setScope(scope); String medicineCode = medicineMapper.getCodeById(recipeParam.getMedicineId()); recipeTemplate.setMedicineCode(medicineCode); recipeTemplate.setType(recipeParam.getMedicineType()); recipeTemplate.setDosage(recipeParam.getDosage()); recipeTemplate.setDosageUnit(recipeParam.getMedicineUnit()); recipeTemplate.setFrequency(recipeParam.getFrequency()); recipeTemplate.setAmount(recipeParam.getAmount()); count = recipeTemplateMapper.insertSelective(recipeTemplate); if(count <= 0) return CommonResult.success(count); } return CommonResult.success(count); }  }
RecipeTemplateManagementServiceImpl implements RecipeTemplateManagementService { @Override public CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam){ int count = 0; Integer roleId = recipeTemplateParam.getRoleId(); Byte scope = recipeTemplateParam.getScope(); String name = recipeTemplateParam.getNewName(); if (roleId == null || scope == null || name == null){ return CommonResult.fail(ResultCode.E_801); } if(0 != recipeTemplateMapper.getRecipeTemplateByRoleIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_806); List<RecipeParam> recipeParams = recipeTemplateParam.getMedicines(); for(RecipeParam recipeParam : recipeParams){ RecipeTemplate recipeTemplate = new RecipeTemplate(); recipeTemplate.setName(name); recipeTemplate.setRoleId(roleId); recipeTemplate.setDepartmentId(132); recipeTemplate.setScope(scope); String medicineCode = medicineMapper.getCodeById(recipeParam.getMedicineId()); recipeTemplate.setMedicineCode(medicineCode); recipeTemplate.setType(recipeParam.getMedicineType()); recipeTemplate.setDosage(recipeParam.getDosage()); recipeTemplate.setDosageUnit(recipeParam.getMedicineUnit()); recipeTemplate.setFrequency(recipeParam.getFrequency()); recipeTemplate.setAmount(recipeParam.getAmount()); count = recipeTemplateMapper.insertSelective(recipeTemplate); if(count <= 0) return CommonResult.success(count); } return CommonResult.success(count); }  @Override CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam); @Override CommonResult deleteRecipeTemplate(Integer roleId, String recipeName); @Override CommonResult listRecipeTemplate(Integer roleId, Integer type); CommonResult modifyRecipeTemplate(RecipeTemplateParam recipeTemplateParam); JSONArray toJson(HashMap<String, List<HashMap>> hashMap); }
RecipeTemplateManagementServiceImpl implements RecipeTemplateManagementService { @Override public CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam){ int count = 0; Integer roleId = recipeTemplateParam.getRoleId(); Byte scope = recipeTemplateParam.getScope(); String name = recipeTemplateParam.getNewName(); if (roleId == null || scope == null || name == null){ return CommonResult.fail(ResultCode.E_801); } if(0 != recipeTemplateMapper.getRecipeTemplateByRoleIdAndName(roleId, name).size()) return CommonResult.fail(ResultCode.E_806); List<RecipeParam> recipeParams = recipeTemplateParam.getMedicines(); for(RecipeParam recipeParam : recipeParams){ RecipeTemplate recipeTemplate = new RecipeTemplate(); recipeTemplate.setName(name); recipeTemplate.setRoleId(roleId); recipeTemplate.setDepartmentId(132); recipeTemplate.setScope(scope); String medicineCode = medicineMapper.getCodeById(recipeParam.getMedicineId()); recipeTemplate.setMedicineCode(medicineCode); recipeTemplate.setType(recipeParam.getMedicineType()); recipeTemplate.setDosage(recipeParam.getDosage()); recipeTemplate.setDosageUnit(recipeParam.getMedicineUnit()); recipeTemplate.setFrequency(recipeParam.getFrequency()); recipeTemplate.setAmount(recipeParam.getAmount()); count = recipeTemplateMapper.insertSelective(recipeTemplate); if(count <= 0) return CommonResult.success(count); } return CommonResult.success(count); }  @Override CommonResult insertRecipeTemplate(RecipeTemplateParam recipeTemplateParam); @Override CommonResult deleteRecipeTemplate(Integer roleId, String recipeName); @Override CommonResult listRecipeTemplate(Integer roleId, Integer type); CommonResult modifyRecipeTemplate(RecipeTemplateParam recipeTemplateParam); JSONArray toJson(HashMap<String, List<HashMap>> hashMap);  }