Browse Source

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

ysj 4 năm trước cách đây
mục cha
commit
122c939d2f
24 tập tin đã thay đổi với 845 bổ sung209 xóa
  1. 6 0
      business/base-service/pom.xml
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDoctorDao.java
  3. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java
  4. 250 105
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java
  5. 114 21
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java
  6. 72 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  7. 19 8
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  8. 1 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  9. 2 8
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  10. 116 25
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  11. 1 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  12. 88 3
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  13. 2 4
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  14. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/version/AppVersionDO.java
  15. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  16. 8 5
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  17. 1 1
      svr/svr-base/src/main/resources/application.yml
  18. 4 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  19. 14 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java
  20. 15 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java
  21. 109 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  22. 5 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  23. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java
  24. 9 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/vo/TemplateDetailVo.java

+ 6 - 0
business/base-service/pom.xml

@ -185,6 +185,12 @@
            <version>1.4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.kaptcha</groupId>
            <artifactId>kaptcha</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

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

@ -20,5 +20,9 @@ public interface BaseBannerDoctorDao extends PagingAndSortingRepository<BaseBann
    Integer getTotalBannerCount(String doctor);
    @Query( value = "SELECT * from base_banner_doctor t where t.doctor = ?1 and t.patient_id =?2 and t.relation_code =?3" ,nativeQuery = true)
    List<BaseBannerDoctorDO> getBanners(String doctor,String patientId,String relationCode);
    @Query("from BaseBannerDoctorDO t where t.patientId =?1 order by t.createTime desc ")
    List<BaseBannerDoctorDO> getBannersBypatients(String patientId);
    @Query("from BaseBannerDoctorDO t where t.patientId =?1 and t.doctor =?2 order by t.createTime desc ")
    public abstract List<BaseBannerDoctorDO> getBannersBypatients(String paramString1, String paramString2);
}

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java

@ -20,7 +20,8 @@ public interface BaseUserMessageDao extends PagingAndSortingRepository<BaseUserM
    Integer getMessageNotReadCount(String doctor);
    @Query(value = "select *  from base_user_message t where t.receiver = ?1 and t.is_read = 0 order by t.update_time desc",nativeQuery = true)
    List<BaseUserMessageDO> getMessageNotReadNotPage(String doctor);
    @Query("from BaseUserMessageDO p where p.receiver=?1 and p.sender=?2 order by p.createTime desc ")
    public abstract List<BaseUserMessageDO> getMessageByPatientAndDoctor(String paramString1, String paramString2);

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 250 - 105
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java


+ 114 - 21
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -7,12 +7,14 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
@ -21,6 +23,7 @@ import com.yihu.jw.hospital.prescription.dao.BaseSensitiveDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
@ -34,12 +37,15 @@ import org.hibernate.dialect.Ingres9Dialect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.swing.plaf.PanelUI;
import javax.transaction.Transactional;
import java.io.IOException;
import java.lang.annotation.ElementType;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@ -67,6 +73,12 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
    private BaseBannerDao bannerDao;
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private BaseBannerDoctorService baseBannerDoctorService;
    @Value("${wechat.id}")
    private String wxId;
