diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index 6dc6050..0b5f5cf 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -507,4 +507,17 @@ public class PatientController { baseResponse.setObject(list); return baseResponse; } + /** + * 小程序用户端-登录后显示用户病历所在医院 + * + * @param patientId 传入患者id + * @return 医院id和医院名称 + */ + @GetMapping("getAppPatientHospital") + public BaseResponse getAppPatientHospital(Integer patientId) { + BaseResponse baseResponse = new BaseResponse(); + Map patientMap=lymsPatientService.getAppPatientHospital(patientId); + baseResponse.setObject(patientMap); + return baseResponse; + } } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPatientMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPatientMapper.java index 06e7e5e..6fc13e6 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPatientMapper.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPatientMapper.java @@ -2,16 +2,30 @@ package com.lyms.talkonlineweb.mapper; import com.lyms.talkonlineweb.domain.LymsPatient; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; +import java.util.Map; + /** * @Entity com.lyms.talkonlineweb.domain.LymsPatient */ +@Mapper public interface LymsPatientMapper extends BaseMapper { @Update(" UPDATE lyms_patient SET ccnt = ccnt+#{cnt} WHERE id = #{id}") int updatePatientCcnt(@Param("cnt") Integer cnt, @Param("id") Integer id); + + @Select("select" + + " pc.hid,pc.hname \n" + + "from\n" + + " lyms_patient pa\n" + + "left join lyms_pcase pc on pc.pid=pa.id\n" + + "where pa.id=#{patientId}\n" + + "order by pc.createdtime desc") + Map getAppPatientHospital(@Param("patientId") Integer patientId); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPatientService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPatientService.java index 587e400..85a3f0a 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPatientService.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPatientService.java @@ -3,9 +3,12 @@ package com.lyms.talkonlineweb.service; import com.lyms.talkonlineweb.domain.LymsPatient; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Map; + /** * */ public interface LymsPatientService extends IService { + Map getAppPatientHospital(Integer patientId); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPatientServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPatientServiceImpl.java index a81d21d..0ed4631 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPatientServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPatientServiceImpl.java @@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lyms.talkonlineweb.domain.LymsPatient; import com.lyms.talkonlineweb.service.LymsPatientService; import com.lyms.talkonlineweb.mapper.LymsPatientMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Map; + /** * */ @@ -13,6 +16,12 @@ import org.springframework.stereotype.Service; public class LymsPatientServiceImpl extends ServiceImpl implements LymsPatientService{ + @Autowired + private LymsPatientMapper lymsPatientMapper; + @Override + public Map getAppPatientHospital(Integer patientId) { + return lymsPatientMapper.getAppPatientHospital(patientId); + } }