Sfoglia il codice sorgente

修改用户获取患者基础信息业务

wjj 4 giorni fa
parent
commit
6d06a691ea

+ 1 - 1
fs-service/src/main/java/com/fs/patient/service/IFsPatientBaseInfoService.java

@@ -70,7 +70,7 @@ public interface IFsPatientBaseInfoService extends IService<FsPatientBaseInfo>{
      */
     R getWxaCodePatientBaseInfoUnLimit(Long patientId,String appId);
 
-    R getPatientBaseInfoDetail(Long patientId);
+    R getPatientBaseInfoDetail(Long patientId,Long userId);
 
     R patientBindUser(BindPatientParam param);
 

+ 21 - 10
fs-service/src/main/java/com/fs/patient/service/impl/FsPatientBaseInfoServiceImpl.java

@@ -179,25 +179,36 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
     }
 
     @Override
-    public R getPatientBaseInfoDetail(Long patientId) {
-        PatientBaseInfoVO patientBaseInfoVO = new PatientBaseInfoVO();
-
-        //患者信息
+    public R getPatientBaseInfoDetail(Long patientId,Long userId) {
+        //扫码的患者信息
         FsPatientBaseInfo info = fsPatientBaseInfoMapper.selectFsPatientBaseInfoById(patientId);
         if (info == null) {
             return R.error("患者信息错误");
         }
-        BeanUtils.copyProperties(info, patientBaseInfoVO);
+        FsDoctor doctor = null;
+        Long projectId = info.getProjectId();
+
+        PatientBaseInfoVO patientBaseInfoVO = new PatientBaseInfoVO();
+
 
-        //医生信息
-        FsDoctor doctor = doctorService.selectFsDoctorByDoctorId(info.getDoctorId());
+        //自己的患者信息
+        FsPatientBaseInfo selectedByUserId = fsPatientBaseInfoMapper.selectByUserId(userId);
+
+        if (selectedByUserId != null) {
+            BeanUtils.copyProperties(selectedByUserId, patientBaseInfoVO);
+            //医生信息
+            doctor = doctorService.selectFsDoctorByDoctorId(selectedByUserId.getDoctorId());
+        } else {
+            BeanUtils.copyProperties(info, patientBaseInfoVO);
+            //医生信息
+            doctor = doctorService.selectFsDoctorByDoctorId(info.getDoctorId());
+        }
         if (doctor != null) {
             patientBaseInfoVO.setDoctorName(doctor.getDoctorName());
             patientBaseInfoVO.setDoctorNo(doctor.getCertificateCode());
         }
-
-        //理疗项目信息
-        FsProject fsProject = projectService.selectFsProjectById(info.getProjectId());
+        //理疗项目信息 始终取分享的理疗数据
+        FsProject fsProject = projectService.selectFsProjectById(projectId);
         if (fsProject != null) {
             patientBaseInfoVO.setProject(fsProject);
         }

+ 2 - 1
fs-user-app/src/main/java/com/fs/app/controller/PatientBaseInfoController.java

@@ -22,7 +22,8 @@ public class PatientBaseInfoController extends  AppBaseController {
     @ApiOperation("患者信息")
     @GetMapping("/detail")
     public R detail(@RequestParam Long patientId){
-        return fsPatientBaseInfoService.getPatientBaseInfoDetail(patientId);
+        Long userId = Long.parseLong(getUserId());
+        return fsPatientBaseInfoService.getPatientBaseInfoDetail(patientId,userId);
     }
 
     @Login