@ -75,29 +87,66 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
    @Value("${wechat.flag}")
    private boolean flag;
    //患者给医生自身留言接口
    public void leaveMessage(String content, String reciverId, String reciverName, String senderId, Integer type) {
    public ObjEnvelop leaveMessage(String content, String reciverId, String reciverName, String senderId, Integer type, String key, String value)
            throws IOException
    {
        BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
        BasePatientDO patientDO= basePatientDao.findById(senderId);
        String senderName=null;
        if(null!=patientDO){
            senderName = patientDO.getName();
        ObjEnvelop objEnvelop = new ObjEnvelop();
        boolean checkTimeOut = checkGiveTimeOut(senderId, reciverId);
        if ((StringUtils.isNotBlank(key)) && (StringUtils.isNotBlank(value))) {
            if (this.baseBannerDoctorService.verifyCaptcha(key, value))
            {
                checkTimeOut = true;
            }
            else
            {
                objEnvelop.setMessage("验证码错误");
                objEnvelop.setStatus(Integer.valueOf(78));
                return objEnvelop;
            }
        }
        String relationCode=UUID.randomUUID().toString();
        baseUserMessageDO.setContent(content);
        baseUserMessageDO.setSender(senderId);
        baseUserMessageDO.setSenderName(senderName);
        baseUserMessageDO.setReceiver(reciverId);
        baseUserMessageDO.setReceiverName(reciverName);
        baseUserMessageDO.setRelationCode(relationCode);
        baseUserMessageDO.setRelationName("留言");
        baseUserMessageDO.setRelationType(1);
        baseUserMessageDO.setStatus(1);
        baseUserMessageDO.setDel(1);
        baseUserMessageDO.setType(type);
        baseUserMessageDO.setIsRead(0);
        baseUserMessageDao.save(baseUserMessageDO);
        boolean checkTimes = checkGiveTimes(senderId, reciverId);
        if (checkTimes)
        {
            if (checkTimeOut)
            {
                BasePatientDO patientDO = this.basePatientDao.findById(senderId);
                String senderName = null;
                if (null != patientDO) {
                    senderName = patientDO.getName();
                }
                String relationCode = UUID.randomUUID().toString();
                baseUserMessageDO.setContent(content);
                baseUserMessageDO.setSender(senderId);
                baseUserMessageDO.setSenderName(senderName);
                baseUserMessageDO.setReceiver(reciverId);
                baseUserMessageDO.setReceiverName(reciverName);
                baseUserMessageDO.setRelationCode(relationCode);
                baseUserMessageDO.setRelationName("留言");
                baseUserMessageDO.setRelationType(Integer.valueOf(1));
                baseUserMessageDO.setStatus(Integer.valueOf(1));
                baseUserMessageDO.setDel(Integer.valueOf(1));
                baseUserMessageDO.setType(type);
                baseUserMessageDO.setIsRead(Integer.valueOf(0));
                this.baseUserMessageDao.save(baseUserMessageDO);
                objEnvelop.setStatus(Integer.valueOf(200));
                objEnvelop.setMessage("留言成功");
            }
            else
            {
                objEnvelop.setMessage("生成验证码");
                objEnvelop.setStatus(200);
                objEnvelop.setObj(baseBannerDoctorService.generateCaptcha());
                return objEnvelop;
            }
        }
        else
        {
            objEnvelop.setMessage("当天留言已达规定次数");
            objEnvelop.setStatus(Integer.valueOf(77));
            return objEnvelop;
        }
        return objEnvelop;
    }
    //回复留言接口
    @Transactional
@ -423,5 +472,49 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
        }
        return sql.toString();
    }
    public boolean checkGiveTimeOut(String sender, String reciver)
    {
        List<BaseUserMessageDO> baseBannerDoctorDOS = this.baseUserMessageDao.getMessageByPatientAndDoctor(reciver, sender);
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("leave_message_timeout");
        if (null != baseBannerDoctorDOS)
        {
            BaseUserMessageDO lastOne = (BaseUserMessageDO)baseBannerDoctorDOS.get(0);
            Date lastDate = lastOne.getCreateTime();
            long timeOut = wlyyHospitalSysDictDO.getDictValue() != null ? Long.valueOf(wlyyHospitalSysDictDO.getDictValue()).longValue() : 5L;
            Date current = new Date();
            if (current.getTime() - lastDate.getTime() > timeOut * 1000L * 60L) {
                return true;
            }
            return false;
        }
        return true;
    }
    public boolean checkGiveTimes(String patientId, String doctorId)
    {
        boolean flag = false;
        StringBuffer sql = new StringBuffer();
        sql.append("select t.sender as \"sender\",t.receiver as \"receiver\" from base_user_message t");
        sql.append(" where 1=1 ");
        if (StringUtils.isNotBlank(patientId)) {
            sql.append(" and t.sender = '" + patientId + "'");
        }
        if (StringUtils.isNotBlank(doctorId)) {
            sql.append(" and t.receiver = '" + doctorId + "'");
        }
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String strDate = format.format(date);
        sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        List<Map<String, Object>> list = this.hibenateUtils.createSQLQuery(sql.toString());
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("leave_message_times");
        long countTimes = 5L;
        if (wlyyHospitalSysDictDO != null) {
            countTimes = wlyyHospitalSysDictDO.getDictValue() == null ? countTimes : Long.valueOf(wlyyHospitalSysDictDO.getDictValue()).longValue();
        }
        if (list.size() > countTimes) {
            return false;
        }
        return true;
    }
}

+ 72 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java

