Browse Source

Merge branch 'dev' of wangjun/wlyy2.0 into dev

wangzhinan 4 years ago
parent
commit
0ceccb4005
17 changed files with 349 additions and 166 deletions
  1. 4 8
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileManageService.java
  2. 2 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  3. 25 22
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 8 3
      business/base-service/src/main/java/com/yihu/jw/utils/AdminException.java
  5. 15 22
      business/base-service/src/main/java/com/yihu/jw/utils/sfutils/MyErrorCode.java
  6. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  7. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  8. 5 19
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java
  9. 17 0
      svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionHandler.java
  10. 23 0
      svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionResult.java
  11. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DoctorTimeOutTipsJob.java
  12. 127 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/AutoTimeOutRemind.java
  13. 0 73
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/DoctorTimeOutRemind.java
  14. 9 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  15. 3 2
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  16. 68 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/file_upload/FileUploadEndpoint.java
  17. 30 13
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 4 - 8
business/base-service/src/main/java/com/yihu/jw/file_upload/FileManageService.java

@ -23,7 +23,7 @@ import java.util.UUID;
@Service
public class FileManageService {
    private static final Logger logger = LoggerFactory.getLogger(FileManageService.class);
    private String basePath = "/root/tempFile" ;
    private String basePath = "/usr/local" ;
    private String fileUrl ="" ;
@ -78,18 +78,14 @@ public class FileManageService {
        fileChannel.close();
        raf.close();
        //第八步
        while (!copflag){
            boolean isComplete = checkUploadStatus(param,fileName,filePath);
            if(isComplete){
                renameFile(tempFile,fileName);
            }
        }
        boolean isComplete = checkUploadStatus(param,fileName,filePath);
        if(isComplete){
            renameFile(tempFile,fileName);
            return filePath+"/"+fileName;
        }else {
            return "unCompelete";
        }
        return "";
    }
    /**

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java

@ -41,8 +41,8 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("select count(id) from  WlyyOutpatientDO a where a.outpatientType = ?1 and a.doctor = ?2 and a.admDate >=?3 and a.admDate <=?4")
    Integer countByTime(String type,String doctor,Date startTime,Date endTime);
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus = 1")
    List<WlyyOutpatientDO> findWaitingOutpatient();
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus = 1 and a.remindCount<?1 ")
    List<WlyyOutpatientDO> findWaitingOutpatient(Integer remindCount);
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")
    List<WlyyOutpatientDO> findOutpatientByPatientAndStatus(String patient);*/

+ 25 - 22
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -798,7 +798,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    @Transactional
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
@ -819,7 +818,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        if (null!=previous.getId()&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){
            throw new AdminException(MyErrorCode.take_control);
            WlyyOutpatientDO wlyyOutpatientDO = new WlyyOutpatientDO();
            wlyyOutpatientDO.setRemindCount(previous.getOneselfPickupFlg());
            return wlyyOutpatientDO;
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
@ -2057,7 +2058,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param diagnosisJson
     * @return
     */
    public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson, String emrJson) throws Exception {
    public Map<String, Object> makeDiagnosis(String outPatientId,String prescriptionId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson, String emrJson) throws Exception {
        Map<String, Object> result = new HashedMap();
@ -2068,26 +2069,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //========================处方操作=============================================================
        //创建处方记录
        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outPatientId);
        WlyyPrescriptionDO prescriptionDO = null;
        if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
            prescriptionDO = prescriptionDOs.get(0);
        } else {
            prescriptionDO = new WlyyPrescriptionDO();
        WlyyPrescriptionDO  prescriptionDO= new WlyyPrescriptionDO();
        /*List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outPatientId);*/
        List<WlyyPrescriptionDO> wlyyPrescriptionDO1 = new ArrayList<>();
        if(StringUtils.isNotBlank(prescriptionId)){
            wlyyPrescriptionDO1 = prescriptionDao.findById(prescriptionId);
            prescriptionDO =wlyyPrescriptionDO1.get(0);
        }else{
            prescriptionDO.setOutpatientId(outPatientId);
            prescriptionDO.setType(1);
            prescriptionDO.setDept(outpatientDO.getDept());
            prescriptionDO.setCreateTime(new Date());
            prescriptionDO.setStatus(10);
            prescriptionDO.setPatientCode(outpatientDO.getPatient());
            prescriptionDO.setPatientName(outpatientDO.getPatientName());
            prescriptionDO.setDoctor(outpatientDO.getDoctor());
            prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
            prescriptionDO.setPayStatus(0);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
            }
        }
        prescriptionDO.setType(1);
        prescriptionDO.setDept(outpatientDO.getDept());
        prescriptionDO.setCreateTime(new Date());
        prescriptionDO.setStatus(10);
        prescriptionDO.setPatientCode(outpatientDO.getPatient());
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        prescriptionDO.setPayStatus(0);
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
        //========================处方操作结束=============================================================
@ -2142,7 +2145,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            savePrescriptionCheck(prescription.getDoctor(), "开具处方", 5, prescription.getId());
        }
        if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
        if (wlyyPrescriptionDO1 != null && wlyyPrescriptionDO1.size() > 0) {
            savePrescriptionCheck(prescription.getDoctor(), "处方修改", 3, prescription.getId());
        }

