Kaynağa Gözat

患者基础信息

wjj 5 gün önce
ebeveyn
işleme
33da73229f

+ 124 - 0
fs-company/src/main/java/com/fs/company/controller/patient/FsPatientBaseInfoController.java

@@ -0,0 +1,124 @@
+package com.fs.company.controller.patient;
+
+import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.framework.security.LoginUser;
+import com.fs.framework.security.SecurityUtils;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.patient.domain.FsPatientBaseInfo;
+import com.fs.patient.service.IFsPatientBaseInfoService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 患者基本信息Controller
+ * 
+ * @author fs
+ * @date 2026-04-19
+ */
+@RestController
+@RequestMapping("/company/patient")
+public class FsPatientBaseInfoController extends BaseController
+{
+    @Autowired
+    private IFsPatientBaseInfoService fsPatientBaseInfoService;
+
+    /**
+     * 查询患者基本信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        startPage();
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        fsPatientBaseInfo.setCompanyUserId(loginUser.getUser().getUserId());
+        List<FsPatientBaseInfo> list = fsPatientBaseInfoService.selectFsPatientBaseInfoList(fsPatientBaseInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出患者基本信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:export')")
+    @Log(title = "患者基本信息", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        List<FsPatientBaseInfo> list = fsPatientBaseInfoService.selectFsPatientBaseInfoList(fsPatientBaseInfo);
+        ExcelUtil<FsPatientBaseInfo> util = new ExcelUtil<FsPatientBaseInfo>(FsPatientBaseInfo.class);
+        return util.exportExcel(list, "患者基本信息数据");
+    }
+
+    /**
+     * 获取患者基本信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsPatientBaseInfoService.selectFsPatientBaseInfoById(id));
+    }
+
+    /**
+     * 新增患者基本信息
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:add')")
+    @Log(title = "患者基本信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        fsPatientBaseInfo.setCompanyUserId(loginUser.getUser().getUserId());
+        return toAjax(fsPatientBaseInfoService.insertFsPatientBaseInfo(fsPatientBaseInfo));
+    }
+
+    /**
+     * 修改患者基本信息
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:edit')")
+    @Log(title = "患者基本信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        return toAjax(fsPatientBaseInfoService.updateFsPatientBaseInfo(fsPatientBaseInfo));
+    }
+
+    /**
+     * 删除患者基本信息
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:remove')")
+    @Log(title = "患者基本信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(fsPatientBaseInfoService.deleteFsPatientBaseInfoByIds(ids));
+    }
+
+    /**
+     * 生成患者信息二维码
+     */
+    @PreAuthorize("@ss.hasPermi('patient:info:WxaCodePatientUnLimit')")
+    @GetMapping("/getWxaCodePatientUnLimit/{patientId}/{appId}")
+    public R getWxaCodePatientUnLimit(@PathVariable("patientId") Long patientId, @PathVariable("appId") String appId)
+    {
+
+        return fsPatientBaseInfoService.getWxaCodePatientBaseInfoUnLimit(patientId,appId);
+
+    }
+
+}

+ 36 - 0
fs-doctor-app/src/main/java/com/fs/app/controller/PatientBaseInfoController.java

@@ -0,0 +1,36 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.his.param.FsPatientBaseInfoListDParam;
+import com.fs.his.vo.FsPatientBaseInfoListDVO;
+import com.fs.patient.domain.FsPatientBaseInfo;
+import com.fs.patient.service.IFsPatientBaseInfoService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+//用户信息采集控制
+@RestController
+@RequestMapping("/app/patientBase")
+public class PatientBaseInfoController extends AppBaseController {
+
+    @Autowired
+    private IFsPatientBaseInfoService patientBaseInfoService;
+
+    @GetMapping("/list")
+    public R getList(FsPatientBaseInfoListDParam param){
+        param.setDoctorId(Long.parseLong(getDoctorId()));
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<FsPatientBaseInfoListDVO> infoListDVOList = patientBaseInfoService.selectFsPatientBaseInfoListDVO(param);
+        PageInfo<FsPatientBaseInfoListDVO> pageInfo = new PageInfo<>(infoListDVOList);
+        return R.ok().put("data", pageInfo);
+    }
+
+    @PostMapping("/diagnose")
+    public R diagnose(@RequestBody FsPatientBaseInfo param){
+        return patientBaseInfoService.diagnose(param);
+    }
+}