@ -0,0 +1,72 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.util.http.HttpClientUtil;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
@Service
public class PayInfoNoticeService {
    @Value("${hospital.url}")
    private String serverUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 支付成功提醒
     * @param userName 用户名 (不能为空)
     * @param idCard 身份证 (能为空)
     * @param phone 推送人手机号 (不能为空)
     * @param title 推送标题 (不能为空)
     * @param url 支付链接   (不能为空)
     * @param doctorName 就诊医生 (不能为空)
     * @param total 总费用 (不能为空)
     * @param miPay 医保支付 (不能为空)
     * @param selfPay 个人支付 (不能为空)
     * @param orderNo 单据号 (不能为空)
     * @param remark 备注 (不能为空)
     * @return
     * @throws Exception
     */
    public String paySuccessNotice(String userName,String idCard,String phone,String title,String url,
                                   String doctorName,String total,String miPay,String selfPay,String orderNo,String remark) {
        url = "https://172.16.1.34";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userName", userName);
        jsonObject.put("idCard", idCard);
        jsonObject.put("phone", phone);
        jsonObject.put("title", title);
        jsonObject.put("url", serverUrl);
        jsonObject.put("doctorName", doctorName);
        jsonObject.put("total", total);
        jsonObject.put("miPay", miPay);
        jsonObject.put("selfPay", selfPay);
        jsonObject.put("orderNo", orderNo);
        jsonObject.put("remark", remark);
        String responseMsg = httpClientUtil.sendPost(url + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        JSONObject result = new JSONObject();
        String respCode = "";
        if (responseMsg != null) {
            result = JSONObject.parseObject(responseMsg);
            respCode = result.get("respCode").toString();
        }
        return respCode;
    }
}

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

@ -84,6 +84,7 @@ import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.mysql.query.BaseJpaService;
@ -255,6 +256,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PrescriptionSignDao prescriptionSignDao;
    @Autowired
    private EnterpriseService enterpriseService;
@ -880,6 +883,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        String content = "向您发起了图文复诊,点击查看";
        return outpatient;
    }
@ -1656,8 +1660,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                return res;
            }
        }
        //下载银医通
        net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(outpatientDO.getCardNo(), demoFlag);
        logger.info("下载银医通");
        net.sf.json.JSONObject rs = entranceService.BS10111(outpatientDO.getCardNo(), doctorMappingDO.getMappingCode(), outpatientDO.getDept(), null, outpatientDO.getWinNo(), demoFlag);
        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
        logger.info("挂号结果 res: " + res.toString());
@ -4662,7 +4667,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id ";
        Map<String, Object> params = new HashedMap();
        Date date = new Date();
        sql+="LEFT JOIN (SELECT  COUNT(t1.doctor) as workTotal, t1.doctor FROM  wlyy_doctor_work_time t1   WHERE   " +
                "t1.start_time <=:startTime  AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id ";
        params.put("startTime", date);
        params.put("endTime", date);
        if ("1".equalsIgnoreCase(isAttention)) {
            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' ";
        }
