JAVA全系列 教程
3762个小节阅读:7089.7k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
名称 | 类型 | 是否必须 |
---|---|---|
patientDto | object | 非必须 |
├─ patientId | String | 非必须 |
├─ name | String | 非必须 |
├─ phone | String | 非必须 |
├─ sex | String | 非必须 |
├─ birthday | String | 非必须 |
├─ idCard | String | 非必须 |
├─ address | String | 非必须 |
├─ allergyInfo | String | 非必须 |
├─ isFinal | String | 非必须 |
├─ createTime | String | 非必须 |
├─ updateTime | String | 非必须 |
├─ age | int | 非必须 |
registrationDto | object | 非必须 |
├─ deptId | int | 非必须 |
├─ regItemId | int | 非必须 |
├─ regItemAmount | int | 非必须 |
├─ visitDate | String | 非必须 |
├─ schedulingType | String | 非必须 |
├─ subsectionType | String | 非必须 |
返回JSON数据
名称 | 类型 | 其他信息 |
---|---|---|
msg | String | |
code | int | |
data | String |
创建Registration、RegistrationDto
创建RegistrationMapper、RegistrationMapper.xml
xxxxxxxxxx
package com.bjsxt.service;
import com.bjsxt.domain.Registration;
import com.bjsxt.dto.RegistrationDto;
import com.bjsxt.vo.DataGridView;
import java.util.List;
/**
*
*/
public interface RegistrationService {
/**
* 添加挂号信息
* @param registrationDto
*/
void addRegistration(RegistrationDto registrationDto);
/**
* 根据挂号单ID查询挂号单信息
* @param regId
* @return
*/
Registration queryRegistrationByRegId(String regId);
/**
* 根据ID更新挂号单的信息
* @param registration
* @return
*/
int updateRegistrationByRegId(Registration registration);
/**
* 分页查询挂号单
* @param registrationDto
* @return
*/
DataGridView queryRegistrationForPage(RegistrationDto registrationDto);
/**
* 根据条件查询挂号信息
* @param deptId 部门
* @param subsectionType 时段
* @param scheudlingType 类型 门诊 急诊
* @param regStatus 挂号单状态
* @param userId 医生ID
* @return
*/
List<Registration> queryRegistration(Long deptId, String subsectionType, String scheudlingType, String regStatus, Long userId);
}
xxxxxxxxxx
package com.bjsxt.service.impl;
import ...
/**
*
*/
@Service
public class RegistrationServiceImpl implements RegistrationService{
@Autowired
private RegistrationMapper registrationMapper;
@Override
public void addRegistration(RegistrationDto registrationDto) {
Registration registration=new Registration();
BeanUtil.copyProperties(registrationDto,registration);
registration.setRegStatus(Constants.REG_STATUS_0);//挂号添加为未收费
registration.setCreateBy(registrationDto.getSimpleUser().getUserName());
registration.setCreateTime(DateUtil.date());
this.registrationMapper.insert(registration);
}
@Override
public Registration queryRegistrationByRegId(String regId) {
return this.registrationMapper.selectById(regId);
}
@Override
public int updateRegistrationByRegId(Registration registration) {
return this.registrationMapper.updateById(registration);
}
@Override
public DataGridView queryRegistrationForPage(RegistrationDto registrationDto) {
Page<Registration> page=new Page<>(registrationDto.getPageNum(),registrationDto.getPageSize());
QueryWrapper<Registration> qw=new QueryWrapper<>();
qw.eq(registrationDto.getDeptId()!=null,Registration.COL_DEPT_ID,
registrationDto.getDeptId());
qw.like(StringUtils.isNotBlank(registrationDto.getPatientName()),
Registration.COL_PATIENT_NAME,registrationDto.getPatientName());
qw.eq(StringUtils.isNotBlank(registrationDto.getSchedulingType()),
Registration.COL_SCHEDULING_TYPE,registrationDto.getSchedulingType());
qw.eq(StringUtils.isNotBlank(registrationDto.getSubsectionType()),
Registration.COL_SUBSECTION_TYPE,registrationDto.getSubsectionType());
qw.eq(StringUtils.isNotBlank(registrationDto.getRegStatus()),
Registration.COL_REG_STATUS,registrationDto.getRegStatus());
qw.eq(StringUtils.isNotBlank(registrationDto.getVisitDate()),
Registration.COL_VISIT_DATE,registrationDto.getVisitDate());
qw.orderByDesc(Registration.COL_CREATE_TIME);
this.registrationMapper.selectPage(page,qw);
return new DataGridView(page.getTotal(),page.getRecords());
}
/**
* 根据条件查询挂号信息
* @param deptId 部门
* @param subsectionType 时段
* @param scheudlingType 类型 门诊 急诊
* @param regStatus 挂号单状态
* @param userId 医生ID
* @return
*/
@Override
public List<Registration> queryRegistration(Long deptId, String subsectionType, String scheudlingType, String regStatus, Long userId) {
QueryWrapper<Registration> qw=new QueryWrapper<>();
qw.eq(Registration.COL_DEPT_ID,deptId);
qw.eq(StringUtils.isNotBlank(subsectionType),
Registration.COL_SUBSECTION_TYPE,subsectionType);
qw.eq(Registration.COL_SCHEDULING_TYPE,scheudlingType);
qw.eq(Registration.COL_REG_STATUS,regStatus);
qw.eq(Registration.COL_VISIT_DATE,DateUtil.format(DateUtil.date(),"yyyy-MM-dd"));
qw.eq(null!=userId,Registration.COL_USER_ID,userId);
qw.orderByAsc(Registration.COL_REG_NUMBER);
return this.registrationMapper.selectList(qw);
}
}
修改DeptService
xxxxxxxxxx
/**
* 根据部门 ID 查询部门信息
* @param deptIds
* @return
*/
List<Dept> listDeptByDeptIds(List<Long> deptIds);
/**
* 根据部门 ID 更新部门挂号编号
* @param deptId
* @param regNumber
*/
void updateDeptRegNumber(Long deptId, Integer regNumber);
修改DeptServiceImpl
xxxxxxxxxx
@Override
public List<Dept> listDeptByDeptIds(List<Long> deptIds) {
QueryWrapper<Dept> qw=new QueryWrapper<>();
qw.in(Dept.COL_DEPT_ID,deptIds);
return this.deptMapper.selectList(qw);
}
@Override
public void updateDeptRegNumber(Long deptId, Integer regNumber) {
Dept dept=new Dept();
dept.setDeptId(deptId);
dept.setRegNumber(regNumber);
this.deptMapper.updateById(dept);
}
xxxxxxxxxx
package com.bjsxt.controller.doctor;
import ...
/**
*
*/
@RestController
@RequestMapping("doctor/registration")
public class RegistrationController {
@Reference
private SchedulingService schedulingService;
@Autowired
private DeptService deptService;
@Reference
private PatientService patientService;
@Reference
private RegistrationService registrationService;
/**
* 查询出所有的排班的部门列表
* 1.从排班表里面查询有排班的部门编号集合
* 2.根据查询出来的部门编号集合再去查询部门
*/
@GetMapping("listDeptForScheduling")
public AjaxResult listDeptForScheduling(@Validated RegistrationQueryDto registrationQueryDto){
Long deptId = registrationQueryDto.getDeptId();
String subsectionType = registrationQueryDto.getSubsectionType();
String schedulingType = registrationQueryDto.getSchedulingType();//挂号类型
String schedulingDay = registrationQueryDto.getSchedulingDay().substring(0,10);//时间
List<Long> deptIds=schedulingService.
queryHasSchedulingDeptIds(deptId,schedulingDay, schedulingType,subsectionType);
if(null==deptIds||deptIds.size()==0){
return AjaxResult.success(Collections.EMPTY_LIST);
}else{
List<Dept> list=this.deptService.listDeptByDeptIds(deptIds);
return AjaxResult.success(list);
}
}
/**
* 挂号
*/
@PostMapping("addRegistration")
public AjaxResult addRegistration(@RequestBody @Validated RegistrationFormDto registrationFormDto){
PatientDto patientDto = registrationFormDto.getPatientDto();
RegistrationDto registrationDto = registrationFormDto.getRegistrationDto();
Patient patient=null;
if(StringUtils.isBlank(patientDto.getPatientId())){//说明要新添加患者
patientDto.setPatientId(IdGeneratorSnowflake.generatorIdWithProfix(Constants.ID_PROFIX_HZ));
patientDto.setSimpleUser(ShiroSecurityUtils.getCurrentSimpleUser());
patient=patientService.addPatient(patientDto);
}else{
//如果有患者编号,就把患者信息查询出来
patient=this.patientService.getPatientById(patientDto.getPatientId());
}
if(null==patient){
return AjaxResult.fail("当前患者ID不存在,请确认后再提交");
}
//查询部门信息
Dept dept=this.deptService.getOne(registrationDto.getDeptId());
//保存患者信息
registrationDto.setSimpleUser(ShiroSecurityUtils.getCurrentSimpleUser());
registrationDto.setRegId(IdGeneratorSnowflake.generatorIdWithProfix(Constants.ID_PROFIX_GH));
registrationDto.setPatientId(patient.getPatientId());
registrationDto.setPatientName(patient.getName());
registrationDto.setRegNumber(dept.getRegNumber()+1);//编号+1
this.registrationService.addRegistration(registrationDto);
//更新当天的科室号段
this.deptService.updateDeptRegNumber(dept.getDeptId(),dept.getRegNumber()+1);
//返回挂号编号给前端
return AjaxResult.success("",registrationDto.getRegId());
}
}
挂号/doctor/registration/addRegistration