+ 8 - 3
business/base-service/src/main/java/com/yihu/jw/utils/AdminException.java

@ -1,10 +1,15 @@
package com.yihu.jw.utils;
import com.yihu.jw.utils.sfutils.MyErrorCode;
public class AdminException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private MyErrorCode exceptionEnum;
    public AdminException(MyErrorCode exceptionEnum) {
        this.exceptionEnum = exceptionEnum;
    }
    public AdminException(Object Obj) {
        super(Obj.toString());
    public MyErrorCode getMyErrorCode() {
        return exceptionEnum;
    }
}

+ 15 - 22
business/base-service/src/main/java/com/yihu/jw/utils/sfutils/MyErrorCode.java

@ -1,33 +1,26 @@
package com.yihu.jw.utils.sfutils;
public enum MyErrorCode {
    take_control("wj0001","您今日发起过复诊,不允许更改取药方式");
    private String value;
    private String desc;
    EXCEPTION_ONE(725,"请选择与上次相同的快递方式"),
    EXCEPTION_TWO(400,"异常二提示信息"),
    EXCEPTION_THREE(400,"异常三提示信息")
    ;
    private MyErrorCode(String value, String desc) {
        this.setValue(value);
        this.setDesc(desc);
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    //状态码
    private Integer code;
    //异常提示信息
    private String msg;
    public String getDesc() {
        return desc;
    MyErrorCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    public Integer getCode() {
        return code;
    }
    @Override
    public String toString() {
        return "[" + this.value + "]" + this.desc;
    public String getMsg() {
        return msg;
    }
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -234,7 +234,18 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    private String  operator;
    private String source;//来源
    /*
    *提醒次数
     */
    private Integer remindCount;
    @Column(name = "remind_count")
    public Integer getRemindCount() {
        return remindCount;
    }
    public void setRemindCount(Integer remindCount) {
        this.remindCount = remindCount;
    }
    @Column(name = "operator")
    public String getOperator() {
        return operator;

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -239,6 +239,7 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/open/fileUpload";
        public static final String UPLOAD_STREAM_IMG  = "/upload_stream_img";
        public static final String UPLOAD_STREAM  = "/upload_stream";
        public static final String UPLOAD_STREAM_video  = "/upload_stream_video";
        public static final String UPLOAD_STRING  = "/upload_string";
        public static final String UPLOAD_STREAM_ATTACHMENT  = "/upload_stream_attachment";
    }

+ 5 - 19
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -143,25 +143,11 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStream(/*@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file*/
            @ApiParam(value = "jsonData", required = true)
            @RequestBody MutilFileInfo param, HttpServletResponse response, HttpServletRequest request) throws Exception{
    public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file
            /*@ApiParam(value = "jsonData", required = true)
            @RequestBody MutilFileInfo param, HttpServletResponse response, HttpServletRequest request*/) throws Exception{
        UploadVO uploadVO = new UploadVO();
        String taskId ="";
        logger.info("上传文件 start...");
        try {
            taskId=filemanage.chunkUploadByMappedByteBuffer(param);
        } catch (IOException e) {
            logger.error("文件上传失败。{}", param.toString());
        }
        if("".equalsIgnoreCase(taskId)){
            return success(param.getChunk()+"上传成功",uploadVO);
        }else {
            File pdfFile = new File(taskId);
            FileInputStream fileInputStream = new FileInputStream(pdfFile);
            MultipartFile file = new MockMultipartFile(pdfFile.getName(), pdfFile.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(file);
                uploadVO.setFullUri(map.get("accessory").toString());
@ -182,6 +168,6 @@ public class FileUploadController extends EnvelopRestEndpoint {
            return success("上传成功", uploadVO);
        }
    }
}

+ 17 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionHandler.java

@ -0,0 +1,17 @@
package com.yihu.jw.base.util;
import com.yihu.jw.utils.AdminException;
import com.yihu.jw.utils.sfutils.MyErrorCode;
import org.csource.common.MyException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
//该类全局拦截Controller请求
@ControllerAdvice
public class ExceptionHandler {
    //对自定义RuntimeException进行拦截和相关响应的修改
    @org.springframework.web.bind.annotation.ExceptionHandler(AdminException.class)
    public ResponseEntity<ExceptionResult> handlerException(AdminException e) {
        MyErrorCode ee = e.getMyErrorCode();
        return ResponseEntity.status(ee.getCode()).body(new ExceptionResult(ee));
    }}

+ 23 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionResult.java

@ -0,0 +1,23 @@
package com.yihu.jw.base.util;
import com.yihu.jw.utils.sfutils.MyErrorCode;
public class ExceptionResult {
    private Integer code;
    private String msg;
    private Long timestamp;
    public Integer getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public ExceptionResult(MyErrorCode ee) {
        this.code = ee.getCode();
        this.msg = ee.getMsg();
        this.timestamp = System.currentTimeMillis();
    }
}

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DoctorTimeOutTipsJob.java

@ -37,7 +37,7 @@ public class DoctorTimeOutTipsJob implements Job {
        logger.info("启动发送超时提示消息开始");
        System.out.println(wxId);
        System.out.println("启动发送超时提示消息开始");
        List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient();
        List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient(5);
        String senderId ="";
        String reciverId = "";
        long timeCount = 0l;

+ 127 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/AutoTimeOutRemind.java

@ -0,0 +1,127 @@
package com.yihu.jw.util;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.asn1.cmp.CertOrEncCert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Lazy(false)
@Component
@EnableScheduling
public class AutoTimeOutRemind implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(AutoTimeOutRemind.class);
    private static String cron;
    private static String dictName = "remind_patient_job";
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    public ImUtil imUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Value("${wechat.ids}")
    private String wxId;
    public AutoTimeOutRemind() {
      cron = "0 /5 * * * ?";
        System.out.println("创建时的corn"+cron);
    }
    public String change(String corIn){
        if (StringUtils.isNotBlank(corIn)){
            cron = corIn;
        }else {
            List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDO =wlyyHospitalSysDictDao.findByDictName(dictName);
            if (wlyyHospitalSysDictDO.size()>0){
                cron = wlyyHospitalSysDictDO.get(0).getDictValue();
                System.out.println("dict"+ cron);
            }
        }
        System.out.println(cron);
        return "success";
    }
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.addTriggerTask(new Runnable() {
            @Override
            public void run() {
                logger.info("启动发送超时提示消息开始");
                System.out.println(wxId);
                System.out.println("启动发送超时提示消息开始");
                Integer remindCount = 3;
                List<WlyyHospitalSysDictDO> countList = wlyyHospitalSysDictDao.findByDictName("remind_count");
                if (countList.size()>0){
                    remindCount= null!=countList.get(0).getDictValue()?Integer.parseInt(countList.get(0).getDictValue()):remindCount;
                }
                List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient(remindCount);
                String senderId ="";
                String reciverId = "";
                long timeCount = 0l;
                String content = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
                JSONObject object = new JSONObject();
                object.put("socket_sms_type",14);
                object.put("msg",content);
                object.put("msg_time", DateUtil.dateToStrLong(new Date()));
                if (null!=wlyyOutpatientDOS){
                    for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOS){
                        long patientTime = wlyyOutpatientDO.getCreateTime().getTime();
                        Integer currentRemindCount = wlyyOutpatientDO.getRemindCount();
                        logger.info("接诊创建时间="+patientTime);
                        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictName("outpatient_timeout_remind");
                        if (wlyyHospitalSysDictDOS.size()>0){
                            timeCount = Long.valueOf(wlyyHospitalSysDictDOS.get(0).getDictValue());
                        }
                        long currentTime = new Date().getTime();
                        logger.info("当前时间="+currentTime);
                        logger.info("数据库配置时间=0"+timeCount);
                        if (currentTime-patientTime>timeCount*60*1000){
                            logger.info("--便利发送消息");
                            reciverId = wlyyOutpatientDO.getPatient();
                            logger.info("---发送人id"+senderId);
                            senderId= wlyyOutpatientDO.getDoctor();
                            logger.info("---接受人Id"+reciverId);
                            imUtil.sendMessage(senderId,reciverId,"1",object.toString());
                            logger.info("--发送结束");
                            logger.info("--模板发送开始");
                            prescriptionService.sendWxTemplateMsg(wxId,wlyyOutpatientDO.getId(),null,null,"outPatientTimeOutRemind","");
                            wlyyOutpatientDO.setRemindCount(currentRemindCount+1);
                            outpatientDao.save(wlyyOutpatientDO);
                        }
                    }
                }
            }
        }, new Trigger() {
            @Override
            public Date nextExecutionTime(TriggerContext triggerContext) {
                // 任务触发,可修改任务的执行周期
                CronTrigger trigger = new CronTrigger(cron);
                System.out.println("任务触发,可修改任务的执行周期"+cron);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                return nextExec;
            }
        });
    }
}

+ 0 - 73
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/DoctorTimeOutRemind.java

@ -1,73 +0,0 @@
package com.yihu.jw.util;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.job.DoctorTimeOutTipsJob;
import com.yihu.jw.util.date.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Component
public class DoctorTimeOutRemind {
    private static final Logger logger = LoggerFactory.getLogger(DoctorTimeOutRemind.class);
    @Autowired
    public ImUtil imUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.ids}")
    private String wxId;
    @Scheduled(cron = "${jobs.schedule}")
    public void remind(){
        logger.info("启动发送超时提示消息开始");
        System.out.println(wxId);
        System.out.println("启动发送超时提示消息开始");
        List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient();
        String senderId ="";
        String reciverId = "";
        long timeCount = 0l;
        String content = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
        JSONObject object = new JSONObject();
        object.put("socket_sms_type",14);
        object.put("msg",content);
        object.put("msg_time", DateUtil.dateToStrLong(new Date()));
        if (null!=wlyyOutpatientDOS){
            for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOS){
                long patientTime = wlyyOutpatientDO.getCreateTime().getTime();
                logger.info("接诊创建时间="+patientTime);
                List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictName("outpatient_timeout_remind");
                if (wlyyHospitalSysDictDOS.size()>0){
                    timeCount = Long.valueOf(wlyyHospitalSysDictDOS.get(0).getDictValue());
                }
                long currentTime = new Date().getTime();
                logger.info("当前时间="+currentTime);
                logger.info("数据库配置时间=0"+timeCount);
                if (currentTime-patientTime>timeCount*60*1000){
                    logger.info("--便利发送消息");
                    reciverId = wlyyOutpatientDO.getPatient();
                    logger.info("---发送人id"+senderId);
                    senderId= wlyyOutpatientDO.getDoctor();
                    logger.info("---接受人Id"+reciverId);
                    imUtil.sendMessage(senderId,reciverId,"1",object.toString());
                    logger.info("--发送结束");
                    logger.info("--模板发送开始");
                    prescriptionService.sendWxTemplateMsg(wxId,wlyyOutpatientDO.getId(),null,null,"outPatientTimeOutRemind","");
                }
            }
        }
    }
}

+ 9 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -15,6 +15,7 @@ import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
@ -196,7 +197,6 @@ public class JobController extends BaseController {
                    }
                    break;
                case "CSTXJOB" :
                    //互联网医院 待结算消息推送
                    if (!quartzHelper.isExistJob("CSTXJOB")) {
                        System.out.println("id"+taskId);
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("CSTXJOB");
@ -614,4 +614,12 @@ public class JobController extends BaseController {
    }
    @RequestMapping(value = "changeDoctorRemindTimeOut", method = RequestMethod.GET)
    public String changeDoctorRemindTimeOut(String corn){
        AutoTimeOutRemind autoTimeOutRemind = new AutoTimeOutRemind();
        return autoTimeOutRemind.change(corn);
    }
}

+ 3 - 2
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -130,7 +130,8 @@ express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
jobs:
  schedule: 0 */1 * * * ?
---
spring:
  profiles: jwOracleTest
@ -257,7 +258,7 @@ express:
  sf_code: WH000091
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
jobs:
  schedule: 0 */1 * * * ?
  schedule: 0 */30 * * * ?
---
spring:

+ 68 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/file_upload/FileUploadEndpoint.java

@ -3,7 +3,9 @@ package com.yihu.jw.hospital.endpoint.file_upload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -11,17 +13,21 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
@ -46,6 +52,8 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private FileManageService fileManageService;
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
@ -120,6 +128,66 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
        }
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_video)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStreamVideo(@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file,
                                                  @ApiParam(value = "文件", required = false)
                                                  @RequestParam(value = "filename", required = false) String filename,
                                                  @ApiParam(value = "taskId", required = false)
                                                      @RequestParam(value = "taskId", required = false) String taskId,
                                                  @ApiParam(value = "chunk", required = false)
                                                      @RequestParam(value = "chunk", required = false) Integer chunk,
                                                  @ApiParam(value = "文件", required = false)
                                                      @RequestParam(value = "sizesize", required = false) Long size,
                                                  @ApiParam(value = "chunkTotal", required = false)
                                                      @RequestParam(value = "chunkTotal", required = false) Integer chunkTotal,
                                                  @ApiParam(value = "objectType", required = false)
                                                      @RequestParam(value = "objectType", required = false) Integer objectType
                                             ) throws Exception{
        UploadVO uploadVO = new UploadVO();
        MutilFileInfo files = new MutilFileInfo();
        files.setChunk(chunk);
        files.setChunkTotal(chunkTotal);
        files.setFile(file);
        files.setObjectType(objectType);
        files.setSize(file.getSize());
        files.setTaskId(taskId);
        String taskid = fileManageService.chunkUploadByMappedByteBuffer(files);
        if ("unCompelete".equalsIgnoreCase(taskid)){
            System.out.println("第"+files.getChunk());
            return success("未传完",uploadVO);
        }else {
            File file1 = new File(taskid);
            FileInputStream input = new FileInputStream(file1);
            MultipartFile multipartFile = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(multipartFile);
                uploadVO.setFullUri(map.get("accessory").toString());
            }else if(isClose.equals("2")){
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,multipartFile,null);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = multipartFile.getOriginalFilename();
                //判断文件名称是否有包含后缀,及前端是否有传后缀名称,有的话拼接图片后缀
                if(originalFilename.lastIndexOf(".") == 0 && StringUtils.isNotEmpty(filename)){
                    originalFilename = originalFilename +"."+filename;
                }
                InputStream inputStream = multipartFile.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
                file1.delete();
            }
            return success("上传成功", uploadVO);
        }
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STRING)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")