@ -4681,9 +4691,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql += " JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
        }
        sql += " WHERE  1=1 ";
        Map<String, Object> params = new HashedMap();
        sql += " WHERE  1=1 ";
        if (StringUtils.isBlank(chargType)) {
            sql += " AND d.charge_type is not null ";
@ -4699,7 +4708,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)) {
            logger.info("iswork:" + iswork);
            Date date = new Date();
            sql += " AND (" +
                    " EXISTS ( " +
                    " SELECT " +
@ -4775,7 +4783,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql += " and d.del='1' order by d.consult_status DESC,a.total " + consutlSort;
        sql += " and d.del='1' order by dw.workTotal desc,d.consult_status DESC,a.total " + consutlSort;
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        for (Map<String,Object> map:list){
@ -6855,7 +6863,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param name
     * @return
     */
    public List<Map<String, Object>> findDoctorByName(String hospital, String name, String chargeType) {
    public List<Map<String, Object>> findDoctorByName(String hospital, String name, String chargeType,String dept) {
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.name AS \"name\"" +
@ -6870,6 +6878,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(hospital)) {
            sql += " AND h.org_code ='" + hospital + "'";
        }
        if(StringUtils.isNotBlank(dept)){
            sql+= " AND h.dept_code = '"+dept+"'";
        }
        if (StringUtils.isNotBlank(chargeType)) {
            if ("all".equals(chargeType)) {

+ 1 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
@ -36,7 +37,6 @@ import net.sf.json.JSONArray;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -2722,6 +2722,4 @@ public class EntranceService {
}

+ 2 - 8
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -14,7 +14,6 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
import com.yihu.jw.entity.hospital.dict.BaseSuperviseDataDict;
import com.yihu.jw.entity.hospital.dict.BaseSuperviseDict;
import com.yihu.jw.entity.hospital.jgpt.HospitalImgDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.internet.dao.HospitalImgDao;
import com.yihu.jw.internet.dao.IntUpErrorLogDao;
@ -24,19 +23,15 @@ import com.yihu.jw.internet.entity.InternetUpLogDO;
import com.yihu.jw.internet.wsapi.Wsapi;
import com.yihu.jw.internet.wsapi.WsapiProxy;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.ImgUtils;
import com.yihu.jw.utils.JSONUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.encode.AESUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import nu.xom.jaxen.function.IdFunction;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -45,7 +40,6 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
import sun.misc.BASE64Encoder;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.util.Date;
import java.util.List;
@ -98,7 +92,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
    public String orgSub ;
    public String imgUrl;
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"hospital"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"ehr"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    public ObjectMapper objectMapper;
@ -358,7 +352,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("docimg", "");
                jb.put("id_card", info.get("idcard")== null ? "0":info.get("idcard"));
                jb.put("sex", info.get("sex")== null ? "0":info.get("sex"));
                jb.put("birthday", info.get("birthday")  == null?"1900-01-01": DateUtil.dateToStrLong((Date)info.get("birthday")));
                jb.put("birthday", info.get("birthday")  == null?"1900-01-01": DateUtil.dateToStrShort((Date)info.get("birthday")));
                jb.put("subject", dept.length>=1?dept[0]:"");
                jb.put("subject_name",dept.length>=2?dept[1]:"");
                jb.put("belong_dept",jb.getString("dept_code"));

+ 116 - 25
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -33,6 +33,7 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
@ -42,6 +43,7 @@ import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -108,6 +110,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private XzzxEntranceService xzzxEntranceService;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private EnterpriseService enterpriseService;
@ -430,12 +437,18 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (tradeType.equalsIgnoreCase("JSAPI")){
            map.put("openid", openId);
        }
        String wapUrl = "";
        String wapName = "";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            wapUrl = "https://www1.yanketong.com";
            wapName = "厦门大学附中厦门眼科中心";
        }
        if (tradeType.equalsIgnoreCase("MWEB")){
            JSONObject jsonObject = new JSONObject();
            JSONObject object = new JSONObject();
            object.put("type","Wap");
            object.put("wap_url","");
            object.put("wap_name","");
            object.put("wap_url",wapUrl);
            object.put("wap_name",wapName);
            jsonObject.put("h5_info",object);
            map.put("scene_info",jsonObject.toJSONString());
        }
@ -462,30 +475,58 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            String mchId = pay.get("mch_id").toString();
            String nonceStr = pay.get("nonce_str").toString();
            String prepayId = pay.get("prepay_id").toString();
            String trade = pay.get("trade_type").toString();
            if (trade.equalsIgnoreCase("Native")){
            String trade = "";
            if ("SUCCESS".equalsIgnoreCase(resultCode)){
                trade = pay.get("trade_type").toString();
                if (trade.equalsIgnoreCase("Native")){
                    Map<String,String> param = new HashedMap();
                    param.put("appId",appid);
                    param.put("package","prepay_id="+prepayId);
                    param.put("nonceStr",nonceStr);
                    param.put("signType","MD5");
                    param.put("timeStamp",getTimeStamp());
                    param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                    InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
                    ByteToInputStream byteToInputStream = new ByteToInputStream();
                    String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                    param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
                    pay.put("native",param);
                }//h5支付方法 返回跳转的微信收银台地址
                else if("MWEB".equalsIgnoreCase(trade)){
                    Map<String,String> param = new HashedMap();
                    param.put("appId",appid);
                    param.put("package","prepay_id="+prepayId);
                    param.put("nonceStr",nonceStr);
                    param.put("signType","MD5");
                    param.put("timeStamp",getTimeStamp());
                    param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                    //微信收银台地址
                    String mwebUrl = pay.get("mweb_url").toString();
                    param.put("mweb_url",mwebUrl);
                    pay.put("MWEB",param);
                }else {
                    Map<String,String> param = new HashedMap();
                    param.put("appId",appid);
                    param.put("package","prepay_id="+prepayId);
                    param.put("nonceStr",nonceStr);
                    param.put("signType","MD5");
                    param.put("timeStamp",getTimeStamp());
                    param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                    pay.put("jsapi",param);
            }
            }else {
                //支付失败返回信息
                Map<String,String> param = new HashedMap();
                param.put("appId",appid);
                param.put("package","prepay_id="+prepayId);
                param.put("nonceStr",nonceStr);
                param.put("signType","MD5");
                param.put("timeStamp",getTimeStamp());
                param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
                ByteToInputStream byteToInputStream = new ByteToInputStream();
                String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
                pay.put("native",param);
                param.put("err_code",pay.get("err_code").toString());
                param.put("err_code_des",pay.get("err_code_des").toString());
                pay.put("payFailed",param);
            }
        }else {
            //通信失败返回信息
            Map<String,String> param = new HashedMap();
            param.put("appId",appid);
            param.put("package","prepay_id="+prepayId);
            param.put("nonceStr",nonceStr);
            param.put("signType","MD5");
            param.put("timeStamp",getTimeStamp());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            pay.put("jsapi",param);
            param.put("return_code",pay.get("return_code").toString());
            param.put("return_msg",pay.get("return_msg").toString());
            pay.put("connectFailed",param);
        }
        return pay;
    }
@ -992,7 +1033,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
           WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
           wlyyOutpatientDO.setPayStatus(1);
           outpatientDao.save(wlyyOutpatientDO);
           WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
            //发送企业模板消息给医生
            BasePatientDO patientDO = new BasePatientDO();
            String msg = "";
            String name=outpatientDO.getPatientName();
            String sex = "";
            String age="";
            String date = "";
            String title = "";
            String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
            if (patientDO!=null){
                sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
                age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
            }
            if (outpatientDO!=null){
                if (outpatientDO.getType().equalsIgnoreCase("1")){
                    title = "图文复诊";
                    msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
                }else if (outpatientDO.getType().equalsIgnoreCase("2")){
                    title = "视频复诊";
                    date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
                    msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
                }
            }
            enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
            System.out.println("发送企业模板消息成功");
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
           List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
           if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
@ -1027,7 +1093,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);
            outpatientDao.save(wlyyOutpatientDO);
            WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
            //发送企业模板消息给医生
            BasePatientDO patientDO = new BasePatientDO();
            String msg = "";
            String name=outpatientDO.getPatientName();
            String sex = "";
            String age="";
            String date = "";
            String title = "";
            String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
            if (patientDO!=null){
                sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
                age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
            }
            if (outpatientDO!=null){
                if (outpatientDO.getType().equalsIgnoreCase("1")){
                    title = "图文复诊";
                    msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
                }else if (outpatientDO.getType().equalsIgnoreCase("2")){
                    title = "视频复诊";
                    date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
                    msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
                }
            }
            enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
            System.out.println("发送企业模板消息成功");
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
            List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
            if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -633,6 +633,7 @@ public class YlzPayService {
        ResponseParams<JSONObject> respnse = onepayClient.execute(requestParams);
        if (respnse.getRespCode().equals("000000")){
            jsonObject = JSON.toJSONString(respnse);
            System.out.println(jsonObject);
        }else {
            isSuccess = false;
            jsonObject = JSON.toJSONString(respnse);

+ 88 - 3
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -2276,7 +2276,7 @@ public class ImService {
	 */
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
		/*String  sql = "SELECT " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult_team b," +
				"base_patient d," +
@ -2302,7 +2302,7 @@ public class ImService {
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
			/*sql +=" and a.czrq >= '"+start_time+"'";*/
			*//*sql +=" and a.czrq >= '"+start_time+"'";*//*
		}
		
		if(!StringUtils.isEmpty(end_time)){
@ -2343,8 +2343,93 @@ public class ImService {
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}*/
		String  sql = "";
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
					" COUNT(1) AS \"total\" "+
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id ";
		}else{
			sql = "SELECT " +
					" COUNT(1) AS \"total\" "+
					"FROM wlyy_consult_team b," +
					"base_patient d," +
					"wlyy_consult a   " +
					"left join wlyy_outpatient op on  a.relation_code = op.id " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id ";
		}
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)){
			sql+=" AND b.doctor='"+doctor+"' ";
		}
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.symptoms like '"+title+"'";
		}
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
		}
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		//咨询状态
		if(status != 0){
			if(status ==2 ){//就诊中
				sql +=" and b.status = 0 ";
			}else if(status ==3 ){
				sql +=" and b.status = 1 ";
			}else{}
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
			sql +=" AND a.type in ("+type+")" ;
		}
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc ";
		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (mapList != null && mapList.size() > 0) {
			count = Long.parseLong(mapList.get(0).get("total").toString());
		}
		
		return count;
	}
	

