Commit 28b7c1a7 authored by dmy's avatar dmy

医生部分代码提交

parent b15c01d1
package com.tcm.doctor.dao;
import com.yanzuoguang.dao.BaseDao;
public interface DoctorDao extends BaseDao {
}
package com.tcm.doctor.dao;
import com.yanzuoguang.dao.BaseDao;
public interface DoctorScheduleDao extends BaseDao {
}
package com.tcm.doctor.dao.impl;
import com.tcm.doctor.dao.DoctorDao;
import com.tcm.util.doctor.DoctorVo;
import com.yanzuoguang.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Component;
@Component
public class DoctorDaoImpl extends BaseDaoImpl implements DoctorDao {
@Override
protected void init() {
register(DoctorVo.class);
}
}
package com.tcm.doctor.dao.impl;
import com.tcm.doctor.dao.DoctorScheduleDao;
import com.tcm.util.doctor.DoctorScheduleVo;
import com.yanzuoguang.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Component;
@Component
public class DoctorScheduleDaoImpl extends BaseDaoImpl implements DoctorScheduleDao {
@Override
protected void init() {
register(DoctorScheduleVo.class);
}
}
package com.tcm.doctor.service;
import com.tcm.util.doctor.req.DoctorLoadPageReqVo;
import com.tcm.util.doctor.req.DoctorScheduleReqVo;
import com.tcm.util.doctor.res.DoctorScheduleResVo;
import com.yanzuoguang.util.vo.PageSizeData;
import java.util.List;
public interface DoctorScheduleService {
/**
* 医生排班新增
*/
String save(DoctorScheduleReqVo req);
/**
* 医生排班加载
*/
List<DoctorScheduleResVo> load(DoctorScheduleReqVo req);
/**
* 医生排班分页
*/
PageSizeData<DoctorScheduleResVo> loadPage(DoctorLoadPageReqVo req);
/**
* 医生排班删除
*/
String remove(DoctorScheduleReqVo req);
}
package com.tcm.doctor.service;
import com.tcm.util.doctor.req.DoctorLoadPageReqVo;
import com.tcm.util.doctor.req.DoctorReqVo;
import com.tcm.util.doctor.res.DoctorResVo;
import com.yanzuoguang.util.vo.PageSizeData;
public interface DoctorService {
/**
* 医生新增
*/
String save(DoctorReqVo req);
/**
* 医生加载
*/
DoctorResVo load(DoctorReqVo req);
/**
* 医生分页查询
*/
PageSizeData<DoctorResVo> loadPage(DoctorLoadPageReqVo req);
/**
* 医生状态改变
*/
String changeStatus(DoctorReqVo req);
/**
* 医生删除
*/
String remove(DoctorReqVo req);
}
package com.tcm.doctor.service.impl;
import com.tcm.doctor.dao.DoctorScheduleDao;
import com.tcm.doctor.service.DoctorScheduleService;
import com.tcm.util.doctor.DoctorScheduleVo;
import com.tcm.util.doctor.req.DoctorLoadPageReqVo;
import com.tcm.util.doctor.req.DoctorScheduleReqVo;
import com.tcm.util.doctor.res.DoctorScheduleResVo;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.PageSizeData;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class DoctorScheduleServiceImpl implements DoctorScheduleService {
private final DoctorScheduleDao doctorScheduleDao;
public DoctorScheduleServiceImpl(DoctorScheduleDao doctorScheduleDao) {
this.doctorScheduleDao = doctorScheduleDao;
}
@Override
public String save(DoctorScheduleReqVo req) {
List<DoctorScheduleVo> saveList = new ArrayList<>();
for (DoctorScheduleVo doctorScheduleVo : req.getScheduleVoList()) {
DoctorScheduleVo scheduleVo = new DoctorScheduleVo();
scheduleVo.setScheduleId(StringHelper.getNewID());
ObjectHelper.writeWithFrom(scheduleVo, doctorScheduleVo);
saveList.add(scheduleVo);
}
doctorScheduleDao.createList(saveList);
return req.getDoctorId();
}
@Override
public List<DoctorScheduleResVo> load(DoctorScheduleReqVo req) {
DoctorScheduleVo scheduleVo = new DoctorScheduleVo();
scheduleVo.setDoctorId(req.getDoctorId());
List<DoctorScheduleResVo> loadList = doctorScheduleDao.loadList(scheduleVo, DoctorScheduleResVo.class);
return loadList;
}
@Override
public PageSizeData<DoctorScheduleResVo> loadPage(DoctorLoadPageReqVo req) {
PageSizeData<DoctorScheduleResVo> page = doctorScheduleDao.loadPage(req, DoctorScheduleResVo.class);
return page;
}
@Override
public String remove(DoctorScheduleReqVo req) {
DoctorScheduleVo scheduleVo = new DoctorScheduleVo();
scheduleVo.setScheduleId(req.getScheduleId());
DoctorScheduleVo load = doctorScheduleDao.load(scheduleVo, DoctorScheduleVo.class);
doctorScheduleDao.remove(load);
return req.getScheduleId();
}
}
package com.tcm.doctor.service.impl;
import com.tcm.doctor.dao.DoctorDao;
import com.tcm.doctor.dao.DoctorScheduleDao;
import com.tcm.doctor.service.DoctorService;
import com.tcm.util.doctor.DoctorScheduleVo;
import com.tcm.util.doctor.DoctorVo;
import com.tcm.util.doctor.req.DoctorLoadPageReqVo;
import com.tcm.util.doctor.req.DoctorReqVo;
import com.tcm.util.doctor.res.DoctorResVo;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.PageSizeData;
import org.springframework.stereotype.Service;
@Service
public class DoctorServiceImpl implements DoctorService {
private final DoctorDao doctorDao;
private final DoctorScheduleDao doctorScheduleDao;
public DoctorServiceImpl(DoctorDao doctorDao, DoctorScheduleDao doctorScheduleDao) {
this.doctorDao = doctorDao;
this.doctorScheduleDao = doctorScheduleDao;
}
@Override
public String save(DoctorReqVo req) {
if (StringHelper.isEmpty(req.getDoctorId())) {
String doctorId = StringHelper.getNewID();
DoctorVo doctor = new DoctorVo();
doctor.setDoctorId(doctorId);
ObjectHelper.writeWithFrom(doctor, req);
doctor.setCreateTime(DateHelper.getNow());
doctorDao.create(doctor);
return doctorId;
} else {
DoctorVo doctor = new DoctorVo();
doctor.setDoctorId(req.getDoctorId());
DoctorVo load = doctorDao.load(doctor, DoctorVo.class);
ObjectHelper.writeWithFrom(load, req);
load.setUpdateTime(DateHelper.getNow());
doctorDao.update(load);
return req.getDoctorId();
}
}
@Override
public DoctorResVo load(DoctorReqVo req) {
DoctorVo doctor = new DoctorVo();
doctor.setDoctorId(req.getDoctorId());
DoctorResVo load = doctorDao.load(doctor, DoctorResVo.class);
return load;
}
@Override
public PageSizeData<DoctorResVo> loadPage(DoctorLoadPageReqVo req) {
PageSizeData<DoctorResVo> page = doctorDao.loadPage(req, DoctorResVo.class);
return page;
}
@Override
public String changeStatus(DoctorReqVo req) {
DoctorVo doctor = new DoctorVo();
doctor.setDoctorId(req.getDoctorId());
DoctorVo load = doctorDao.load(doctor, DoctorVo.class);
load.setStatus(req.getStatus());
doctorDao.update(load);
return req.getDoctorId();
}
@Override
public String remove(DoctorReqVo req) {
DoctorVo doctor = new DoctorVo();
doctor.setDoctorId(req.getDoctorId());
doctorDao.remove(doctor);
DoctorScheduleVo doctorSchedule = new DoctorScheduleVo();
doctorSchedule.setDoctorId(req.getDoctorId());
doctorScheduleDao.remove(doctorSchedule);
return req.getDoctorId();
}
}
package com.tcm.doctor.web;
import com.tcm.doctor.service.DoctorService;
import com.tcm.util.doctor.req.DoctorLoadPageReqVo;
import com.tcm.util.doctor.req.DoctorReqVo;
import com.tcm.util.doctor.res.DoctorResVo;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/doctor")
public class DoctorController {
private final DoctorService doctorService;
public DoctorController(DoctorService doctorService) {
this.doctorService = doctorService;
}
/**
* 医生新增
*/
@RequestMapping("/save")
public ResponseResult<String> save(@RequestBody DoctorReqVo req) {
return ResponseResult.result(doctorService.save(req));
}
/**
* 医生加载
*/
@RequestMapping("/load")
public ResponseResult<DoctorResVo> load(@RequestBody DoctorReqVo req) {
return ResponseResult.result(doctorService.load(req));
}
/**
* 医生分页查询
*/
@RequestMapping("/loadPage")
public ResponseResult<PageSizeData<DoctorResVo>> loadPage(@RequestBody DoctorLoadPageReqVo req) {
return ResponseResult.result(doctorService.loadPage(req));
}
/**
* 医生上下架
*/
@RequestMapping("/changeStatus")
public ResponseResult<String> changeStatus(@RequestBody DoctorReqVo req) {
return ResponseResult.result(doctorService.changeStatus(req));
}
/**
* 医生删除
*/
@RequestMapping("/remove")
public ResponseResult<String> remove(@RequestBody DoctorReqVo req) {
return ResponseResult.result(doctorService.remove(req));
}
}
package com.tcm.doctor.web;
import com.tcm.doctor.service.DoctorScheduleService;
import com.tcm.util.doctor.req.DoctorLoadPageReqVo;
import com.tcm.util.doctor.req.DoctorReqVo;
import com.tcm.util.doctor.req.DoctorScheduleReqVo;
import com.tcm.util.doctor.res.DoctorResVo;
import com.tcm.util.doctor.res.DoctorScheduleResVo;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/doctorSchedule")
public class DoctorScheduleController {
private final DoctorScheduleService doctorScheduleService;
public DoctorScheduleController(DoctorScheduleService doctorScheduleService) {
this.doctorScheduleService = doctorScheduleService;
}
/**
* 医生排班新增
*/
@RequestMapping("/save")
public ResponseResult<String> save(@RequestBody DoctorScheduleReqVo req) {
return ResponseResult.result(doctorScheduleService.save(req));
}
/**
* 医生排班加载
*/
@RequestMapping("/load")
public ResponseResult<List<DoctorScheduleResVo>> load(@RequestBody DoctorScheduleReqVo req) {
return ResponseResult.result(doctorScheduleService.load(req));
}
/**
* 医生排班分页查询
*/
@RequestMapping("/loadPage")
public ResponseResult<PageSizeData<DoctorScheduleResVo>> loadPage(@RequestBody DoctorLoadPageReqVo req) {
return ResponseResult.result(doctorScheduleService.loadPage(req));
}
/**
* 医生排班删除
*/
@RequestMapping("/remove")
public ResponseResult<String> remove(@RequestBody DoctorScheduleReqVo req) {
return ResponseResult.result(doctorScheduleService.remove(req));
}
}
...@@ -34,7 +34,6 @@ public class ProductDaoImpl extends BaseDaoImpl implements ProductDao { ...@@ -34,7 +34,6 @@ public class ProductDaoImpl extends BaseDaoImpl implements ProductDao {
.add("position", " AND pe.position =?") .add("position", " AND pe.position =?")
.add("categoryType", " AND p.category_type =?") .add("categoryType", " AND p.category_type =?")
.add("languageType", "and pe.language_type =?") .add("languageType", "and pe.language_type =?")
; ;
} }
......
package com.tcm.util.doctor.req;
import com.yanzuoguang.util.vo.PageSizeReqVo;
public class DoctorLoadPageReqVo extends PageSizeReqVo {
private String doctorName;
private String doctorId;
public String getDoctorName() {
return doctorName;
}
public void setDoctorName(String doctorName) {
this.doctorName = doctorName;
}
public String getDoctorId() {
return doctorId;
}
public void setDoctorId(String doctorId) {
this.doctorId = doctorId;
}
}
package com.tcm.util.doctor.req;
import com.tcm.util.doctor.DoctorVo;
public class DoctorReqVo extends DoctorVo {
}
package com.tcm.util.doctor.req;
import com.yanzuoguang.util.vo.PageSizeReqVo;
public class DoctorScheduleLoadPageVo extends PageSizeReqVo {
}
package com.tcm.util.doctor.req;
import com.tcm.util.doctor.DoctorScheduleVo;
import java.util.List;
public class DoctorScheduleReqVo {
/**
* 医生id
*/
private String doctorId;
private String scheduleId;
private List<DoctorScheduleVo> scheduleVoList;
public String getDoctorId() {
return doctorId;
}
public void setDoctorId(String doctorId) {
this.doctorId = doctorId;
}
public List<DoctorScheduleVo> getScheduleVoList() {
return scheduleVoList;
}
public void setScheduleVoList(List<DoctorScheduleVo> scheduleVoList) {
this.scheduleVoList = scheduleVoList;
}
public String getScheduleId() {
return scheduleId;
}
public void setScheduleId(String scheduleId) {
this.scheduleId = scheduleId;
}
}
package com.tcm.util.doctor.res;
import com.tcm.util.doctor.DoctorVo;
public class DoctorResVo extends DoctorVo {
}
package com.tcm.util.doctor.res;
import com.tcm.util.doctor.DoctorScheduleVo;
import java.util.List;
public class DoctorScheduleResVo extends DoctorScheduleVo{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment