Explorar o código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

LAPTOP-KB9HII50\70708 hai 1 mes
pai
achega
3aa1c79cc2

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java

@ -70,6 +70,10 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.createTime>?1 and  a.createTime <?2 and a.status <30 and a.status>=0")
    List<WlyyPrescriptionDO> findListByCheckStatus(Date startTime,Date endTime);
    @Query("select a from WlyyPrescriptionDO a where  a.status <30 and a.status>=20")
    List<WlyyPrescriptionDO> findListByCheckStatusNoDate();
    @Query("select a from WlyyPrescriptionDO a where a.createTime>?1 and  a.createTime <?2 and a.status >=30 ")
    List<WlyyPrescriptionDO> findListBySuccessStatus(Date startTime,Date endTime);

+ 15 - 9
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/HcyyPrescriptionService.java

@ -35,6 +35,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
@ -75,14 +76,6 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private OauthCaConfigDao oauthCaConfigDao;
    @Autowired
    private PrescriptionInfoDao infoDao;
    @Autowired
    private PrescriptionDiagnosisDao diagnosisDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
@ -110,6 +103,8 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    public PrescriptionService prescriptionService;
    @Autowired
    public PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private EnterpriseService enterpriseService;
@ -1812,7 +1807,6 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                                    medicalMxDO.setItemCode(dobject.getString("MED_LIST_CODG"));
                                    medicalMxDO.setPrescriptionCode(dobject.getString(""));
                                    medicalMxDO.setChargeUnit(dobject.getString("PRCUNT"));
                                    medicalMxDO.setSpecificationType(dobject.getString(""));
                                    medicalMxDO.setAmount(dobject.getString("CNT"));
                                    medicalMxDO.setPrice(dobject.getString("PRIC"));
                                    medicalMxDO.setPrescriptionCode(dobject.getString("RXNO"));