+ 30 - 13
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -345,18 +345,33 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        
        //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
        //发送IM消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        
        //发送医生抢单消息
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        if (null==wlyyOutpatientDO.getId()){
            ObjEnvelop objEnvelop =new ObjEnvelop();
            String msg = "";
            if (1==wlyyOutpatientDO.getRemindCount()){
                msg = "自取";
            }else {
                msg = "快递配送";
            }
            objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
            objEnvelop.setStatus(300);
            return objEnvelop;
        }else {
            //发送系统消息
            SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
            //发送IM消息
            hospitalSystemMessageService.sendImMessage(systemMessageDO);
            //发送医生抢单消息
            if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
            }
            return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
        }
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
@ -413,8 +428,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                    @ApiParam(name = "inspectionJson", value = "检查检验")
                                    @RequestParam(value = "inspectionJson", required = false)String inspectionJson,
                                    @ApiParam(name = "emrJson", value = "电子病历")
                                        @RequestParam(value = "emrJson", required = false)String emrJson)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,advice,type,infoJsons,diagnosisJson,inspectionJson,emrJson);
                                        @RequestParam(value = "emrJson", required = false)String emrJson,
                                    @ApiParam(name = "prescriptionId", value = "处方id")
                                        @RequestParam(value = "prescriptionId", required = false)String prescriptionId)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,prescriptionId,advice,type,infoJsons,diagnosisJson,inspectionJson,emrJson);
        try {
            
            com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();