+ 15 - 0
fs-service/src/main/java/com/fs/his/param/FsPatientBaseInfoListDParam.java

@@ -0,0 +1,15 @@
+package com.fs.his.param;
+
+import lombok.Data;
+
+@Data
+public class FsPatientBaseInfoListDParam extends BaseParam{
+
+    private Long doctorId;
+    private Long projectId;
+
+    private Integer doctorStatus;
+
+    private String name;
+
+}

+ 51 - 0
fs-service/src/main/java/com/fs/his/vo/FsPatientBaseInfoListDVO.java

@@ -0,0 +1,51 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FsPatientBaseInfoListDVO {
+    private Long id;
+
+    /** 姓名 */
+    private String name;
+
+    /** 性别 0-女 1-男 */
+    private Integer sex;
+
+    /** 年龄 */
+    private Long age;
+
+    /** 患者基本信息 */
+    private String baseInfo;
+
+    /** 诊断结果 */
+    private String diagnosisResult;
+
+    /** 治疗目标 */
+    private String treatmentTarget;
+
+    /** 医生id */
+    private Long doctorId;
+
+    /** 理疗方案id */
+    private Long projectId;
+
+    /** 用户id */
+    private Long userId;
+
+    /** 状态 0-未绑定 1-已绑定 */
+    private Integer status;
+
+    /** 医生完善状态 0-未完善 1-已完善 */
+    private Integer doctorStatus;
+
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
+
+    //医生诊断时间
+    private Date diagnosisTime;
+}

+ 75 - 0
fs-service/src/main/java/com/fs/patient/domain/FsPatientBaseInfo.java

@@ -0,0 +1,75 @@
+package com.fs.patient.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 患者基本信息对象 fs_patient_base_info
+ *
+ * @author fs
+ * @date 2026-04-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsPatientBaseInfo extends BaseEntity{
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 姓名 */
+    @Excel(name = "姓名")
+    private String name;
+
+    /** 性别 0-女 1-男 */
+    @Excel(name = "性别 0-女 1-男")
+    private Integer sex;
+
+    /** 年龄 */
+    @Excel(name = "年龄")
+    private Long age;
+
+    /** 患者基本信息 */
+    @Excel(name = "患者基本信息")
+    private String baseInfo;
+
+    /** 诊断结果 */
+    @Excel(name = "诊断结果")
+    private String diagnosisResult;
+
+    /** 治疗目标 */
+    @Excel(name = "治疗目标")
+    private String treatmentTarget;
+
+    /** 医生id */
+    @Excel(name = "医生id")
+    private Long doctorId;
+
+    /** 理疗方案id */
+    @Excel(name = "理疗方案id")
+    private Long projectId;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /** 状态 0-未绑定 1-已绑定 */
+    @Excel(name = "状态 0-未绑定 1-已绑定")
+    private Integer status;
+
+    /** 医生完善状态 0-未完善 1-已完善 */
+    @Excel(name = "医生完善状态 0-未完善 1-已完善")
+    private Integer doctorStatus;
+
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
+
+    //医生诊断时间
+    private Date diagnosisTime;
+}

+ 69 - 0
fs-service/src/main/java/com/fs/patient/mapper/FsPatientBaseInfoMapper.java