@ -2067,6 +2061,18 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                    }
                    try {
                        sfToHis(outpatientId, realOrder);
                        WlyyHospitalSysDictDO hospitalSysDictDO = wlyyHospitalSysDictDao.findById("sendDrugsMessage");
                        String content = "有患者下单了,请及时登录系统查看并发药。";
                        if (hospitalSysDictDO!=null){
                            String message = hospitalSysDictDO.getDictValue();
                            if (StringUtils.isNoneBlank(message)){
                                String str[] = message.split(",");
                                for (int i =0;i<str.length;i++){
                                    String mobile = str[i];
                                    enterpriseService.sendMKMesByMobile("xm_hcyy_wx",mobile,content);
                                }
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }

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

@ -14904,20 +14904,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        ylzMedicalRelationDO.setStatus(0);
                        ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                    }
                    /*String payDateStr = object1.getString("pay_date");
                    Date payDate = DateUtil.strToDate(payDateStr);
                    Date now = DateUtil.getDateShort(new Date());
                    if (payDate.compareTo(now) == 0) {
                        BigDecimal b7 = new BigDecimal(object1.getString("enterprise_supplement"));
                        Double price = b1.add(b2).add(b3).add(b4).add(b5).add(b6).add(b7).doubleValue();
                        if (Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice()) == price) {
                            ylzMedicalRelationDO.setStatus(1);
                            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        }
                    } else {
                    }
*/
                }else {
                    if (jsonObject.getString("flag").equalsIgnoreCase("50204")){
                        ylzMedicalRelationDO.setStatus(0);
@ -16735,4 +16722,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return flag;
    }
    public void delYlzRelationCode(String outpatientId){
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        ylzMedicailRelationDao.delete(ylzMedicalRelationDO);
    }
}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 72 - 6
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -44,7 +44,7 @@ public class YkyySMSService {
    private final String pw ="3PRCADHD2M";
    private final String urlSms ="https://smsapp.wlwx.com";
    private final String urlSms ="https://sms.wlwxpro.com";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;

+ 1 - 1
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java

@ -18,7 +18,7 @@ public class YkyyINSMSService {
    private final String pw ="3PRCADHD2M";
    private final String urlSms ="https://smsapp.wlwx.com";
    private final String urlSms ="https://sms.wlwxpro.com";
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;

+ 1 - 1
business/sms-service/src/main/java/com/yihu/jw/sms/util/ykyy/demo/SendSms.java

@ -15,7 +15,7 @@ public class SendSms {
	public static void main(String[] args) {
		String custCode = "300643";							 //[必填] 用户账号
		String password = "T9IHN69DDF";						 //[必填] 账号密码
		String serviceBaseUrl = "https://smsapp.wlwx.com"; 			 //[必填] http://ip:port
		String serviceBaseUrl = "https://sms.wlwxpro.com"; 			 //[必填] http://ip:port
		/**
		 * 1.通过SmsReq对象传参

+ 10 - 2
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -401,8 +401,16 @@ public class MqSdkController extends EnvelopRestEndpoint {
    @GetMapping(value = "/MS02014")
    @ApiOperation(value = "医生详细信息同步")
    public ObjEnvelop MS02014() throws Exception {
        return success(entranceService.MS02014(demoFlag));
    public ObjEnvelop MS02014(@ApiParam(name = "hisId", value = "医生id")
                                  @RequestParam(value = "hisId", required = true) String hisId) throws Exception {
        return success(entranceService.MS02014(demoFlag,hisId));
    }
    @GetMapping(value = "/MS02104")
    @ApiOperation(value = "根据医生id获取医生详细信息")
    public ObjEnvelop MS02104(@ApiParam(name = "hisId", value = "医生id")
                              @RequestParam(value = "hisId", required = true) String hisId) throws Exception {
        return success(entranceService.MS020141(demoFlag,hisId));
    }

+ 33 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/SendNoReplyMessageJob.java

@ -0,0 +1,33 @@
package com.yihu.jw.job;
import com.yihu.jw.service.channel.TimeoutOverDueService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Trick on 2019/10/15.
 */
public class SendNoReplyMessageJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(SendNoReplyMessageJob.class);
    @Autowired
    private TimeoutOverDueService timeoutOverDueService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========PrescriptionOverdueJob========");
        try {
            Trigger trigger =jobExecutionContext.getTrigger();
            System.out.println("执行时间为"+trigger.getNextFireTime());
            timeoutOverDueService.sendMessageNoReply();
            logger.info("END========PrescriptionOverdueJob========");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("END===ERROE===PrescriptionOverdueJob,message:"+e.getMessage());
        }
    }
}

+ 64 - 21
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionDeleteService.java

@ -1,10 +1,15 @@
package com.yihu.jw.service.channel;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -37,34 +42,72 @@ public class PrescriptionDeleteService {
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private BasePatientDao basePatientDao;
    //定时作废处方
    public void deletePrescription() throws Exception{
        Calendar ca = Calendar.getInstance();//得到一个Calendar的实例
        ca.setTime(new Date()); //设置时间为当前时间
        ca.add(Calendar.DATE, -1); //天数减1
        Date d = ca.getTime();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String s = sdf.format(d);
        logger.info("开始日期:"+s);
        List<WlyyPrescriptionDO> prescriptionDOS = prescriptionDao.findListByCheckStatus(DateUtil.strToDate(s+" 00:00:00"),DateUtil.strToDate(s+" 23:59:59"));
        int amount = 30;
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("deletePrescription");
        if (hospitalSysDictDO!=null){
            amount = Integer.parseInt(hospitalSysDictDO.getDictValue());
        }
        Date date = new Date();
        logger.info("开始日期:"+DateUtil.dateToStrLong(date));
        List<WlyyPrescriptionDO> prescriptionDOS = prescriptionDao.findListByCheckStatusNoDate();
        if (null!=prescriptionDOS&&prescriptionDOS.size()>0){
            for (WlyyPrescriptionDO prescriptionDO:prescriptionDOS){
                logger.info("处方删除时间满足条件");
                String hisId = prescriptionDO.getHisId();
                if("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
                    List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
                    if (null!=wlyyPrescriptionDiagnosisDOs&&wlyyPrescriptionDiagnosisDOs.size()>0){
                        xzzxEntranceService.deleteCheckInputInfo(hisId,"0",prescriptionDO.getDoctor(),prescriptionDO.getPatientCode(),wlyyPrescriptionDiagnosisDOs);
                        if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())){
                            xzzxEntranceService.deletePrescriptionToEntrance(prescriptionDO.getRealOrder());
                long num = date.getTime()-prescriptionDO.getCreateTime().getTime();
                long day = num/(1000*60*60*24);
                if (day>=amount){
                    logger.info("处方:"+prescriptionDO.getRealOrder()+"已作废时间:"+day);
                    logger.info("处方删除时间满足条件");
                    String hisId = prescriptionDO.getHisId();
                    if("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
                        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
                        if (null!=wlyyPrescriptionDiagnosisDOs&&wlyyPrescriptionDiagnosisDOs.size()>0){
                            xzzxEntranceService.deleteCheckInputInfo(hisId,"0",prescriptionDO.getDoctor(),prescriptionDO.getPatientCode(),wlyyPrescriptionDiagnosisDOs);
                            if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())){
                                xzzxEntranceService.deletePrescriptionToEntrance(prescriptionDO.getRealOrder());
                            }
                        }
                    }
                    prescriptionDO.setStatus(-4);
                    prescriptionDO.setCheckStatus(5);
                    prescriptionDO.setCheckReason("已作废");
                    logger.info("处方:"+prescriptionDO.getId()+"已作废");
                    BasePatientDO patientDO =basePatientDao.findById(prescriptionDO.getPatientCode());
                    String first = "处方超时未结算";
                    String contentMsg = "您的在线问诊处方已作废,因超过六天未支付。";
                    String remark="";
                    prescriptionDao.save(prescriptionDO);
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                        String prefix="https://hlwyy.xmzsh.com";
                        String msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+prescriptionDO.getOutpatientId()+"&id="+prescriptionDO.getId();
                        try {
                            entranceService.ehospitalNotice(
                                    patientDO.getName(),
                                    patientDO.getIdcard(),
                                    patientDO.getMobile(),
                                    first,
                                    prefix+msgUrl,
                                    contentMsg,
                                    remark
                            );
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }
                prescriptionDO.setStatus(-1);
                prescriptionDO.setCheckStatus(4);
                prescriptionDO.setCheckReason("已删除");
                logger.info("处方:"+prescriptionDO.getId()+"已删除");
                prescriptionDao.save(prescriptionDO);
            }
        }

+ 85 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java

@ -1,5 +1,7 @@
package com.yihu.jw.service.channel;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -30,6 +32,8 @@ import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.YkyySMSService;
import oracle.sql.DATE;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -42,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Component
@Transactional
@ -97,6 +102,10 @@ public class TimeoutOverDueService {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private BaseDoctorDao doctorDao;
    /**
     *  取消未结束门诊
     */
@ -285,5 +294,81 @@ public class TimeoutOverDueService {
        }
    }
    /**
     *
     */
    public void sendMessageNoReply(){
        List<WlyyHospitalSysDictDO> sysDictDOList = hospitalSysDictDao.findByDictName("noReplyTime");
        String sql = "SELECT\n" ;
        if ("xm_ykyy_wx".equals(wechatId)) {
            sql = sql + "to_char(s.last_message_time,'YYYY-MM-DD hh24:mi:ss')  AS \"lastMessageTime\",";
        } else {
            sql = sql + "date_format(s.last_message_time,'%Y-%m-%d %H:%i:%S' )  AS \"lastMessageTime\",";
        }
       sql = sql+ "\ts.last_sender_id as \"lastSenderId\",\n" +
                "\ts.last_sender_name as \"lastSenderName\",\n" +
               "\to.doctor as \"doctor\",\n" +
               "\to.consumer as \"patient\",\n" +
               "\to.id as \"id\"\n" +
        "FROM\n" +
        "\twlyy_outpatient o\n" +
        "LEFT JOIN wlyy_consult c ON o.id = c.relation_code\n" +
        "LEFT JOIN topics t ON t.id = c.id\n" +
        "LEFT JOIN sessions s ON s.id = t.session_id\n" +
        "where o.status>0 and o.status<3  ";
        logger.info("sql语句"+sql);
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        logger.info("mapList"+mapList);
        if(mapList!=null&&mapList.size()>0){
            Long currentTime = DateUtil.getNowDate().getTime();
            for (Map<String,Object> map:mapList){
                String lastMessageTime = map.get("lastMessageTime").toString();
                String lastSenderId = map.get("lastSenderId").toString();
                String patient = map.get("patient").toString();
                String doctor =map.get("doctor").toString();
                Long lastTime = DateUtil.strToDate(lastMessageTime).getTime();
                Long time = currentTime-lastTime;
                logger.info("time"+time);
                for (int i =0;i<sysDictDOList.size();i++){
                    boolean flag = false;
                    int j = i+1;
                    WlyyHospitalSysDictDO wlyyHospitalSysDictDO = sysDictDOList.get(i);
                    Long noReplyTime = Long.parseLong(wlyyHospitalSysDictDO.getDictValue());
                    if (j>=sysDictDOList.size()){
                        flag=false;
                    }else {
                        WlyyHospitalSysDictDO wlyyHospitalSysDictDO1 = sysDictDOList.get(j);
                        Long noReplyTime1 = Long.parseLong(wlyyHospitalSysDictDO1.getDictValue());
                        logger.info("noReplyTime1"+noReplyTime1+"==="+noReplyTime);
                        if (time>noReplyTime*60*1000&&time<=noReplyTime1*60*1000){
                            flag = true;
                        }
                    }
                    if (flag){
                        String mobile = "";
                        logger.info("lastSenderId"+lastSenderId+"===="+patient+"+++"+doctor);
                        if (lastSenderId.equalsIgnoreCase(patient)){
                            BaseDoctorDO doctorDO = doctorDao.findById(doctor);
                            mobile = doctorDO.getMobile();
                        }else if (lastSenderId.equalsIgnoreCase(doctor)){
                            BasePatientDO patientDO = basePatientDao.findById(patient);
                            mobile = patientDO.getMobile();
                        }
                        logger.info("mobile"+mobile+flag+noReplyTime);
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                            ykyySMSService.ykyySendSMS(mobile,"您有新的咨询消息,请及时回复。");
                        }
                    }
                }
            }
        }
    }
}

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

@ -95,6 +95,9 @@ public class JobController extends BaseController {
    @Autowired
    private TimeoutOverDueService timeoutOverDueService;
    @Autowired
    private PrescriptionDeleteService prescriptionDeleteService;
    @Autowired
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
        this.jobService = jobService;
@ -306,7 +309,7 @@ public class JobController extends BaseController {
                    break;
                case "prescription_auto_delete_job" :
                    //互联网医院 监管平台上报
                    //互联网医院 处方自动删除
                    if (!quartzHelper.isExistJob("prescription_auto_delete_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_auto_delete_job");
                        quartzHelper.addJob(PrescriptionAutoDeleteJob.class, trigger, "prescription_auto_delete_job", new HashMap<String, Object>());
@ -315,6 +318,17 @@ public class JobController extends BaseController {
                        logger.info("prescription_auto_delete_job  job exist");
                    }
                    break;
                case "send_noReply_job" :
                    //互联网医院 发送短信给未回复人员
                    if (!quartzHelper.isExistJob("send_noReply_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("send_noReply_job");
                        quartzHelper.addJob(SendNoReplyMessageJob.class, trigger, "send_noReply_job", new HashMap<String, Object>());
                        logger.info("send_noReply_job  job success");
                    } else {
                        logger.info("send_noReply_job  job exist");
                    }
                    break;
                case "data_ykupload_job_2" :
                    //互联网医院 监管平台上报
@ -1036,4 +1050,26 @@ public class JobController extends BaseController {
        }
    }
    @RequestMapping(value = "/deletePrescription", method = RequestMethod.GET)
    @ApiOperation("测试超时6天作废处方")
    public String deletePrescription(){
        try {
            prescriptionDeleteService.deletePrescription();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return success("操作成功");
    }
    @RequestMapping(value = "/sendMessageNoReply", method = RequestMethod.GET)
    @ApiOperation("发送短信给未回复人员")
    public String sendMessageNoReply(){
        try {
            timeoutOverDueService.sendMessageNoReply();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return success("操作成功");
    }
}

+ 2 - 0
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -7,6 +7,8 @@ prescription_overdue_job=0 0 2 * * ?
# 0 */1 * * * ?
prescription_auto_delete_job = 0 30 0 ? * *
send_noReply_job =0 0/15 * * * ? 
#\u6BCF\u592913 \u70B9\u89E6\u53D1
data_upload_job=0 0 2 * * ?
#\u6BCF10\u5206\u949F\u89E6\u53D1\u4E00\u6B21

+ 1 - 0
svr/svr-internet-hospital/src/main/resources/application.yml

@ -1,6 +1,7 @@
#通用的配置不用区分环境变量
server:
  port: ${server.svr-internet-hospital-port}
  max-http-header-size: 1000000
spring:
  aop: