|
@ -15,6 +15,7 @@ import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
|
|
|
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
|
|
|
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
|
|
|
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
|
|
|
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
|
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
@ -26,6 +27,7 @@ import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
|
|
|
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
|
|
|
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
|
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
|
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
|
|
|
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
|
|
@ -40,6 +42,7 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
|
|
|
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
|
|
|
import com.yihu.jw.restmodel.hospital.prescription.*;
|
|
|
import com.yihu.jw.restmodel.iot.common.UploadVO;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
@ -130,6 +133,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
private BaseDoctorHospitalDao baseDoctorHospitalDao;
|
|
|
@Autowired
|
|
|
private PrescriptionExpressageService sfexpressService;
|
|
|
@Autowired
|
|
|
private WlyyDoctorOnlineTimeDao wlyyDoctorOnlineTimeDao;
|
|
|
|
|
|
|
|
|
|
|
@ -148,6 +153,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{
|
|
|
logger.info("findOutpatientList patient:"+patient);
|
|
|
String patNo =patientMappingService.findHisPatNoByPatient(patient);
|
|
|
if(StringUtils.isBlank(patNo)){
|
|
|
return null;
|
|
|
}
|
|
|
logger.info("findOutpatientList patNo "+patNo);
|
|
|
return entranceService.BS30025(patNo,null,startTime,endTime,demoFlag);
|
|
|
}
|
|
@ -161,6 +169,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
public WlyyOutpatientVO findOutpatientInfo(String patient,String conNo)throws Exception{
|
|
|
logger.info("findOutpatientList patient:"+patient);
|
|
|
String patNo =patientMappingService.findHisPatNoByPatient(patient);
|
|
|
if(StringUtils.isBlank(patNo)){
|
|
|
return null;
|
|
|
}
|
|
|
logger.info("findOutpatientList patNo:"+patNo);
|
|
|
List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,conNo,null,null,demoFlag);
|
|
|
|
|
@ -179,7 +190,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
*/
|
|
|
public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String admNo,boolean demoFlag)throws Exception{
|
|
|
String patNo =patientMappingService.findHisPatNoByPatient(patient);
|
|
|
if(StringUtils.isBlank(patNo)){
|
|
|
return null;
|
|
|
}
|
|
|
//BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
|
|
|
logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" admNo:"+admNo);
|
|
|
return entranceService.BS16017(registerSn,null,patNo,admNo,demoFlag);
|
|
|
}
|
|
|
|
|
@ -528,6 +543,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
outpatientDO.setStatus("0");
|
|
|
outpatientDO.setCreateTime(new Date());
|
|
|
outpatientDO.setIdcard(patientDO.getIdcard());
|
|
|
outpatientDO.setOutpatientType("1");
|
|
|
outpatientDO.setCreateTime(new Date());
|
|
|
|
|
|
WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
|
|
@ -559,6 +575,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return outpatient;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 创建候诊室
|
|
|
* @param outpatientDO
|
|
@ -573,11 +590,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
waitingRoom.setHospital(outpatientDO.getHospital());
|
|
|
waitingRoom.setHospitalName(outpatientDO.getHospitalName());
|
|
|
|
|
|
//是否是有协同门诊医生
|
|
|
if(StringUtils.isNotBlank(outpatientDO.getDoctor())){
|
|
|
waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor());
|
|
|
waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
|
|
|
}
|
|
|
|
|
|
waitingRoom.setPatientId(outpatientDO.getPatient());
|
|
|
waitingRoom.setPatientName(outpatientDO.getPatientName());
|
|
|
waitingRoom.setReservationTime(outpatientDO.getRegisterDate());
|
|
|
waitingRoom.setVisitStatus(0);
|
|
|
waitingRoom.setReservationType(1);
|
|
|
//设置复诊类型
|
|
|
waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType())?Integer.parseInt(outpatientDO.getOutpatientType()):1);
|
|
|
|
|
|
waitingRoom.setSort(0);
|
|
|
waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
|
|
|
if(StringUtils.isNotBlank(outpatientDO.getDoctor())){
|
|
@ -1889,6 +1914,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
|
|
|
"outpatient.disease_img AS disease_img," +
|
|
|
"outpatient.description AS description," +
|
|
|
"room.reservation_type AS reservation_type," +
|
|
|
"outpatient.origin_con_no AS origin_con_no " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
@ -2158,7 +2184,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String orgCode, String dept,
|
|
|
String diseaseKey, String doctorNameKey,
|
|
|
String jobTitleNameKey, String outpatientType,
|
|
|
String keyName, String workingTime, String consutlSort) {
|
|
|
String keyName, String workingTime, String consultStatus,String consutlSort,Integer page,Integer pagesize) {
|
|
|
|
|
|
if(page >=1){
|
|
|
page --;
|
|
|
}
|
|
|
|
|
|
if (pagesize <= 0) {
|
|
|
pagesize = 10;
|
|
|
}
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
" d.id, " +
|
|
@ -2209,7 +2243,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql+=" AND wk.date = '"+workingTime+"' ";
|
|
|
}
|
|
|
|
|
|
sql += " order by a.total "+ consutlSort;
|
|
|
|
|
|
if(StringUtils.isNotBlank(consultStatus)){
|
|
|
sql+=" AND d.consult_status = '"+consultStatus+"' ";
|
|
|
}
|
|
|
|
|
|
sql += " order by a.total "+ consutlSort +" limit "+page * pagesize +","+pagesize;
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
@ -2548,7 +2587,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"room.reservation_type AS reservation_type," +
|
|
|
"outpatient.disease_img AS disease_img," +
|
|
|
"outpatient.description AS description," +
|
|
|
"outpatient.origin_con_no AS origin_con_no " +
|
|
|
"outpatient.origin_con_no AS origin_con_no, " +
|
|
|
"room.reservation_type AS reservation_type " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"base_patient patient," +
|
|
@ -2753,4 +2793,83 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
return waitVideoCount;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存在线排班
|
|
|
* @param onlineWorkJson
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Envelop saveDoctorOnlineWork(String onlineWorkJson)throws Exception{
|
|
|
WlyyDoctorOnlineTimeDO timeDO = objectMapper.readValue(onlineWorkJson,WlyyDoctorOnlineTimeDO.class);
|
|
|
List<WlyyDoctorOnlineTimeDO> list = wlyyDoctorOnlineTimeDao.findWorkExistList(timeDO.getDoctor(),timeDO.getStartTime(),timeDO.getEndTime());
|
|
|
if(list!=null&&list.size()>0){
|
|
|
return Envelop.getError("排班已存在",-1);
|
|
|
}
|
|
|
timeDO.setCreateTime(new Date());
|
|
|
return Envelop.getSuccess("保存成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除在线排班
|
|
|
* @param id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Envelop delDoctorOnlineWork(String id)throws Exception{
|
|
|
wlyyDoctorOnlineTimeDao.delete(id);
|
|
|
return Envelop.getSuccess("删除成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医生在线排班
|
|
|
* @param doctor
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WlyyDoctorOnlineTimeDO> findDoctorOnlineWorkList(String doctor,String startDate,String endDate){
|
|
|
return wlyyDoctorOnlineTimeDao.findWorkList(doctor,DateUtil.stringToDate(startDate+" 00:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate+" 23:59:59","yyyy-MM-dd HH:mm:ss"));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发起图文和视频复诊
|
|
|
* @param outpatientJson
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public WlyyOutpatientDO cooperativeOutpatient(String outpatientJson,String registerJson)throws Exception{
|
|
|
|
|
|
//1.保存就诊实体
|
|
|
WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
|
|
|
BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
|
|
|
|
|
|
outpatientDO.setMjz("mz");
|
|
|
outpatientDO.setStatus("0");
|
|
|
outpatientDO.setCreateTime(new Date());
|
|
|
outpatientDO.setIdcard(patientDO.getIdcard());
|
|
|
outpatientDO.setOutpatientType("2");
|
|
|
outpatientDO.setCreateTime(new Date());
|
|
|
|
|
|
WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
|
|
|
|
|
|
WlyyPatientRegisterTimeDO registerTimeDO = null;
|
|
|
|
|
|
try {
|
|
|
//如果是视频预约咨询
|
|
|
if(StringUtils.isNotBlank(registerJson)){
|
|
|
registerTimeDO = objectMapper.readValue(registerJson,WlyyPatientRegisterTimeDO.class);
|
|
|
registerTimeDO.setOutpatientId(outpatient.getId());
|
|
|
registerTimeDO.setCreateTime(new Date());
|
|
|
patientRegisterTimeDao.save(registerTimeDO);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
throw new RuntimeException("号源已经被预约,请选择其他号源");
|
|
|
}
|
|
|
|
|
|
//3.创建候诊室
|
|
|
createRoom(outpatient);
|
|
|
|
|
|
return outpatient;
|
|
|
}
|
|
|
}
|