|
|
@@ -1,5 +1,6 @@
|
|
|
package cn.hnthyy.thmz.service.impl.thmz;
|
|
|
|
|
|
+import cn.hnthyy.thmz.Utils.DateUtil;
|
|
|
import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.entity.MzException;
|
|
|
import cn.hnthyy.thmz.entity.his.mz.Employee;
|
|
|
@@ -11,13 +12,16 @@ import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.enums.ClinicStatusEnum;
|
|
|
import cn.hnthyy.thmz.enums.MzfzStatusEnum;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
+import cn.hnthyy.thmz.mapper.his.mz.MzZdWorkTimeMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.mz.MzfzPatientOrderMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.mz.MzyReqrecMapper;
|
|
|
+import cn.hnthyy.thmz.mapper.his.mz.MzyRequestMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.ClinicMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.TurnToConsultationMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.UserDeptRelationMapper;
|
|
|
import cn.hnthyy.thmz.service.his.mz.EmployeeService;
|
|
|
import cn.hnthyy.thmz.service.his.mz.MzVisitTableService;
|
|
|
+import cn.hnthyy.thmz.service.his.mz.MzZdWorkTimeService;
|
|
|
import cn.hnthyy.thmz.service.thmz.ClinicService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -49,6 +53,11 @@ public class ClinicServiceImpl implements ClinicService {
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
private UserDeptRelationMapper userDeptRelationMapper;
|
|
|
+ @Autowired
|
|
|
+ private MzZdWorkTimeService mzZdWorkTimeService;
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
+ private MzyRequestMapper mzyRequestMapper;
|
|
|
@Override
|
|
|
public int saveClinic(Clinic clinic) {
|
|
|
//存在就不插入
|
|
|
@@ -145,9 +154,16 @@ public class ClinicServiceImpl implements ClinicService {
|
|
|
updateMzfzPatientOrder.setDoctorCode(tokenUser.getUserIdCode());
|
|
|
if(Constants.JY_EXEC_CODE.equals(mzfzPatientOrder.getDeptCode())){
|
|
|
//简易门诊将医生的科室设置到分诊记录
|
|
|
- List<String> deptNos=userDeptRelationMapper.selectAllByUserIdCode(tokenUser.getUserIdCode());
|
|
|
- if(deptNos!=null && deptNos.size()>0){
|
|
|
- updateMzfzPatientOrder.setDeptCode(deptNos.get(0));
|
|
|
+ String requestDay=DateUtil.paseToString(DateUtil.getFirstSecond(),"yyyy-MM-dd");
|
|
|
+ List<String> ampms = mzZdWorkTimeService.getNotUsedWorkTimes(requestDay);
|
|
|
+ List<String> requestDepts=mzyRequestMapper.selectUnitCodeByRequestDayAndDoctor(requestDay,tokenUser.getUserIdCode(),ampms);
|
|
|
+ if(requestDepts!=null && requestDepts.size()>0){
|
|
|
+ updateMzfzPatientOrder.setDeptCode(requestDepts.get(0));
|
|
|
+ }else {
|
|
|
+ List<String> deptNos=userDeptRelationMapper.selectAllByUserIdCode(tokenUser.getUserIdCode());
|
|
|
+ if(deptNos!=null && deptNos.size()>0){
|
|
|
+ updateMzfzPatientOrder.setDeptCode(deptNos.get(0));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return mzfzPatientOrderMapper.updateMzfzPatientOrder(updateMzfzPatientOrder);
|