+ 2 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,15 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
    /*@GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/version/AppVersionDO.java

@ -102,7 +102,7 @@ public class AppVersionDO extends IntegerIdentityEntity {
        this.info = info;
    }
	@Column(name = "size")
	@Column(name = "app_size")
    public double getSize() {
        return size;
    }

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

@ -1333,6 +1333,7 @@ public class BaseHospitalRequestMapping {
        public static final String getUpcomingByDoctor="/getUpcomingByDoctor";
        public static final String checkOperateTime="/checkOperateTime";
        public static final String querySettledRecord="/querySettledRecord";
        public static final String paySuccessNotice="/paySuccessNotice";
    }

+ 8 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -228,13 +228,16 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\tEND AS status,\n" +
                "\tdoc.create_time\n" +
                "FROM\n" +
                "\tbase_doctor doc,\n" +
                " base_doctor doc LEFT join base_doctor_hospital hos on doc.id = hos.doctor_code " +
                " LEFT JOIN dict_hospital_dept dept on hos.org_code = dept.org_code" +
                " AND hos.dept_code = dept.code"+
                /*"\tbase_doctor doc,\n" +
                "\tbase_doctor_hospital hos,\n" +
                "\tdict_hospital_dept dept\n" +
                "WHERE\n" +
                "\tdoc.id = hos.doctor_code\n" +
                "\tdict_hospital_dept dept\n" +*/
                " WHERE 1=1";
                /*"\tdoc.id = hos.doctor_code\n" +
                "AND hos.org_code = dept.org_code\n" +
                "AND hos.dept_code = dept.code\n" ;
                "AND hos.dept_code = dept.code\n"*/
        if (!StringUtils.isEmpty(nameOrIdcard)){
            sql += " and (doc.idcard LIKE '%"+nameOrIdcard+"%' or doc.name LIKE '%"+nameOrIdcard+"%')";
        }if (!StringUtils.isEmpty(orgCode)){

+ 1 - 1
svr/svr-base/src/main/resources/application.yml

@ -196,7 +196,7 @@ spring:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://172.26.0.110:8888/
demo:
  flag: true
hospital:

+ 4 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -220,15 +220,14 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
					if("0".equals(rsCode)||"-2".equals(rsCode)){
						//挂号成功,已经挂号
						//2.
						result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type,wxId);
					}else{
						failed(mes);
						return failed(mes);
					}
					logger.info("调用挂号接口====END");
				}
				
				
				//2.
				result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type,wxId);
			}
			return success("操作成功",result);
	}