@@ -0,0 +1,69 @@
+package com.fs.patient.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.param.FsPatientBaseInfoListDParam;
+import com.fs.his.vo.FsPatientBaseInfoListDVO;
+import com.fs.patient.domain.FsPatientBaseInfo;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * 患者基本信息Mapper接口
+ * 
+ * @author fs
+ * @date 2026-04-19
+ */
+public interface FsPatientBaseInfoMapper extends BaseMapper<FsPatientBaseInfo>{
+    /**
+     * 查询患者基本信息
+     * 
+     * @param id 患者基本信息主键
+     * @return 患者基本信息
+     */
+    FsPatientBaseInfo selectFsPatientBaseInfoById(Long id);
+
+    /**
+     * 查询患者基本信息列表
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 患者基本信息集合
+     */
+    List<FsPatientBaseInfo> selectFsPatientBaseInfoList(FsPatientBaseInfo fsPatientBaseInfo);
+
+    /**
+     * 新增患者基本信息
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 结果
+     */
+    int insertFsPatientBaseInfo(FsPatientBaseInfo fsPatientBaseInfo);
+
+    /**
+     * 修改患者基本信息
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 结果
+     */
+    int updateFsPatientBaseInfo(FsPatientBaseInfo fsPatientBaseInfo);
+
+    /**
+     * 删除患者基本信息
+     * 
+     * @param id 患者基本信息主键
+     * @return 结果
+     */
+    int deleteFsPatientBaseInfoById(Long id);
+
+    /**
+     * 批量删除患者基本信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsPatientBaseInfoByIds(Long[] ids);
+
+    @Select("SELECT *  FROM fs_patient_base_info WHERE user_id  = #{userId}")
+    FsPatientBaseInfo selectByUserId(Long userId);
+
+    List<FsPatientBaseInfoListDVO> selectFsPatientBaseInfoListDVO(FsPatientBaseInfoListDParam param);
+}

+ 10 - 0
fs-service/src/main/java/com/fs/patient/param/BindPatientParam.java

@@ -0,0 +1,10 @@
+package com.fs.patient.param;
+
+import lombok.Data;
+
+@Data
+public class BindPatientParam {
+    private Long userId;
+    private Long patientId;
+    private Long companyUserId;
+}

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

@@ -0,0 +1,80 @@
+package com.fs.patient.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.common.core.domain.R;
+import com.fs.his.param.FsPatientBaseInfoListDParam;
+import com.fs.his.vo.FsPatientBaseInfoListDVO;
+import com.fs.patient.domain.FsPatientBaseInfo;
+import com.fs.patient.param.BindPatientParam;
+
+/**
+ * 患者基本信息Service接口
+ * 
+ * @author fs
+ * @date 2026-04-19
+ */
+public interface IFsPatientBaseInfoService extends IService<FsPatientBaseInfo>{
+    /**
+     * 查询患者基本信息
+     * 
+     * @param id 患者基本信息主键
+     * @return 患者基本信息
+     */
+    FsPatientBaseInfo selectFsPatientBaseInfoById(Long id);
+
+    /**
+     * 查询患者基本信息列表
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 患者基本信息集合
+     */
+    List<FsPatientBaseInfo> selectFsPatientBaseInfoList(FsPatientBaseInfo fsPatientBaseInfo);
+
+    /**
+     * 新增患者基本信息
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 结果
+     */
+    int insertFsPatientBaseInfo(FsPatientBaseInfo fsPatientBaseInfo);
+
+    /**
+     * 修改患者基本信息
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 结果
+     */
+    int updateFsPatientBaseInfo(FsPatientBaseInfo fsPatientBaseInfo);
+
+    /**
+     * 批量删除患者基本信息
+     * 
+     * @param ids 需要删除的患者基本信息主键集合
+     * @return 结果
+     */
+    int deleteFsPatientBaseInfoByIds(Long[] ids);
+
+    /**
+     * 删除患者基本信息信息
+     * 
+     * @param id 患者基本信息主键
+     * @return 结果
+     */
+    int deleteFsPatientBaseInfoById(Long id);
+
+    /**
+     * 生成患者信息二维码
+     * @param patientId 患者id
+     * @return 二维码
+     */
+    R getWxaCodePatientBaseInfoUnLimit(Long patientId,String appId);
+
+    R getPatientBaseInfoDetail(Long patientId);
+
+    R patientBindUser(BindPatientParam param);
+
+    List<FsPatientBaseInfoListDVO> selectFsPatientBaseInfoListDVO(FsPatientBaseInfoListDParam param);
+
+    R diagnose(FsPatientBaseInfo param);
+}

+ 263 - 0
fs-service/src/main/java/com/fs/patient/service/impl/FsPatientBaseInfoServiceImpl.java

@@ -0,0 +1,263 @@
+package com.fs.patient.service.impl;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import com.fs.common.core.domain.R;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.mapper.CompanyUserMapper;
+import com.fs.core.config.WxMaConfiguration;
+import com.fs.his.domain.FsDoctor;
+import com.fs.his.domain.FsProject;
+import com.fs.his.param.FsPatientBaseInfoListDParam;
+import com.fs.his.service.IFsDoctorService;
+import com.fs.his.service.IFsProjectService;
+import com.fs.his.vo.FsPatientBaseInfoListDVO;
+import com.fs.patient.param.BindPatientParam;
+import com.fs.patient.vo.PatientBaseInfoVO;
+import com.fs.system.oss.CloudStorageService;
+import com.fs.system.oss.OSSFactory;
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.patient.mapper.FsPatientBaseInfoMapper;
+import com.fs.patient.domain.FsPatientBaseInfo;
+import com.fs.patient.service.IFsPatientBaseInfoService;
+
+/**
+ * 患者基本信息Service业务层处理
+ * 
+ * @author fs
+ * @date 2026-04-19
+ */
+@Slf4j
+@Service
+public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoMapper, FsPatientBaseInfo> implements IFsPatientBaseInfoService {
+
+    @Autowired
+    private CompanyUserMapper companyUserMapper;
+
+    @Autowired
+    private IFsDoctorService doctorService;
+
+
+    @Autowired
+    private FsPatientBaseInfoMapper fsPatientBaseInfoMapper;
+
+    @Autowired
+    private IFsProjectService projectService;
+    /**
+     * 查询患者基本信息
+     * 
+     * @param id 患者基本信息主键
+     * @return 患者基本信息
+     */
+    @Override
+    public FsPatientBaseInfo selectFsPatientBaseInfoById(Long id)
+    {
+        return baseMapper.selectFsPatientBaseInfoById(id);
+    }
+
+    /**
+     * 查询患者基本信息列表
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 患者基本信息
+     */
+    @Override
+    public List<FsPatientBaseInfo> selectFsPatientBaseInfoList(FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        return baseMapper.selectFsPatientBaseInfoList(fsPatientBaseInfo);
+    }
+
+    /**
+     * 新增患者基本信息
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 结果
+     */
+    @Override
+    public int insertFsPatientBaseInfo(FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        fsPatientBaseInfo.setCreateTime(DateUtils.getNowDate());
+        fsPatientBaseInfo.setDoctorStatus(0);
+        fsPatientBaseInfo.setStatus(0);
+        CompanyUser companyUser = companyUserMapper.selectCompanyUserById(fsPatientBaseInfo.getCompanyUserId());
+        if (companyUser != null) {
+            if (companyUser.getDoctorId() != null) {
+                fsPatientBaseInfo.setDoctorId(companyUser.getDoctorId());
+            } else {
+                Long doctorId = doctorService.selectFsDoctorDoctorByPackage();
+                fsPatientBaseInfo.setDoctorId(doctorId);
+            }
+        } else {
+            throw new CustomException("销售信息错误!");
+        }
+        return baseMapper.insertFsPatientBaseInfo(fsPatientBaseInfo);
+    }
+
+    /**
+     * 修改患者基本信息
+     * 
+     * @param fsPatientBaseInfo 患者基本信息
+     * @return 结果
+     */
+    @Override
+    public int updateFsPatientBaseInfo(FsPatientBaseInfo fsPatientBaseInfo)
+    {
+        fsPatientBaseInfo.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateFsPatientBaseInfo(fsPatientBaseInfo);
+    }
+
+    /**
+     * 批量删除患者基本信息
+     * 
+     * @param ids 需要删除的患者基本信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsPatientBaseInfoByIds(Long[] ids)
+    {
+        return baseMapper.deleteFsPatientBaseInfoByIds(ids);
+    }
+
+    /**
+     * 删除患者基本信息信息
+     * 
+     * @param id 患者基本信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsPatientBaseInfoById(Long id)
+    {
+        return baseMapper.deleteFsPatientBaseInfoById(id);
+    }
+
+    @Override
+    public R getWxaCodePatientBaseInfoUnLimit(Long patientId,String appId) {
+        log.info("生成用患者信息二维码,请求参数:{},{}",patientId,appId);
+
+        final WxMaService wxMaService = WxMaConfiguration.getMaService(appId);
+        String scene="patientId="+ patientId ;
+        byte[] file;
+        try {
+            file = wxMaService.getQrcodeService().createWxaCodeUnlimitBytes(
+                    scene,
+                    "pages_user/healthRegimen",
+                    true,
+                    "release",//release trial
+                    430,
+                    true,
+                    null,
+                    false);
+
+            // 上传图片到存储桶
+            String suffix = ".png";
+            CloudStorageService storage = OSSFactory.build();
+            String url;
+            try {
+                url = storage.uploadSuffix(file, suffix);
+            }  catch (Exception e) {
+                // 记录错误日志
+                log.error("生成图片失败:{}",e.getMessage(),e);
+                return R.error("生成图片失败");
+            }
+            // 返回成功信息
+            return R.ok().put("url",url);
+
+        } catch (WxErrorException e) {
+            log.error(e.getMessage(), e);
+            return R.error("微信接口调用失败: " + e.getMessage());
+        }
+    }
+
+    @Override
+    public R getPatientBaseInfoDetail(Long patientId) {
+        PatientBaseInfoVO patientBaseInfoVO = new PatientBaseInfoVO();
+
+        //患者信息
+        FsPatientBaseInfo info = fsPatientBaseInfoMapper.selectFsPatientBaseInfoById(patientId);
+        if (info == null) {
+            return R.error("患者信息错误");
+        }
+        BeanUtils.copyProperties(info, patientBaseInfoVO);
+
+        //医生信息
+        FsDoctor doctor = doctorService.selectFsDoctorByDoctorId(info.getDoctorId());
+        if (doctor != null) {
+            patientBaseInfoVO.setDoctorName(doctor.getDoctorName());
+            patientBaseInfoVO.setDoctorNo(doctor.getCertificateCode());
+        }
+
+        //理疗项目信息
+        FsProject fsProject = projectService.selectFsProjectById(info.getProjectId());
+        if (fsProject != null) {
+            patientBaseInfoVO.setProject(fsProject);
+        }
+
+        return R.ok().put("data", patientBaseInfoVO);
+    }
+
+    @Override
+    public R patientBindUser(BindPatientParam param) {
+
+        if (param.getCompanyUserId() != null) {
+            return R.error("销售不能绑定");
+        }
+        FsPatientBaseInfo selectByUserId = fsPatientBaseInfoMapper.selectByUserId(param.getUserId());
+        if (selectByUserId != null) {
+            return R.error("已绑定过患者信息,无需绑定");
+        }
+        FsPatientBaseInfo info = fsPatientBaseInfoMapper.selectFsPatientBaseInfoById(param.getPatientId());
+        if (info == null) {
+            return R.error("患者信息错误,绑定失败");
+        }
+        if (info.getStatus() == 1) {
+            return R.error("患者信息已绑定,绑定失败");
+        }
+        FsPatientBaseInfo map    = new FsPatientBaseInfo();
+        map.setId(info.getId());
+        map.setUserId(param.getUserId());
+        map.setStatus(1);
+        int i = fsPatientBaseInfoMapper.updateFsPatientBaseInfo(map);
+        if (i > 0) {
+            return R.ok();
+        }
+        return R.error();
+    }
+
+    @Override
+    public List<FsPatientBaseInfoListDVO> selectFsPatientBaseInfoListDVO(FsPatientBaseInfoListDParam param) {
+        return fsPatientBaseInfoMapper.selectFsPatientBaseInfoListDVO(param);
+    }
+
+    @Override
+    public R diagnose(FsPatientBaseInfo param) {
+        FsPatientBaseInfo info = fsPatientBaseInfoMapper.selectFsPatientBaseInfoById(param.getId());
+        if (info == null) {
+            return R.error("患者信息错误,诊断失败");
+        }
+        if (info.getDoctorStatus() == 1) {
+            return R.error("患者信息已诊断");
+        }
+
+        FsPatientBaseInfo map = new FsPatientBaseInfo();
+        map.setId(info.getId());
+        map.setDoctorStatus(1);
+        map.setDiagnosisTime(new Date());
+        map.setDiagnosisResult(param.getDiagnosisResult());
+        map.setTreatmentTarget(param.getTreatmentTarget());
+        int i = fsPatientBaseInfoMapper.updateFsPatientBaseInfo(map);
+        if (i > 0) {
+            return R.ok();
+        }
+        return R.error("诊断失败");
+    }
+}

+ 50 - 0
fs-service/src/main/java/com/fs/patient/vo/PatientBaseInfoVO.java

@@ -0,0 +1,50 @@
+package com.fs.patient.vo;
+
+import com.fs.common.annotation.Excel;
+import com.fs.his.domain.FsProject;
+import lombok.Data;
+
+@Data
+public class PatientBaseInfoVO {
+
+    private Long id;
+
+    /** 姓名 */
+    private String name;
+
+    /** 性别 0-女 1-男 */
+    private Integer sex;
+
+    /** 年龄 */
+    private Long age;
+
+    /** 患者基本信息 */
+    private String baseInfo;
+
+    /** 诊断结果 */
+    private String diagnosisResult;
+
+    /** 治疗目标 */
+    private String treatmentTarget;
+
+    /**
+     * 医生编号
+     */
+    private String doctorNo;
+
+    /**
+     * 医生名称
+     */
+    private String doctorName;
+
+    /**
+     * 理疗数据
+     */
+    private FsProject project;
+
+    /** 用户id */
+    private Long userId;
+
+    /** 状态 0-未绑定 1-已绑定 */
+    private Integer status;
+}

+ 134 - 0
fs-service/src/main/resources/mapper/patient/FsPatientBaseInfoMapper.xml

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.patient.mapper.FsPatientBaseInfoMapper">
+    
+    <resultMap type="FsPatientBaseInfo" id="FsPatientBaseInfoResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="sex"    column="sex"    />
+        <result property="age"    column="age"    />
+        <result property="baseInfo"    column="base_info"    />
+        <result property="diagnosisResult"    column="diagnosis_result"    />
+        <result property="treatmentTarget"    column="treatment_target"    />
+        <result property="doctorId"    column="doctor_id"    />
+        <result property="projectId"    column="project_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="userId"    column="user_id"    />
+        <result property="status"    column="status"    />
+        <result property="doctorStatus"    column="doctor_status"    />
+        <result property="companyUserId"    column="company_user_id"    />
+        <result property="diagnosisTime"    column="diagnosis_time"    />
+    </resultMap>
+
+    <sql id="selectFsPatientBaseInfoVo">
+        select id, name, sex, age, base_info, diagnosis_result, treatment_target, doctor_id, project_id, create_time, update_time, user_id, status, doctor_status,company_user_id,diagnosis_time from fs_patient_base_info
+    </sql>
+
+    <select id="selectFsPatientBaseInfoList" parameterType="FsPatientBaseInfo" resultMap="FsPatientBaseInfoResult">
+        <include refid="selectFsPatientBaseInfoVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="sex != null "> and sex = #{sex}</if>
+            <if test="age != null "> and age = #{age}</if>
+            <if test="baseInfo != null  and baseInfo != ''"> and base_info = #{baseInfo}</if>
+            <if test="diagnosisResult != null  and diagnosisResult != ''"> and diagnosis_result = #{diagnosisResult}</if>
+            <if test="doctorId != null "> and doctor_id = #{doctorId}</if>
+            <if test="projectId != null "> and project_id = #{projectId}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="doctorStatus != null "> and doctor_status = #{doctorStatus}</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+        </where>
+        ORDER BY create_time DESC
+    </select>
+    
+    <select id="selectFsPatientBaseInfoById" parameterType="Long" resultMap="FsPatientBaseInfoResult">
+        <include refid="selectFsPatientBaseInfoVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertFsPatientBaseInfo" parameterType="FsPatientBaseInfo" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_patient_base_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">name,</if>
+            <if test="sex != null">sex,</if>
+            <if test="age != null">age,</if>
+            <if test="baseInfo != null">base_info,</if>
+            <if test="diagnosisResult != null">diagnosis_result,</if>
+            <if test="treatmentTarget != null">treatment_target,</if>
+            <if test="doctorId != null">doctor_id,</if>
+            <if test="projectId != null">project_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="status != null">status,</if>
+            <if test="doctorStatus != null">doctor_status,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="diagnosisTime != null">diagnosis_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="sex != null">#{sex},</if>
+            <if test="age != null">#{age},</if>
+            <if test="baseInfo != null">#{baseInfo},</if>
+            <if test="diagnosisResult != null">#{diagnosisResult},</if>
+            <if test="treatmentTarget != null">#{treatmentTarget},</if>
+            <if test="doctorId != null">#{doctorId},</if>
+            <if test="projectId != null">#{projectId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="status != null">#{status},</if>
+            <if test="doctorStatus != null">#{doctorStatus},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="diagnosisTime != null">#{diagnosisTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsPatientBaseInfo" parameterType="FsPatientBaseInfo">
+        update fs_patient_base_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="sex != null">sex = #{sex},</if>
+            <if test="age != null">age = #{age},</if>
+            <if test="baseInfo != null">base_info = #{baseInfo},</if>
+            <if test="diagnosisResult != null">diagnosis_result = #{diagnosisResult},</if>
+            <if test="treatmentTarget != null">treatment_target = #{treatmentTarget},</if>
+            <if test="doctorId != null">doctor_id = #{doctorId},</if>
+            <if test="projectId != null">project_id = #{projectId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="doctorStatus != null">doctor_status = #{doctorStatus},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="diagnosisTime != null">diagnosis_time = #{diagnosisTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsPatientBaseInfoById" parameterType="Long">
+        delete from fs_patient_base_info where id = #{id}
+    </delete>
+
+    <delete id="deleteFsPatientBaseInfoByIds" parameterType="String">
+        delete from fs_patient_base_info where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectFsPatientBaseInfoListDVO" parameterType="com.fs.his.param.FsPatientBaseInfoListDParam" resultType="com.fs.his.vo.FsPatientBaseInfoListDVO">
+        <include refid="selectFsPatientBaseInfoVo"/>
+        <where>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="doctorId != null "> and doctor_id = #{doctorId}</if>
+            <if test="projectId != null "> and project_id = #{projectId}</if>
+            <if test="doctorStatus != null "> and doctor_status = #{doctorStatus}</if>
+        </where>
+        ORDER BY doctor_status ASC
+    </select>
+</mapper>

+ 35 - 0
fs-user-app/src/main/java/com/fs/app/controller/PatientBaseInfoController.java

@@ -0,0 +1,35 @@
+package com.fs.app.controller;
+
+import com.fs.app.annotation.Login;
+import com.fs.common.core.domain.R;
+import com.fs.patient.param.BindPatientParam;
+import com.fs.patient.service.IFsPatientBaseInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@Api("患者基本信息接口")
+@RestController
+@RequestMapping(value="/app/patientBase")
+public class PatientBaseInfoController extends  AppBaseController {
+
+    @Autowired
+    private IFsPatientBaseInfoService fsPatientBaseInfoService;
+
+
+    @Login
+    @ApiOperation("患者信息")
+    @GetMapping("/detail")
+    public R detail(@RequestParam Long patientId){
+        return fsPatientBaseInfoService.getPatientBaseInfoDetail(patientId);
+    }
+
+    @Login
+    @ApiOperation("绑定患者信息")
+    @PostMapping("/bind")
+    public R bind(@RequestBody BindPatientParam param){
+        param.setUserId(Long.parseLong(getUserId()));
+        return fsPatientBaseInfoService.patientBindUser(param);
+    }
+}