@Test public void testInsertTransactionLog() throws Exception { }
public CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam, Integer creatorRoleId){ Integer registrationId = collectionParam.getCaseId(); Integer patientId = patientCaseMapper.getPatientIdByCaseId(registrationId); if(patientId == null) return CommonResult.fail(ResultCode.E_800); Integer collectionId = collectionParam.getRecipeId(); Integer medicineId = recipeParam.getMedicineId(); Short amount = recipeParam.getAmount(); String medicineName = recipeParam.getMedicineName(); if(collectionId == null || medicineId == null || amount == null || medicineName == null) return CommonResult.fail(ResultCode.E_801); BigDecimal price = recipeParam.getMedicineUnitPrice(); BigDecimal totalMoney = new BigDecimal(amount).multiply(price); TransactionLog transactionLog = new TransactionLog(); transactionLog.setRegistrationId(registrationId); transactionLog.setRoleId(creatorRoleId); transactionLog.setPatientId(patientId); String costType = medicineMapper.getCostTypeById(medicineId); transactionLog.setType(costType); transactionLog.setCollectionId(collectionId); transactionLog.setProjectId(medicineId); transactionLog.setProjectName(medicineName); transactionLog.setAmount(amount); transactionLog.setTotalMoney(totalMoney); return transactionService.insertTransactionLog(transactionLog); }
RecipeManagementServiceImpl implements RecipeManagementService { public CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam, Integer creatorRoleId){ Integer registrationId = collectionParam.getCaseId(); Integer patientId = patientCaseMapper.getPatientIdByCaseId(registrationId); if(patientId == null) return CommonResult.fail(ResultCode.E_800); Integer collectionId = collectionParam.getRecipeId(); Integer medicineId = recipeParam.getMedicineId(); Short amount = recipeParam.getAmount(); String medicineName = recipeParam.getMedicineName(); if(collectionId == null || medicineId == null || amount == null || medicineName == null) return CommonResult.fail(ResultCode.E_801); BigDecimal price = recipeParam.getMedicineUnitPrice(); BigDecimal totalMoney = new BigDecimal(amount).multiply(price); TransactionLog transactionLog = new TransactionLog(); transactionLog.setRegistrationId(registrationId); transactionLog.setRoleId(creatorRoleId); transactionLog.setPatientId(patientId); String costType = medicineMapper.getCostTypeById(medicineId); transactionLog.setType(costType); transactionLog.setCollectionId(collectionId); transactionLog.setProjectId(medicineId); transactionLog.setProjectName(medicineName); transactionLog.setAmount(amount); transactionLog.setTotalMoney(totalMoney); return transactionService.insertTransactionLog(transactionLog); } }
RecipeManagementServiceImpl implements RecipeManagementService { public CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam, Integer creatorRoleId){ Integer registrationId = collectionParam.getCaseId(); Integer patientId = patientCaseMapper.getPatientIdByCaseId(registrationId); if(patientId == null) return CommonResult.fail(ResultCode.E_800); Integer collectionId = collectionParam.getRecipeId(); Integer medicineId = recipeParam.getMedicineId(); Short amount = recipeParam.getAmount(); String medicineName = recipeParam.getMedicineName(); if(collectionId == null || medicineId == null || amount == null || medicineName == null) return CommonResult.fail(ResultCode.E_801); BigDecimal price = recipeParam.getMedicineUnitPrice(); BigDecimal totalMoney = new BigDecimal(amount).multiply(price); TransactionLog transactionLog = new TransactionLog(); transactionLog.setRegistrationId(registrationId); transactionLog.setRoleId(creatorRoleId); transactionLog.setPatientId(patientId); String costType = medicineMapper.getCostTypeById(medicineId); transactionLog.setType(costType); transactionLog.setCollectionId(collectionId); transactionLog.setProjectId(medicineId); transactionLog.setProjectName(medicineName); transactionLog.setAmount(amount); transactionLog.setTotalMoney(totalMoney); return transactionService.insertTransactionLog(transactionLog); }  }
RecipeManagementServiceImpl implements RecipeManagementService { public CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam, Integer creatorRoleId){ Integer registrationId = collectionParam.getCaseId(); Integer patientId = patientCaseMapper.getPatientIdByCaseId(registrationId); if(patientId == null) return CommonResult.fail(ResultCode.E_800); Integer collectionId = collectionParam.getRecipeId(); Integer medicineId = recipeParam.getMedicineId(); Short amount = recipeParam.getAmount(); String medicineName = recipeParam.getMedicineName(); if(collectionId == null || medicineId == null || amount == null || medicineName == null) return CommonResult.fail(ResultCode.E_801); BigDecimal price = recipeParam.getMedicineUnitPrice(); BigDecimal totalMoney = new BigDecimal(amount).multiply(price); TransactionLog transactionLog = new TransactionLog(); transactionLog.setRegistrationId(registrationId); transactionLog.setRoleId(creatorRoleId); transactionLog.setPatientId(patientId); String costType = medicineMapper.getCostTypeById(medicineId); transactionLog.setType(costType); transactionLog.setCollectionId(collectionId); transactionLog.setProjectId(medicineId); transactionLog.setProjectName(medicineName); transactionLog.setAmount(amount); transactionLog.setTotalMoney(totalMoney); return transactionService.insertTransactionLog(transactionLog); }  @Override CommonResult listCurrentCaseRecipes(Integer caseId); HashMap medicineInfo(HashMap recipeLog); @Override CommonResult insertNewRecipe(); CommonResult preserveRecipes(RecipeCollectionParam recipeCollectionParam); CommonResult submitRecipes(RecipeCollectionParam recipeCollectionParam); CommonResult updateRecipes(RecipeCollectionParam recipeCollectionParam, Integer status); CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam,
                                             Integer creatorRoleId); }
RecipeManagementServiceImpl implements RecipeManagementService { public CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam, Integer creatorRoleId){ Integer registrationId = collectionParam.getCaseId(); Integer patientId = patientCaseMapper.getPatientIdByCaseId(registrationId); if(patientId == null) return CommonResult.fail(ResultCode.E_800); Integer collectionId = collectionParam.getRecipeId(); Integer medicineId = recipeParam.getMedicineId(); Short amount = recipeParam.getAmount(); String medicineName = recipeParam.getMedicineName(); if(collectionId == null || medicineId == null || amount == null || medicineName == null) return CommonResult.fail(ResultCode.E_801); BigDecimal price = recipeParam.getMedicineUnitPrice(); BigDecimal totalMoney = new BigDecimal(amount).multiply(price); TransactionLog transactionLog = new TransactionLog(); transactionLog.setRegistrationId(registrationId); transactionLog.setRoleId(creatorRoleId); transactionLog.setPatientId(patientId); String costType = medicineMapper.getCostTypeById(medicineId); transactionLog.setType(costType); transactionLog.setCollectionId(collectionId); transactionLog.setProjectId(medicineId); transactionLog.setProjectName(medicineName); transactionLog.setAmount(amount); transactionLog.setTotalMoney(totalMoney); return transactionService.insertTransactionLog(transactionLog); }  @Override CommonResult listCurrentCaseRecipes(Integer caseId); HashMap medicineInfo(HashMap recipeLog); @Override CommonResult insertNewRecipe(); CommonResult preserveRecipes(RecipeCollectionParam recipeCollectionParam); CommonResult submitRecipes(RecipeCollectionParam recipeCollectionParam); CommonResult updateRecipes(RecipeCollectionParam recipeCollectionParam, Integer status); CommonResult insertTransactionLog(RecipeCollectionParam collectionParam, RecipeParam recipeParam,
                                             Integer creatorRoleId);  }