+ 14 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
@ -30,23 +31,28 @@ public class BannerDoctorController extends EnvelopRestEndpoint {
    private BaseBannerDoctorService baseBannerDoctorService;
    @ApiOperation("批量赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.giveBanner)
    public Envelop giveBanner(@ApiParam(name = "bannerIds", value = "bannerIds", required = true)
    public ObjEnvelop giveBanner(@ApiParam(name = "bannerIds", value = "bannerIds", required = true)
                                  @RequestParam(value = "bannerIds", required = true)String bannerIds,
                              @ApiParam(name = "doctor", value = "doctor", required = false)
                                 @ApiParam(name = "doctor", value = "doctor", required = false)
                                  @RequestParam(value = "doctor", required = false)String doctor,
                              @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                 @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                  @RequestParam(value = "doctorName", required = false)String doctorName,
                              @ApiParam(name = "content", value = "content", required = false)
                                 @ApiParam(name = "content", value = "content", required = false)
                                  @RequestParam(value = "content", required = false)String content,
                              @ApiParam(name = "type", value = "type", required = false)
                                  @RequestParam(value = "type", required = false)Integer type){
                                 @ApiParam(name = "type", value = "type", required = false)
                                  @RequestParam(value = "type", required = false)Integer type,
                                 @ApiParam(name = "key", value = "key", required = false)
                                  @RequestParam(value = "key", required = false)String key,
                                 @ApiParam(name = "value", value = "value", required = false)
                                  @RequestParam(value = "value", required = false)String value) throws Exception{
        List<BaseBannerDoctorDO> resultList = new ArrayList<>();
        ObjEnvelop objEnvelop = new ObjEnvelop();
        if(StringUtils.isNotEmpty(bannerIds)){
            List<String> list =  Arrays.asList(bannerIds.split(","));
            String patientId= getUID();
            resultList = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName,type);
            objEnvelop = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName,type,key,value);
        }
    return success("赠送成功",resultList);
    return objEnvelop;
    }
    @ApiOperation("查询赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.getBanner)

+ 15 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.hospital.message.service.BaseUserMsgService;
import com.yihu.jw.hospital.message.service.UserMsgContentService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.print.Doc;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
@ -45,20 +47,25 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
    }
    @ApiOperation("自身评论")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.leaveMessage)
    public Envelop leaveMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
    public ObjEnvelop leaveMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
                              @RequestParam(value = "reciverId", required = false)String reciverId,
                              @ApiParam(name = "reciverName", value = "reciverName", required = false)
                                   @ApiParam(name = "reciverName", value = "reciverName", required = false)
                              @RequestParam(value = "reciverName", required = false)String reciverName,
                              @ApiParam(name = "content", value = "content", required = false)
                                   @ApiParam(name = "content", value = "content", required = false)
                              @RequestParam(value = "content", required = false)String content,
                                @ApiParam(name = "type", value = "type", required = false)
                                    @RequestParam(value = "type", required = false)Integer type
                              ){
                                   @ApiParam(name = "type", value = "type", required = false)
                                    @RequestParam(value = "type", required = false)Integer type,
                                   @ApiParam(name = "key", value = "key", required = false)
                                    @RequestParam(value = "key", required = false)String key,
                                   @ApiParam(name = "value", value = "value", required = false)
                                    @RequestParam(value = "value", required = false)String value
                              ) throws IOException {
        String senderId = getUID();
        System.out.println("senderId"+senderId);
        //String senderName = getUNAME();
        baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId,type);
        return success("留言成功" );
        ObjEnvelop objEnvelop = new ObjEnvelop();
        objEnvelop= baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId,type,key,value);
        return objEnvelop;
}
    @ApiOperation("医生评论展示")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.showMessage)

