PatientService.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*******************************************************************************
  2. * Copyright (c) 2005, 2014 springside.github.io
  3. * <p>
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. *******************************************************************************/
  6. package com.yihu.mm.service;
  7. import com.yihu.mm.repository.wlyy.patient.PatientDao;
  8. import com.yihu.wlyy.entity.organization.Hospital;
  9. import com.yihu.wlyy.entity.patient.Patient;
  10. import com.yihu.wlyy.entity.patient.SignFamily;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. /**
  14. * 患者基本信息类.
  15. *
  16. * @author George
  17. */
  18. @Service
  19. public class PatientService {
  20. @Autowired
  21. private PatientDao patientDao;
  22. @Autowired
  23. private HospitalService hospitalService;
  24. @Autowired
  25. private FamilyContractService familyContractService;
  26. public Patient findByCode(String code) {
  27. return patientDao.findByCode(code);
  28. }
  29. /**
  30. * 判断是否居民是否 是集美签约居民
  31. * 返回 0 :未签约,且非厦门市民
  32. * 1: 未签约,是厦门市民
  33. * 2: 签约 在集美
  34. * 3 签约不在集美
  35. * @return
  36. */
  37. public int isSignJM(String patientCode){
  38. SignFamily signFamily = familyContractService.findSignByPatient(patientCode);
  39. //未签约
  40. if(signFamily==null){
  41. Patient patient = findByCode(patientCode);
  42. //未签约判断是否在前门
  43. String city = patient.getCity();
  44. if("350200".equals(city)){
  45. return 1;//未签约 厦门居民
  46. }
  47. return 0;//未签约 非厦门居民
  48. }
  49. //签约
  50. String hospitalCode = signFamily.getHospital();
  51. Hospital hospital = hospitalService.findByCode(hospitalCode);
  52. String town = hospital.getTown();
  53. if("350211".equals(town)){
  54. return 2; //签约 签约在集美
  55. }
  56. return 3; //签约 但签约不在集美
  57. }
  58. }