PatientTestService.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package org.example.service;
  2. import org.example.entity.PatientTest;
  3. import org.example.mapper.PatientTestMapper;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Service;
  6. import java.util.List;
  7. /**
  8. * 患者检验报告服务
  9. */
  10. @Service
  11. public class PatientTestService {
  12. @Autowired
  13. private PatientTestMapper patientTestMapper;
  14. /**
  15. * 根据患者ID(身份证号)查询检验报告列表
  16. */
  17. public List<PatientTest> findByPatientId(String patientId) {
  18. return patientTestMapper.findByPatientId(patientId);
  19. }
  20. /**
  21. * 根据患者表ID查询检验报告列表
  22. */
  23. public List<PatientTest> findByPatientTableId(Long patientTableId) {
  24. return patientTestMapper.findByPatientTableId(patientTableId);
  25. }
  26. /**
  27. * 根据ID查询检验报告
  28. */
  29. public PatientTest findById(Long id) {
  30. return patientTestMapper.findById(id);
  31. }
  32. /**
  33. * 保存检验报告
  34. */
  35. public void save(PatientTest test) {
  36. if (test.getId() == null) {
  37. patientTestMapper.insert(test);
  38. } else {
  39. patientTestMapper.update(test);
  40. }
  41. }
  42. /**
  43. * 删除检验报告
  44. */
  45. public void deleteById(Long id) {
  46. patientTestMapper.deleteById(id);
  47. }
  48. }