+ 109 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -23,9 +23,11 @@ import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PayInfoNoticeService;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.WorkTimeService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.service.consult.SysDictService;
@ -52,6 +54,7 @@ import com.ylzinfo.onepay.sdk.OnepayClient;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.WebHook;
import com.ylzinfo.onepay.sdk.domain.ext.WaitPayDetailVO;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.SecurityUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
@ -141,6 +144,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private WechatDao wechatDao;
    @Autowired
    private YlzPayService ylzPayService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
    private String successxml = "SUCCESS";
@ -756,4 +763,106 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
       return success("操作成功",result);
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.paySuccessNotice)
    @ApiOperation(value = "微信支付状态查询")
    public Envelop paySuccessNotice(@ApiParam(name = "userName", value = "userName", required = true)
                                      @RequestParam(value = "userName", required = true)String userName,
                                      @ApiParam(name = "idCard", value = "idCard", required = false)
                                      @RequestParam(value = "idCard", required = false)String idCard,
                                      @ApiParam(name = "phone", value = "phone", required = false)
                                      @RequestParam(value = "phone", required = false)String phone,
                                      @ApiParam(name = "title", value = "title", required = false)
                                      @RequestParam(value = "title", required = false)String title,
                                      @ApiParam(name = "url", value = "url", required = false)
                                      @RequestParam(value = "url", required = false)String url,
                                      @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                      @RequestParam(value = "doctorName", required = false)String doctorName,
                                      @ApiParam(name = "total", value = "总费用", required = false)
                                      @RequestParam(value = "total", required = false)String total,
                                      @ApiParam(name = "miPay", value = "医保支付", required = false)
                                      @RequestParam(value = "miPay", required = false)String miPay,
                                    @ApiParam(name = "selfPay", value = "个人支付", required = false)
                                        @RequestParam(value = "selfPay", required = false)String selfPay,
                                    @ApiParam(name = "orderNo", value = "单据号", required = false)
                                        @RequestParam(value = "orderNo", required = false)String orderNo,
                                    @ApiParam(name = "remark", value = "备注", required = false)
                                        @RequestParam(value = "remark", required = false)String remark) throws Exception{
        String result = payInfoNoticeService.paySuccessNotice(userName,idCard,phone,title,url,doctorName,total,miPay,selfPay,orderNo,remark);
        logger.info(result);
        return success("操作成功",result);
    }
    /**
     * 商户回调通知
     * @param request
     * @param response
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/ylzSettleRecord")
    public String ylzSettleRecord(HttpServletRequest request, HttpServletResponse response) throws Exception{
        response.setContentType("text/html;charset=utf-8");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        InputStream inputStream = request.getInputStream();
        String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
        logger.info("回调参数:{}", params);
        if (StringUtil.isEmpty(params)) {
            response.getWriter().write("empty");
            return appId;
        }
        // 参数转换
        ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
        OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
        try {
            logger.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                logger.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    logger.info("param"+params);
                    String cardNo = param.getString("cardNo");
                    String billSn =  param.getString("billSn");
                    String traceNo = param.getString("traceNo");
                    String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",billSn,traceNo,"1","10000");
                    JSONObject jsonObjectTotal = JSON.parseObject(result);
                    if (jsonObjectTotal.get("respCode").toString().equalsIgnoreCase("000000")){
                       JSONObject listParam =  JSON.parseObject(jsonObjectTotal.get("param").toString());
                       String bills = listParam.getString("bills");
                       String len = listParam.getString("len");
                       JSONObject billParam = JSON.parseObject(bills);
                       String drugState = billParam.getString("drugState");
                       String messageRemind = "您在中山医院医院内科就诊费用已支付成功!";
                       WaitPayDetailVO waitPayDetailVO = new WaitPayDetailVO();
                       if ("1".equalsIgnoreCase(drugState)){
                           messageRemind += "自取患者请于周一至周五上午8点到12点、下午2:30到5:30,到门诊药房9号或10号窗口凭相应的就诊卡或电子健康卡取药。";
                        }else {
                           messageRemind += "";
                       }
                        List<WaitPayDetailVO> listWPD = JSONObject.parseArray(billParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
                    }
                    response.getWriter().write("SUCCESS");
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
        }
        return appId;
    }
}

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

@ -345,7 +345,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        if (null==wlyyOutpatientDO.getId()){
        if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()){
            ObjEnvelop objEnvelop =new ObjEnvelop();
            String msg = "";
            if (1==wlyyOutpatientDO.getRemindCount()){
@ -1219,8 +1219,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                        @ApiParam(name = "name", value = "医生名称")
                                        @RequestParam(value = "name",required = false)String name,
                                        @ApiParam(name = "chargeType", value = "号别")
                                        @RequestParam(value = "chargeType",required = false)String chargeType) {
        return success(prescriptionService.findDoctorByName(hospital,name,chargeType));
                                        @RequestParam(value = "chargeType",required = false)String chargeType,
                                        @ApiParam(name = "dept", value = "科室")
                                            @RequestParam(value = "dept",required = false)String dept) {
        return success(prescriptionService.findDoctorByName(hospital,name,chargeType,dept));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptWithDoctorWorkTime)

+ 1 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -164,6 +164,7 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        for (String code : map.keySet()){
            TemplateDetailVo detailVo = new TemplateDetailVo();
            detailVo.setCode(code);
            detailVo.setId(code);
            detailVo.setList(map.get(code));
            for (RehabilitationServiceItemDO item:itemDOList){
                if(code.equals(item.getCode())){

+ 9 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/vo/TemplateDetailVo.java

@ -8,6 +8,7 @@ import java.util.List;
 * Created by yeshijie on 2020/8/7.
 */
public class TemplateDetailVo {
    private String id;//兼容之前的版本
    private String code;
    private String name;
    private List<RehabilitationTemplateDetailDO> list;
@ -35,4 +36,12 @@ public class TemplateDetailVo {
    public void setList(List<RehabilitationTemplateDetailDO> list) {
        this.list = list;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
}