JAVA全系列 教程
3762个小节阅读:7095k
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
参数名称 | 是否必须 |
---|---|
patientId | 否 |
创建Patient、PatientDto
创建PatientMapper、PatientMapper.xml
xxxxxxxxxx
package com.bjsxt.service;
import com.bjsxt.domain.Patient;
import com.bjsxt.domain.PatientFile;
import com.bjsxt.dto.PatientDto;
import com.bjsxt.vo.DataGridView;
/**
*
*/
public interface PatientService {
/**
* 分页查询
* @param patientDto
* @return
*/
DataGridView listPatientForPage(PatientDto patientDto);
/**
* 根据患者ID查询患者信息
* @param patientId
* @return
*/
Patient getPatientById(String patientId);
/**
* 根据患者ID查询患者档案信息
* @param patientId
* @return
*/
PatientFile getPatientFileById(String patientId);
}
xxxxxxxxxx
package com.bjsxt.service.impl;
import ...
/**
*
*/
public class PatientServiceImpl implements PatientService{
private PatientMapper patientMapper;
private PatientFileMapper patientFileMapper;
public DataGridView listPatientForPage(PatientDto patientDto) {
Page<Patient> page=new Page<>(patientDto.getPageNum(),patientDto.getPageSize());
QueryWrapper<Patient> qw=new QueryWrapper<>();
qw.like(StringUtils.isNotBlank(patientDto.getName()),
Patient.COL_NAME,patientDto.getName());
qw.like(StringUtils.isNotBlank(patientDto.getIdCard()),
Patient.COL_ID_CARD,patientDto.getIdCard());
qw.like(StringUtils.isNotBlank(patientDto.getPhone()),
Patient.COL_PHONE,patientDto.getPhone());
this.patientMapper.selectPage(page,qw);
return new DataGridView(page.getTotal(),page.getRecords());
}
public Patient getPatientById(String patientId) {
return this.patientMapper.selectById(patientId);
}
public PatientFile getPatientFileById(String patientId) {
return this.patientFileMapper.selectById(patientId);
}
}
xxxxxxxxxx
package com.bjsxt.controller.doctor;
/**
*
*/
import ...
/**
*
* @Auther:
* @Description: 患者库控制器
*/
"doctor/patient") (
public class PatientController {
private PatientService patientService;
private CareService careService;
/**
* 分页查询
*/
"listPatientForPage") (
// @HystrixCommand
public AjaxResult listPatientForPage(PatientDto patientDto){
DataGridView gridView=this.patientService.listPatientForPage(patientDto);
return AjaxResult.success("查询成功",gridView.getData(),gridView.getTotal());
}
/**
* 根据患者ID查询患者信息
*/
"getPatientById/{patientId}") (
public AjaxResult getPatientById( String patientId){
Patient patient=this.patientService.getPatientById(patientId);
return AjaxResult.success(patient);
}
/**
* 根据患者ID查询患者的档案信息
*/
"getPatientFileById/{patientId}") (
public AjaxResult getPatientFileById( String patientId){
PatientFile patientFile=this.patientService.getPatientFileById(patientId);
return AjaxResult.success(patientFile);
}
/**
* 根据患者ID查询患者信息、患者档案信息、历史病历
*/
"getPatientAllMessageByPatientId/{patientId}") (
public AjaxResult getPatientAllMessageByPatientId( String patientId){
//根据患者ID查询病历信息
List<CareHistory> careHistories=this.careService.queryCareHistoryByPatientId(patientId);
//构造返回的数据对象
List<Map<String,Object>> res=new ArrayList<>();
for (CareHistory careHistory : careHistories) {
Map<String, Object> careHistoryMap = BeanUtil.beanToMap(careHistory);
careHistoryMap.put("careOrders", Collections.EMPTY_LIST);
List<Map<String, Object>> reCareOrders = new ArrayList<>();
//根据病历ID查询处方列表
List<CareOrder> careOrders = this.careService.queryCareOrdersByChId(careHistory.getChId());
for (CareOrder order : careOrders) {
Map<String, Object> careOrder = BeanUtil.beanToMap(order);
List<CareOrderItem> careOrderItems = this.careService.queryCareOrderItemsByCoId(order.getCoId(),null);
careOrder.put("careOrderItems", careOrderItems);
reCareOrders.add(careOrder);
}
careHistoryMap.put("careOrders", reCareOrders);
res.add(careHistoryMap);
}
return AjaxResult.success(res);
}
}
患者Dto
xxxxxxxxxx
package com.bjsxt.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
*
* 患者信息表
*/
value="com-bjsxt-dto-PatientDto") (
callSuper=true) (
public class PatientDto extends BaseDto {
/**
* 主键
*/
value="主键") (
private String patientId;
/**
* 患者姓名
*/
value="患者姓名") (
message = "患者姓名不能为空") (
private String name;
/**
* 患者电话
*/
message = "患者电话不能为空") (
value="患者电话") (
private String phone;
/**
* 患者性别0男1女 2未知字典表 sys_user_sex
*/
message = "患者性别不能为空") (
value="患者性别0男1女 2未知字典表 sys_user_sex") (
private String sex;
/**
* 出生年月
*/
message = "患者出生年月不能为空") (
value="出生年月") (
private String birthday;
/**
* 身份证号[认证ID]
*/
message = "身份证号不能为空") (
value="身份证号[认证ID]") (
private String idCard;
/**
* 地址信息
*/
value="地址信息") (
private String address;
/**
* 过敏信息
*/
value="过敏信息") (
private String allergyInfo;
}
xxxxxxxxxx
package com.bjsxt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bjsxt.domain.Patient;
/**
*
*/
public interface PatientMapper extends BaseMapper<Patient> {
}
PatientMapper.xml
xxxxxxxxxx
<mapper namespace="com.bjsxt.mapper.PatientMapper">
<resultMap id="BaseResultMap" type="com.bjsxt.domain.Patient">
<!--@mbg.generated-->
<!--@Table his_patient-->
<id column="patient_id" jdbcType="VARCHAR" property="patientId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="sex" jdbcType="CHAR" property="sex" />
<result column="birthday" jdbcType="VARCHAR" property="birthday" />
<result column="id_card" jdbcType="CHAR" property="idCard" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="allergy_info" jdbcType="VARCHAR" property="allergyInfo" />
<result column="is_final" jdbcType="CHAR" property="isFinal" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="openid" jdbcType="VARCHAR" property="openid" />
<result column="last_login_ip" jdbcType="VARCHAR" property="lastLoginIp" />
<result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
patient_id, `name`, phone, sex, birthday, id_card, address, allergy_info, is_final,
`password`, openid, last_login_ip, last_login_time, create_time, update_time
</sql>
</mapper>
xxxxxxxxxx
package com.bjsxt.service;
import com.bjsxt.domain.Patient;
import com.bjsxt.domain.PatientFile;
import com.bjsxt.dto.PatientDto;
import com.bjsxt.vo.DataGridView;
/**
*
*/
public interface PatientService {
/**
* 分页查询
* @param patientDto
* @return
*/
DataGridView listPatientForPage(PatientDto patientDto);
/**
* 根据患者ID查询患者信息
* @param patientId
* @return
*/
Patient getPatientById(String patientId);
/**
* 根据患者ID查询患者档案信息
* @param patientId
* @return
*/
PatientFile getPatientFileById(String patientId);
}
xxxxxxxxxx
package com.bjsxt.service.impl;
import ...
/**
*
*/
public class PatientServiceImpl implements PatientService{
private PatientMapper patientMapper;
private PatientFileMapper patientFileMapper;
public DataGridView listPatientForPage(PatientDto patientDto) {
Page<Patient> page=new Page<>(patientDto.getPageNum(),patientDto.getPageSize());
QueryWrapper<Patient> qw=new QueryWrapper<>();
qw.like(StringUtils.isNotBlank(patientDto.getName()),
Patient.COL_NAME,patientDto.getName());
qw.like(StringUtils.isNotBlank(patientDto.getIdCard()),
Patient.COL_ID_CARD,patientDto.getIdCard());
qw.like(StringUtils.isNotBlank(patientDto.getPhone()),
Patient.COL_PHONE,patientDto.getPhone());
this.patientMapper.selectPage(page,qw);
return new DataGridView(page.getTotal(),page.getRecords());
}
public Patient getPatientById(String patientId) {
return this.patientMapper.selectById(patientId);
}
public PatientFile getPatientFileById(String patientId) {
return this.patientFileMapper.selectById(patientId);
}
/**
* 根据身份证号查询患者信息
* @param idCard
* @return
*/
public Patient getPatientByIdCard(String idCard) {
QueryWrapper<Patient> qw=new QueryWrapper<>();
qw.eq(Patient.COL_ID_CARD,idCard);
return this.patientMapper.selectOne(qw);
}
public Patient addPatient(PatientDto patientDto) {
Patient patient=new Patient();
BeanUtil.copyProperties(patientDto,patient);
patient.setCreateTime(DateUtil.date());
patient.setIsFinal(Constants.IS_FINAL_FALSE);//第一次添患者,状态为未完善
String defaultPwd=patient.getPhone().substring(5);
patient.setPassword(AppMd5Utils.md5(defaultPwd,patient.getPhone(),2));
this.patientMapper.insert(patient);
return patient;
}
}
xxxxxxxxxx
package com.bjsxt.controller.doctor;
/**
*
*/
import ...
/**
*
* @Auther:
* @Description: 患者库控制器
*/
"doctor/patient") (
public class PatientController {
private PatientService patientService;
private CareService careService;
/**
* 分页查询
*/
"listPatientForPage") (
// @HystrixCommand
public AjaxResult listPatientForPage(PatientDto patientDto){
DataGridView gridView=this.patientService.listPatientForPage(patientDto);
return AjaxResult.success("查询成功",gridView.getData(),gridView.getTotal());
}
/**
* 根据患者ID查询患者信息
*/
"getPatientById/{patientId}") (
public AjaxResult getPatientById( String patientId){
Patient patient=this.patientService.getPatientById(patientId);
return AjaxResult.success(patient);
}
/**
* 根据患者ID查询患者的档案信息
*/
"getPatientFileById/{patientId}") (
public AjaxResult getPatientFileById( String patientId){
PatientFile patientFile=this.patientService.getPatientFileById(patientId);
return AjaxResult.success(patientFile);
}
/**
* 根据患者ID查询患者信息、患者档案信息、历史病历
*/
"getPatientAllMessageByPatientId/{patientId}") (
public AjaxResult getPatientAllMessageByPatientId( String patientId){
//根据患者ID查询病历信息
List<CareHistory> careHistories=this.careService.queryCareHistoryByPatientId(patientId);
//构造返回的数据对象
List<Map<String,Object>> res=new ArrayList<>();
for (CareHistory careHistory : careHistories) {
Map<String, Object> careHistoryMap = BeanUtil.beanToMap(careHistory);
careHistoryMap.put("careOrders", Collections.EMPTY_LIST);
List<Map<String, Object>> reCareOrders = new ArrayList<>();
//根据病历ID查询处方列表
List<CareOrder> careOrders = this.careService.queryCareOrdersByChId(careHistory.getChId());
for (CareOrder order : careOrders) {
Map<String, Object> careOrder = BeanUtil.beanToMap(order);
List<CareOrderItem> careOrderItems = this.careService.queryCareOrderItemsByCoId(order.getCoId(),null);
careOrder.put("careOrderItems", careOrderItems);
reCareOrders.add(careOrder);
}
careHistoryMap.put("careOrders", reCareOrders);
res.add(careHistoryMap);
}
return AjaxResult.success(res);
}
}
根据患者id查询患者就诊记录/doctor/patient/getPatientAllMessageByPatientId/{patientId}