@Test public void testReturnMedicine() throws Exception { }
public CommonResult returnMedicine(List<RecipeParam> recipeParams){ int count = 0; for(RecipeParam r: recipeParams){ Byte transactionLogStatus = r.getTransactionLogStatus(); Byte medicineStatus = r.getStatus(); Integer medicineId = r.getMedicineId(); Integer recipeId = r.getId(); Integer deliverRoleId = r.getDeliverRoleId(); Short remainAmount = r.getRemainAmount(); Short returnAmount = r.getReturnAmount(); if(transactionLogStatus == 2 && (medicineStatus == 4 || medicineStatus == 5)){ if (returnAmount <= remainAmount){ count += recipeMapper.updateRemainAmount(recipeId, medicineId, returnAmount); count += recipeMapper.updateStatusAndDeliverId(recipeId, medicineId, (byte)5, deliverRoleId); inventoryMapper.updateInventory(medicineId, (short) - returnAmount); } else return CommonResult.fail(E_705); } else return CommonResult.fail(E_705); } if(count == 2 * recipeParams.size()) return CommonResult.success(count); else return CommonResult.fail(); }
PharmacyServiceImpl implements PharmacyService { public CommonResult returnMedicine(List<RecipeParam> recipeParams){ int count = 0; for(RecipeParam r: recipeParams){ Byte transactionLogStatus = r.getTransactionLogStatus(); Byte medicineStatus = r.getStatus(); Integer medicineId = r.getMedicineId(); Integer recipeId = r.getId(); Integer deliverRoleId = r.getDeliverRoleId(); Short remainAmount = r.getRemainAmount(); Short returnAmount = r.getReturnAmount(); if(transactionLogStatus == 2 && (medicineStatus == 4 || medicineStatus == 5)){ if (returnAmount <= remainAmount){ count += recipeMapper.updateRemainAmount(recipeId, medicineId, returnAmount); count += recipeMapper.updateStatusAndDeliverId(recipeId, medicineId, (byte)5, deliverRoleId); inventoryMapper.updateInventory(medicineId, (short) - returnAmount); } else return CommonResult.fail(E_705); } else return CommonResult.fail(E_705); } if(count == 2 * recipeParams.size()) return CommonResult.success(count); else return CommonResult.fail(); } }
PharmacyServiceImpl implements PharmacyService { public CommonResult returnMedicine(List<RecipeParam> recipeParams){ int count = 0; for(RecipeParam r: recipeParams){ Byte transactionLogStatus = r.getTransactionLogStatus(); Byte medicineStatus = r.getStatus(); Integer medicineId = r.getMedicineId(); Integer recipeId = r.getId(); Integer deliverRoleId = r.getDeliverRoleId(); Short remainAmount = r.getRemainAmount(); Short returnAmount = r.getReturnAmount(); if(transactionLogStatus == 2 && (medicineStatus == 4 || medicineStatus == 5)){ if (returnAmount <= remainAmount){ count += recipeMapper.updateRemainAmount(recipeId, medicineId, returnAmount); count += recipeMapper.updateStatusAndDeliverId(recipeId, medicineId, (byte)5, deliverRoleId); inventoryMapper.updateInventory(medicineId, (short) - returnAmount); } else return CommonResult.fail(E_705); } else return CommonResult.fail(E_705); } if(count == 2 * recipeParams.size()) return CommonResult.success(count); else return CommonResult.fail(); }  }
PharmacyServiceImpl implements PharmacyService { public CommonResult returnMedicine(List<RecipeParam> recipeParams){ int count = 0; for(RecipeParam r: recipeParams){ Byte transactionLogStatus = r.getTransactionLogStatus(); Byte medicineStatus = r.getStatus(); Integer medicineId = r.getMedicineId(); Integer recipeId = r.getId(); Integer deliverRoleId = r.getDeliverRoleId(); Short remainAmount = r.getRemainAmount(); Short returnAmount = r.getReturnAmount(); if(transactionLogStatus == 2 && (medicineStatus == 4 || medicineStatus == 5)){ if (returnAmount <= remainAmount){ count += recipeMapper.updateRemainAmount(recipeId, medicineId, returnAmount); count += recipeMapper.updateStatusAndDeliverId(recipeId, medicineId, (byte)5, deliverRoleId); inventoryMapper.updateInventory(medicineId, (short) - returnAmount); } else return CommonResult.fail(E_705); } else return CommonResult.fail(E_705); } if(count == 2 * recipeParams.size()) return CommonResult.success(count); else return CommonResult.fail(); }  CommonResult listRecipesByRegistrationIdOrDate(Integer caseId, String chargeDateStr); CommonResult listIndividualRecipe(Integer registrationId); CommonResult deliverMedicine(List<RecipeParam> recipeParams); CommonResult returnMedicine(List<RecipeParam> recipeParams); }
PharmacyServiceImpl implements PharmacyService { public CommonResult returnMedicine(List<RecipeParam> recipeParams){ int count = 0; for(RecipeParam r: recipeParams){ Byte transactionLogStatus = r.getTransactionLogStatus(); Byte medicineStatus = r.getStatus(); Integer medicineId = r.getMedicineId(); Integer recipeId = r.getId(); Integer deliverRoleId = r.getDeliverRoleId(); Short remainAmount = r.getRemainAmount(); Short returnAmount = r.getReturnAmount(); if(transactionLogStatus == 2 && (medicineStatus == 4 || medicineStatus == 5)){ if (returnAmount <= remainAmount){ count += recipeMapper.updateRemainAmount(recipeId, medicineId, returnAmount); count += recipeMapper.updateStatusAndDeliverId(recipeId, medicineId, (byte)5, deliverRoleId); inventoryMapper.updateInventory(medicineId, (short) - returnAmount); } else return CommonResult.fail(E_705); } else return CommonResult.fail(E_705); } if(count == 2 * recipeParams.size()) return CommonResult.success(count); else return CommonResult.fail(); }  CommonResult listRecipesByRegistrationIdOrDate(Integer caseId, String chargeDateStr); CommonResult listIndividualRecipe(Integer registrationId); CommonResult deliverMedicine(List<RecipeParam> recipeParams); CommonResult returnMedicine(List<RecipeParam> recipeParams);  }