@Test public void testSavePatientCase() throws Exception { }
public CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed){ Integer caseId = patientCaseParam.getCaseId(); String narrate = patientCaseParam.getNarrate(); String curDisease = patientCaseParam.getCurDisease(); String curTreatCondition = patientCaseParam.getCurTreatCondition(); String pastDisease = patientCaseParam.getPastDisease(); String allergy = patientCaseParam.getAllergy(); String physicalCondition = patientCaseParam.getPhysicalCondition(); String assistDiagnose = patientCaseParam.getAssistDiagnose(); Integer diagnoseType = patientCaseParam.getDiagnoseType(); List<DiagnoseParam> diagnoses; if(caseId == null) { return CommonResult.fail(ResultCode.E_801); } int curStatus = patientCaseMapper.getPatientCaseStatus(caseId); int count = patientCaseMapper.updatePatientCase(caseId, narrate, curDisease, curTreatCondition, pastDisease, allergy, physicalCondition, assistDiagnose, status); if(count <= 0) { return CommonResult.fail(ResultCode.E_802); } List<String> existedDiseaseIcdCodes = diagnoseMapper.listDiseaseIcdCodesByCaseId(caseId); if(diagnoseType == 0) { diagnoses = patientCaseParam.getTraditionalDiagnose(); } else if(diagnoseType == 1) { diagnoses = patientCaseParam.getModernDiagnose(); } else { return CommonResult.fail(ResultCode.E_801); } for(DiagnoseParam diagnoseParam: diagnoses) { if (existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { count = diagnoseMapper.updateExisted(diagnoseParam.getIcdCode(), diagnoseParam.getStartTime(), isFirstDiagnosed); if (count <= 0) return CommonResult.fail(ResultCode.E_802); existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { Diagnose diagnose = new Diagnose(); diagnose.setCaseId(caseId); diagnose.setDiseaseId(diagnoseParam.getIcdCode()); diagnose.setStartTime(Date.valueOf(diagnoseParam.getStartTime())); diagnose.setIsFirstDiagnosed(isFirstDiagnosed); count = diagnoseMapper.insertSelective(diagnose); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) { count = diagnoseMapper.deleteByCaseIdAndDiseaseIcdCode(caseId, leftDiseaseIcdCode); } } return CommonResult.success(count); }
PreliminaryCaseServiceImpl implements PreliminaryCaseService { public CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed){ Integer caseId = patientCaseParam.getCaseId(); String narrate = patientCaseParam.getNarrate(); String curDisease = patientCaseParam.getCurDisease(); String curTreatCondition = patientCaseParam.getCurTreatCondition(); String pastDisease = patientCaseParam.getPastDisease(); String allergy = patientCaseParam.getAllergy(); String physicalCondition = patientCaseParam.getPhysicalCondition(); String assistDiagnose = patientCaseParam.getAssistDiagnose(); Integer diagnoseType = patientCaseParam.getDiagnoseType(); List<DiagnoseParam> diagnoses; if(caseId == null) { return CommonResult.fail(ResultCode.E_801); } int curStatus = patientCaseMapper.getPatientCaseStatus(caseId); int count = patientCaseMapper.updatePatientCase(caseId, narrate, curDisease, curTreatCondition, pastDisease, allergy, physicalCondition, assistDiagnose, status); if(count <= 0) { return CommonResult.fail(ResultCode.E_802); } List<String> existedDiseaseIcdCodes = diagnoseMapper.listDiseaseIcdCodesByCaseId(caseId); if(diagnoseType == 0) { diagnoses = patientCaseParam.getTraditionalDiagnose(); } else if(diagnoseType == 1) { diagnoses = patientCaseParam.getModernDiagnose(); } else { return CommonResult.fail(ResultCode.E_801); } for(DiagnoseParam diagnoseParam: diagnoses) { if (existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { count = diagnoseMapper.updateExisted(diagnoseParam.getIcdCode(), diagnoseParam.getStartTime(), isFirstDiagnosed); if (count <= 0) return CommonResult.fail(ResultCode.E_802); existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { Diagnose diagnose = new Diagnose(); diagnose.setCaseId(caseId); diagnose.setDiseaseId(diagnoseParam.getIcdCode()); diagnose.setStartTime(Date.valueOf(diagnoseParam.getStartTime())); diagnose.setIsFirstDiagnosed(isFirstDiagnosed); count = diagnoseMapper.insertSelective(diagnose); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) { count = diagnoseMapper.deleteByCaseIdAndDiseaseIcdCode(caseId, leftDiseaseIcdCode); } } return CommonResult.success(count); } }
PreliminaryCaseServiceImpl implements PreliminaryCaseService { public CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed){ Integer caseId = patientCaseParam.getCaseId(); String narrate = patientCaseParam.getNarrate(); String curDisease = patientCaseParam.getCurDisease(); String curTreatCondition = patientCaseParam.getCurTreatCondition(); String pastDisease = patientCaseParam.getPastDisease(); String allergy = patientCaseParam.getAllergy(); String physicalCondition = patientCaseParam.getPhysicalCondition(); String assistDiagnose = patientCaseParam.getAssistDiagnose(); Integer diagnoseType = patientCaseParam.getDiagnoseType(); List<DiagnoseParam> diagnoses; if(caseId == null) { return CommonResult.fail(ResultCode.E_801); } int curStatus = patientCaseMapper.getPatientCaseStatus(caseId); int count = patientCaseMapper.updatePatientCase(caseId, narrate, curDisease, curTreatCondition, pastDisease, allergy, physicalCondition, assistDiagnose, status); if(count <= 0) { return CommonResult.fail(ResultCode.E_802); } List<String> existedDiseaseIcdCodes = diagnoseMapper.listDiseaseIcdCodesByCaseId(caseId); if(diagnoseType == 0) { diagnoses = patientCaseParam.getTraditionalDiagnose(); } else if(diagnoseType == 1) { diagnoses = patientCaseParam.getModernDiagnose(); } else { return CommonResult.fail(ResultCode.E_801); } for(DiagnoseParam diagnoseParam: diagnoses) { if (existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { count = diagnoseMapper.updateExisted(diagnoseParam.getIcdCode(), diagnoseParam.getStartTime(), isFirstDiagnosed); if (count <= 0) return CommonResult.fail(ResultCode.E_802); existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { Diagnose diagnose = new Diagnose(); diagnose.setCaseId(caseId); diagnose.setDiseaseId(diagnoseParam.getIcdCode()); diagnose.setStartTime(Date.valueOf(diagnoseParam.getStartTime())); diagnose.setIsFirstDiagnosed(isFirstDiagnosed); count = diagnoseMapper.insertSelective(diagnose); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) { count = diagnoseMapper.deleteByCaseIdAndDiseaseIcdCode(caseId, leftDiseaseIcdCode); } } return CommonResult.success(count); }  }
PreliminaryCaseServiceImpl implements PreliminaryCaseService { public CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed){ Integer caseId = patientCaseParam.getCaseId(); String narrate = patientCaseParam.getNarrate(); String curDisease = patientCaseParam.getCurDisease(); String curTreatCondition = patientCaseParam.getCurTreatCondition(); String pastDisease = patientCaseParam.getPastDisease(); String allergy = patientCaseParam.getAllergy(); String physicalCondition = patientCaseParam.getPhysicalCondition(); String assistDiagnose = patientCaseParam.getAssistDiagnose(); Integer diagnoseType = patientCaseParam.getDiagnoseType(); List<DiagnoseParam> diagnoses; if(caseId == null) { return CommonResult.fail(ResultCode.E_801); } int curStatus = patientCaseMapper.getPatientCaseStatus(caseId); int count = patientCaseMapper.updatePatientCase(caseId, narrate, curDisease, curTreatCondition, pastDisease, allergy, physicalCondition, assistDiagnose, status); if(count <= 0) { return CommonResult.fail(ResultCode.E_802); } List<String> existedDiseaseIcdCodes = diagnoseMapper.listDiseaseIcdCodesByCaseId(caseId); if(diagnoseType == 0) { diagnoses = patientCaseParam.getTraditionalDiagnose(); } else if(diagnoseType == 1) { diagnoses = patientCaseParam.getModernDiagnose(); } else { return CommonResult.fail(ResultCode.E_801); } for(DiagnoseParam diagnoseParam: diagnoses) { if (existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { count = diagnoseMapper.updateExisted(diagnoseParam.getIcdCode(), diagnoseParam.getStartTime(), isFirstDiagnosed); if (count <= 0) return CommonResult.fail(ResultCode.E_802); existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { Diagnose diagnose = new Diagnose(); diagnose.setCaseId(caseId); diagnose.setDiseaseId(diagnoseParam.getIcdCode()); diagnose.setStartTime(Date.valueOf(diagnoseParam.getStartTime())); diagnose.setIsFirstDiagnosed(isFirstDiagnosed); count = diagnoseMapper.insertSelective(diagnose); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) { count = diagnoseMapper.deleteByCaseIdAndDiseaseIcdCode(caseId, leftDiseaseIcdCode); } } return CommonResult.success(count); }  @Override CommonResult listPatients(Integer doctorRoleId); @Override CommonResult getPatientCaseInfo(Integer doctorRoleId, Integer caseId); CommonResult finalDiagnose(PatientCaseParam patientCaseParam); @Override CommonResult savePresentPatientCase(PatientCaseParam patientCaseParam); @Override CommonResult submitPresentPatientCase(PatientCaseParam patientCaseParam); CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed); CommonResult clearPatientCase(Integer caseId); CommonResult listFinalDiagnose(Integer caseId); @Override CommonResult finishDiagnose(Integer caseId); int getAgeByBirth(Date birthDay); }
PreliminaryCaseServiceImpl implements PreliminaryCaseService { public CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed){ Integer caseId = patientCaseParam.getCaseId(); String narrate = patientCaseParam.getNarrate(); String curDisease = patientCaseParam.getCurDisease(); String curTreatCondition = patientCaseParam.getCurTreatCondition(); String pastDisease = patientCaseParam.getPastDisease(); String allergy = patientCaseParam.getAllergy(); String physicalCondition = patientCaseParam.getPhysicalCondition(); String assistDiagnose = patientCaseParam.getAssistDiagnose(); Integer diagnoseType = patientCaseParam.getDiagnoseType(); List<DiagnoseParam> diagnoses; if(caseId == null) { return CommonResult.fail(ResultCode.E_801); } int curStatus = patientCaseMapper.getPatientCaseStatus(caseId); int count = patientCaseMapper.updatePatientCase(caseId, narrate, curDisease, curTreatCondition, pastDisease, allergy, physicalCondition, assistDiagnose, status); if(count <= 0) { return CommonResult.fail(ResultCode.E_802); } List<String> existedDiseaseIcdCodes = diagnoseMapper.listDiseaseIcdCodesByCaseId(caseId); if(diagnoseType == 0) { diagnoses = patientCaseParam.getTraditionalDiagnose(); } else if(diagnoseType == 1) { diagnoses = patientCaseParam.getModernDiagnose(); } else { return CommonResult.fail(ResultCode.E_801); } for(DiagnoseParam diagnoseParam: diagnoses) { if (existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { count = diagnoseMapper.updateExisted(diagnoseParam.getIcdCode(), diagnoseParam.getStartTime(), isFirstDiagnosed); if (count <= 0) return CommonResult.fail(ResultCode.E_802); existedDiseaseIcdCodes.remove(diagnoseParam.getIcdCode()); } else if (!existedDiseaseIcdCodes.contains(diagnoseParam.getIcdCode())) { Diagnose diagnose = new Diagnose(); diagnose.setCaseId(caseId); diagnose.setDiseaseId(diagnoseParam.getIcdCode()); diagnose.setStartTime(Date.valueOf(diagnoseParam.getStartTime())); diagnose.setIsFirstDiagnosed(isFirstDiagnosed); count = diagnoseMapper.insertSelective(diagnose); if (count <= 0) return CommonResult.fail(ResultCode.E_802); } } if(!existedDiseaseIcdCodes.isEmpty()) { for (String leftDiseaseIcdCode : existedDiseaseIcdCodes) { count = diagnoseMapper.deleteByCaseIdAndDiseaseIcdCode(caseId, leftDiseaseIcdCode); } } return CommonResult.success(count); }  @Override CommonResult listPatients(Integer doctorRoleId); @Override CommonResult getPatientCaseInfo(Integer doctorRoleId, Integer caseId); CommonResult finalDiagnose(PatientCaseParam patientCaseParam); @Override CommonResult savePresentPatientCase(PatientCaseParam patientCaseParam); @Override CommonResult submitPresentPatientCase(PatientCaseParam patientCaseParam); CommonResult savePatientCase(PatientCaseParam patientCaseParam, int status, Boolean isFirstDiagnosed); CommonResult clearPatientCase(Integer caseId); CommonResult listFinalDiagnose(Integer caseId); @Override CommonResult finishDiagnose(Integer caseId); int getAgeByBirth(Date birthDay);  }