JAVA全系列 教程
3762个小节阅读:7088.4k
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
参数名称 | 是否必须 |
---|---|
idCard | 是 |
返回JSON数据
名称 | 类型 | 其他信息 |
---|---|---|
msg | String | |
code | int | |
data | object | |
├─ patientId | String | |
├─ name | String | |
├─ phone | String | |
├─ sex | String | |
├─ birthday | String | |
├─ idCard | String | |
├─ address | String | |
├─ allergyInfo | String | |
├─ isFinal | String | |
├─ createTime | String | |
├─ updateTime | 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 ...
/**
*
*/
public class RegistrationServiceImpl implements RegistrationService{
private RegistrationMapper registrationMapper;
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);
}
public Registration queryRegistrationByRegId(String regId) {
return this.registrationMapper.selectById(regId);
}
public int updateRegistrationByRegId(Registration registration) {
return this.registrationMapper.updateById(registration);
}
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
*/
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
public List<Dept> listDeptByDeptIds(List<Long> deptIds) {
QueryWrapper<Dept> qw=new QueryWrapper<>();
qw.in(Dept.COL_DEPT_ID,deptIds);
return this.deptMapper.selectList(qw);
}
public void updateDeptRegNumber(Long deptId, Integer regNumber) {
Dept dept=new Dept();
dept.setDeptId(deptId);
dept.setRegNumber(regNumber);
this.deptMapper.updateById(dept);
}
修改PatientService,增加两个方法
xxxxxxxxxx
/**
* 根据身份证号查询患者信息
* @param idCard
* @return
*/
Patient getPatientByIdCard(String idCard);
/**
* 添加患者
* @param patientDto
* @return
*/
Patient addPatient(PatientDto patientDto);
修改PatientServiceImpl
xxxxxxxxxx
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 ...
/**
*
*/
"doctor/registration") (
public class RegistrationController {
private SchedulingService schedulingService;
private DeptService deptService;
private PatientService patientService;
private RegistrationService registrationService;
/**
* 查询出所有的排班的部门列表
* 1.从排班表里面查询有排班的部门编号集合
* 2.根据查询出来的部门编号集合再去查询部门
*/
"listDeptForScheduling") (
public AjaxResult listDeptForScheduling( 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);
}
}
/**
* 根据身份证号查询患者信息
*/
"getPatientByIdCard/{idCard}") (
public AjaxResult getPatientByIdCard( String idCard){
Patient patient=this.patientService.getPatientByIdCard(idCard);
if(null==patient){
return AjaxResult.fail("【"+idCard+"】对应的患者不存在,请在下面新建患者信息");
}else{
return AjaxResult.success(patient);
}
}
/**
* 挂号
*/
"addRegistration") (
public AjaxResult addRegistration( 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());
}
/**
* 收费
*/
"collectFee/{regId}") (
public AjaxResult collectFee( String regId){
//查询挂号单
Registration registration=this.registrationService.queryRegistrationByRegId(regId);
if(null==registration){
return AjaxResult.fail("当前挂号单【"+regId+"】对应的挂号单不存在,请核对后再查询");
}
//如果挂号单的状态不是未收费
if(!registration.getRegStatus().equals(Constants.REG_STATUS_0)){
return AjaxResult.fail("当前挂号单【"+regId+"】的状态不是未收费状态,不能进行收费");
}
//收费,更新挂号单的状态
registration.setRegStatus(Constants.REG_STATUS_1);
return AjaxResult.toAjax(this.registrationService.updateRegistrationByRegId(registration));
}
/**
* 分页查询挂号信息
*/
"queryRegistrationForPage") (
public AjaxResult queryRegistrationForPage(RegistrationDto registrationDto){
DataGridView gridView=this.registrationService.queryRegistrationForPage(registrationDto);
return AjaxResult.success("查询成功",gridView.getData(),gridView.getTotal());
}
/**
* 作废
*/
"doInvalid/{regId}") (
public AjaxResult doInvalid( String regId){
Registration registration=this.registrationService.queryRegistrationByRegId(regId);
if(null==registration){
return AjaxResult.fail("当前挂号单【"+regId+"】对应的挂号单不存在,请核对后再查询");
}
//如果挂号单的状态不是未收费
if(!registration.getRegStatus().equals(Constants.REG_STATUS_0)){
return AjaxResult.fail("当前挂号单【"+regId+"】的状态不是未收费状态,不能作废");
}
//收费,更新挂号单的状态
registration.setRegStatus(Constants.REG_STATUS_5);
return AjaxResult.toAjax(this.registrationService.updateRegistrationByRegId(registration));
}
/**
* 退号
*/
"doReturn/{regId}") (
public AjaxResult doReturn( String regId){
Registration registration=this.registrationService.queryRegistrationByRegId(regId);
if(null==registration){
return AjaxResult.fail("当前挂号单【"+regId+"】对应的挂号单不存在,请核对后再查询");
}
//如果挂号单的状态不是未收费
if(!registration.getRegStatus().equals(Constants.REG_STATUS_1)){
return AjaxResult.fail("当前挂号单【"+regId+"】的状态不是待就诊状态,不能退号");
}
//收费,更新挂号单的状态
registration.setRegStatus(Constants.REG_STATUS_4);
return AjaxResult.toAjax(this.registrationService.updateRegistrationByRegId(registration));
}
}
根据患者身份证号查患者信息/doctor/registration/getPatientByIdCard/{idCard}