Bläddra i källkod

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

yeshijie 4 år sedan
förälder
incheckning
d8d9b4bfe1
16 ändrade filer med 477 tillägg och 203 borttagningar
  1. 2 2
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  2. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  3. 170 78
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 3 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 124 70
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  6. 98 26
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  7. 7 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 0 1
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  9. 11 3
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  10. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  11. 1 4
      svr/svr-base/src/main/resources/application.yml
  12. 1 1
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  13. 18 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  14. 5 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  15. 6 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  16. 25 4
      svr/svr-internet-hospital/src/main/resources/application.yml

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -77,7 +77,7 @@ public class PatientMappingService {
     * @return
     * @throws Exception
     */
    public String findYkyyPatNoByPatient(String patient)throws Exception{
    public String findYkyyPatNoByPatient(String patient,boolean demoFlag)throws Exception{
        logger.info("findYkyyPatNoByPatient:"+patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        logger.info("patientDO:"+patientDO.toString());
@ -86,7 +86,7 @@ public class PatientMappingService {
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();
        }
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientMedicareCardDO.getCode());
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        if(rs!=null&&rs.size()>0){
            //获取居民信息

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

@ -37,6 +37,9 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    
    WlyyPrescriptionDO findByAdmNoAndRealOrder(String admno,String realOrder);
    @Query("select a from WlyyPrescriptionDO a where a.admNo = ?1 and a.realOrder =?2 ")
    List<WlyyPrescriptionDO> findByAdmNoAndRealOrderList(String adnmo,String realOrder);
    List<WlyyPrescriptionDO> findByDoctorAndCreateTimeAndRemark(String doctor,Date createTime,String remark);
}

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

@ -13,6 +13,8 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -243,11 +245,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private DictDeptDescDao dictDeptDescDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.id}")
    private String wechatId;
    @Value("${wechat.flag}")
    private boolean flag;
    /**
     * 获取居民就诊记录接口
@ -382,6 +385,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        String condition = "";
        if ("xm_ykyy_wx".equals(wechatId)) {
            if (flag){
                condition = "date_format(o.register_date ,'%Y-%m-%d %H:%i:%S' ) AS registerDate,";
            }else {
                condition = "to_char(o.register_date ,'yyyy-MM-dd hh24:mi:ss' ) AS \"registerDate\",";
            }
            condition = "to_char(o.register_date ,'yyyy-MM-dd hh24:mi:ss' ) AS \"registerDate\",";
        } else {
            condition = "date_format(o.register_date ,'%Y-%m-%d %H:%i:%S' ) AS registerDate,";
@ -414,7 +422,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.description AS \"description\", " +
                " o.disease_img AS \"diseaseImg\", ";
        if ("xm_ykyy_wx".equals(wechatId)) {
            sql = sql + "to_char(o.create_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"createTime\",";
            if (flag){
                sql = sql + "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime,";
            }else {
                sql = sql + "to_char(o.create_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"createTime\",";
            }
        } else {
            sql = sql + "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime,";
        }
@ -2102,7 +2114,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //先下单
                businessOrderService.savePrescriptionOrder(prescription.getId());
                //同步his
                ykyyEntranceService.findByRealOrder(prescription.getId());
                ykyyEntranceService.findByRealOrder(prescription.getId(),demoFlag);
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                if (prescriptionDOList != null && prescriptionDOList.size() != 0) {
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
@ -2124,7 +2136,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
                return result1;
            } else {
            } else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                Double price = prescription.getDrugFee();
                businessOrderService.recharge(prescription.getId(), "处方收费", "4", "处方收费", prescription.getPatientCode(), prescription.getPatientName(), prescription.getDoctor(), price);
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
                //zsSynHis(prescription.getId());
                Map<String, Object> result1 = new HashedMap();
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
                return result1;
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;
@ -3135,7 +3157,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "base_evaluate a " +
                    "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctor + "' " +
                    "WHERE a.relation_code=b.id AND b.doctor='" + doctor + "' ";
                    "WHERE a.relation_code=b.id AND b.doctor='" + doctor + "' order by b.create_time DESC ";
            List<Map<String, Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
            if (scoreList != null && scoreList.size() > 0) {
@ -3316,12 +3338,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "9");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(), "9", "doctorRefuse", null);
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuse", "");
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "16");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(), "16", "doctorRefuse", null);
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuse", "");
                }
                data.put("msg", msg);
                messageDO.setData(data.toString());
@ -3368,72 +3390,101 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param titelType
     * @param remindMsg
     */
    public void sendWxTemplateMsg(String wxId, String outpatientId, String type, String titelType, String remindMsg) {
    public void sendWxTemplateMsg(String wxId, String outpatientId,ConsultTeamDo consultTeam,  String type, String titelType, String remindMsg) {
        BaseDoctorDO consDoctorDO = new BaseDoctorDO();
        BasePatientDO consPatientDO = new BasePatientDO();
        //获取咨询的信息
        if (consultTeam!=null){
            consDoctorDO = baseDoctorDao.findById(consultTeam.getDoctor());
            consPatientDO = basePatientDao.findById(consultTeam.getPatient());
        }
        WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
        BaseDoctorDO doctorDO = new BaseDoctorDO();
        BasePatientDO patientDO = new BasePatientDO();
        if (StringUtils.isNotEmpty(outpatientId)){
            outpatientDO = outpatientDao.findById(outpatientId);
            doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
            patientDO = basePatientDao.findById(outpatientDO.getPatient());
        }
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        String contentMsg = "";
        String first = "";
        String remark = "";
        if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "通知内容:您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                first = outpatientDO.getPatientName() + ",您好!您的图文复诊已取消";
            }
            if ("16".equals(type)) {
                contentMsg = "通知内容:您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
            }
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "通知内容:您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                contentMsg = "您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
            } else if ("16".equals(type)) {
                contentMsg = "通知内容:您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                contentMsg = "您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
            } else if ("1".equals(type)) {
                contentMsg = "通知内容:您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
            }
            if ("1".equals(type)) {
                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
            } else if ("17".equals(type)) {
                contentMsg = "通知内容:您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
            }
        } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
            contentMsg = "通知内容:医生已为您开具处方,请及时支付。";
            remark = "备注:点击完成支付,如您已支付请忽略本条信息";
            contentMsg = "医生已为您开具处方,请及时支付。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
        } else if ("msgRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!";
            contentMsg = "通知内容:" + remindMsg;
            remark = "备注:请您尽快回复";
            contentMsg = "" + remindMsg;
            remark = "请您尽快回复";
        } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
            first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
            if ("16".equals(type)) {
                contentMsg = "通知内容:您的视频复诊已开始,错过将重新排队";
                remark = "备注:点击消息进入视频诊室接听视频通话,开始视频咨询。";
                contentMsg = "您的视频复诊已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
            } else if ("17".equals(type)) {
                contentMsg = "通知内容:您的视频咨询已开始,错过将重新排队";
                remark = "备注:点击消息进入视频诊室接听视频通话,开始视频复诊。";
                contentMsg = "您的视频咨询已开始,错过将重新排队";
                remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
            }
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
            if ("16".equals(type)) {
                first = "您的视频复诊已预约成功。";
                contentMsg = "通知内容:预计" + outpatientDO.getDoctorName() + "医生将于" + outpatientDO.getRegisterDate() + " 与您进行视频复诊。请留意微信公众号消息。";
                contentMsg = "预计" + outpatientDO.getDoctorName() + "医生将于" + DateUtil.dateToStrLong(outpatientDO.getRegisterDate()) + " 与您进行视频复诊。请留意微信公众号消息。";
            } else if ("17".equals(type)) {
                first = "您的视频咨询已预约成功。";
                contentMsg = "通知内容:预计" + outpatientDO.getDoctorName() + "医生将于" + outpatientDO.getRegisterDate() + " 与您进行视频咨询。请留意微信公众号消息。";
                contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。";
            }
            remark = "备注:咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
        } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!您有1条专家咨询已结束,请及时对咨询医生进行评价。";
            contentMsg = "通知内容:请对" + outpatientDO.getDoctorName() + "医生的服务进行评价";
            if (consultTeam.getType()!=null&&1==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
            }
            if (consultTeam.getType()!=null&&9==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
            }
            if (consultTeam.getType()!=null&&16==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
            }
            if (consultTeam.getType()!=null&&17==consultTeam.getType()){
                first = consultTeam.getName() + ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
            }
            contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
        }
@ -4496,17 +4547,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if (one.getId().equalsIgnoreCase(workTimeDO.getId())) {
                    continue;
                }
                try {
                    //与医院与自己排班比较  是否冲突  第一组最后时间小于等于第二组最前时间 || 第一组最前时间大于等于第二组最后时间
                    if (one.getEndTime().before(workTimeDO.getStartTime()) || one.getStartTime().after(workTimeDO.getEndTime())) {
                    } else {
                        throw new Exception("您选择的时间与“开始时间-结束时间”的医院排班/自己排班冲突,请重新选择!");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    return false;
                //与医院与自己排班比较  是否冲突  第一组最后时间小于等于第二组最前时间 || 第一组最前时间大于等于第二组最后时间
                if (one.getEndTime().before(workTimeDO.getStartTime()) || one.getStartTime().after(workTimeDO.getEndTime())) {
                } else {
                    throw new Exception("您选择的时间与“开始时间-结束时间”的医院排班/自己排班冲突,请重新选择!");
                }
            }
            doctorWorkTimeDao.save(workTimeDO);
@ -5237,7 +5285,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param outpatient
     * @return
     */
    public SystemMessageDO sendOutPatientMes(WlyyOutpatientDO outpatient) {
    public SystemMessageDO sendOutPatientMes(WlyyOutpatientDO outpatient,boolean payFlag) {
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        String msg = "";
        JSONObject data = new JSONObject();
@ -5251,11 +5299,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("1".equals(outpatient.getType())) {
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setType("1");
                    saveInquirySystemMessage(outpatient);
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                } else {
                    systemMessageDO.setTitle("视频复诊预约成功");
                    systemMessageDO.setType("2");
                    saveInquirySystemMessage(outpatient);
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                    msg = "您的视频复诊已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    systemMessageDO.setReceiver(outpatient.getDoctor());
@ -5273,10 +5325,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    data.put("msg", msg);
                    systemMessageDO.setData(data.toString());
                    systemMessageService.saveMessage(systemMessageDO);
                    sendWxTemplateMsg(wechatId, outpatient.getId(), "17", "videoOrderRemind", null);
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                }
            }
            BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
@ -5289,44 +5340,85 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return systemMessageDO;
    }
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient) {
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient,ConsultTeamDo consultTeamDo) {
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        String msg = "";
        String type = "";
        if ("1".equals(outpatient.getType())) {
            type = "9";
            msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        } else {
            type = "16";
            msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        }
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setType("11");
        systemMessageDO.setSender(outpatient.getDoctor());
        systemMessageDO.setSenderName(outpatient.getDoctorName());
        systemMessageDO.setRelationCode(outpatient.getId());
        systemMessageDO.setReceiver(outpatient.getPatient());
        systemMessageDO.setReceiverName(outpatient.getPatientName());
        JSONObject data = new JSONObject();
        try {
            data.put("name", outpatient.getPatientName());
            data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question", outpatient.getDescription());
            data.put("msg", msg);
            data.put("type", type);
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        } catch (Exception e) {
            e.printStackTrace();
        if (outpatient!=null){
            if ("1".equals(outpatient.getType())) {
                type = "9";
                msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            } else if ("2".equals(outpatient.getType())){
                type = "16";
                msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }
            systemMessageDO.setSender(outpatient.getDoctor());
            systemMessageDO.setSenderName(outpatient.getDoctorName());
            systemMessageDO.setRelationCode(outpatient.getId());
            systemMessageDO.setReceiver(outpatient.getPatient());
            systemMessageDO.setReceiverName(outpatient.getPatientName());
           data = new JSONObject();
            try {
                data.put("name", outpatient.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                data.put("question", outpatient.getDescription());
                data.put("msg", msg);
                data.put("type", type);
                systemMessageDO.setData(data.toString());
                systemMessageService.saveMessage(systemMessageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
        }
        BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
            ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
        if (consultTeamDo!=null){
            BaseDoctorDO doctorDO = baseDoctorDao.findById(consultTeamDo.getDoctor());
            BasePatientDO patientDO = basePatientDao.findById(consultTeamDo.getPatient());
            if (consultTeamDo.getType().equals("17")){
                type = "17";
                msg = patientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }else if (consultTeamDo.getType().equals("1")){
                type = "1";
                msg = patientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
            }
            systemMessageDO.setSender(consultTeamDo.getDoctor());
            systemMessageDO.setSenderName(doctorDO.getName());
            systemMessageDO.setRelationCode(consultTeamDo.getConsult());
            systemMessageDO.setReceiver(consultTeamDo.getPatient());
            systemMessageDO.setReceiverName(consultTeamDo.getName());
           data = new JSONObject();
            try {
                data.put("name", patientDO.getName());
                data.put("age", IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(patientDO.getIdcard()));
                data.put("question", consultTeamDo.getSymptoms());
                data.put("msg", msg);
                data.put("type", type);
                systemMessageDO.setData(data.toString());
                systemMessageService.saveMessage(systemMessageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
        }
        sendWxTemplateMsg(wechatId, outpatient.getId(), type, "payRemind", null);
    }
@ -6375,7 +6467,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
            }
            sendWxTemplateMsg(wxId, outpatientDO.getId(), "", "prescriptionPayRemind", null);
            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", "");
        } else {
            wlyyPrescriptionDO.setId(prescriptionId);
            wlyyPrescriptionDO.setCheckStatus(status);

+ 3 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -93,11 +93,10 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Autowired
    private BaseUserAgent userAgent;
    @Value("${demo.flag}")
    private boolean demoFlag;
    /**
     * 获取居民就诊记录接口
     * @param patient
@ -109,7 +108,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
@ -139,7 +138,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public  WlyyOutpatientVO findOutpatientInfo(String patient,String conNo, boolean demoFlag)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }

+ 124 - 70
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -100,6 +100,8 @@ public class XzzxEntranceService{
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
@ -1317,55 +1319,45 @@ public class XzzxEntranceService{
    public Map<String,Object> updatePreStatusLocal(String admNo,String realOrder,String status) throws Exception {
        Map<String,Object> map = new HashedMap();
        logger.info("admNo"+admNo+"=========realOrder"+realOrder+"===========status"+status);
        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
        if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
            throw new Exception("该就诊号查不到!");
        }
        for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
            String registerNo = wlyyOutpatientDO.getRegisterNo();
            if (!StringUtils.isNoneBlank(registerNo)){
                throw new Exception("挂号流水号为空!");
        if (status.equalsIgnoreCase("1")){
            List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
            if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
                throw new Exception("该就诊号查不到!");
            }
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
            List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutpatientId(wlyyOutpatientDO.getId());
            if (prescriptionDOList==null||prescriptionDOList.size()==0){
            for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
                String registerNo = wlyyOutpatientDO.getRegisterNo();
                if (!StringUtils.isNoneBlank(registerNo)){
                    throw new Exception("挂号流水号为空!");
                }
                PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
                List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionListLocal(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
                logger.info("处方数据"+prescriptionVOList);
                for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
                    WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
                    prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
                    if (status.equalsIgnoreCase("3")){
                        prescriptionDO.setStatus(30);
                    }
                    prescriptionDO.setPatientCode(wlyyOutpatientDO.getPatient());
                    prescriptionDO.setDoctor(wlyyOutpatientDO.getDoctor());
                    prescriptionDO.setHospital("350211A5010");
                    prescriptionDO.setPatientCode(wlyyOutpatientDO.getPatient());
                    prescriptionDO= prescriptionDao.save(prescriptionDO);
                    //处方诊断表vo
                    List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
                    if (diagnosisVOS!=null&&diagnosisVOS.size()!=0){
                        for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
                            WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
                            prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
                            prescriptionDiagnosisDO.setDel(1);
                            diagnosisDao.save(prescriptionDiagnosisDO);
                        }
                    for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
                        WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
                        prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
                        prescriptionDiagnosisDO.setDel(1);
                        diagnosisDao.save(prescriptionDiagnosisDO);
                    }
                    //药品表
                    List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
                    if (infoVOList!=null&&infoVOList.size()!=0){
                        for (WlyyPrescriptionInfoVO infoVO:infoVOList){
                            WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
                            infoDO.setPrescriptionId(prescriptionDO.getId());
                            infoDO.setDel(1);
                            prescriptionInfoDao.save(infoDO);
                        }
                    for (WlyyPrescriptionInfoVO infoVO:infoVOList){
                        WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
                        infoDO.setPrescriptionId(prescriptionDO.getId());
                        infoDO.setDel(1);
                        prescriptionInfoDao.save(infoDO);
                    }
                    List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
                    if (inspectionVOList!=null&&inspectionVOList.size()!=0)
                    for (WlyyInspectionVO inspectionVO:inspectionVOList){
                        WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
                        BeanUtils.copyProperties(inspectionVO,inspectionDO);
@ -1375,6 +1367,36 @@ public class XzzxEntranceService{
                    }
                }
            }
        }else if (status.equalsIgnoreCase("2")){
            List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
            for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
                wlyyPrescriptionDO.setStatus(-1);
                prescriptionDao.save(wlyyPrescriptionDO);
                //检查
                List<WlyyInspectionDO> wlyyInspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                for (WlyyInspectionDO inspectionDO:wlyyInspectionDOS){
                    inspectionDO.setDel(0);
                    wlyyInspectionDao.save(inspectionDO);
                }
                //药品
                List<WlyyPrescriptionInfoDO> prescriptionInfoDOS=prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOS){
                    prescriptionInfoDO.setDel(0);
                    prescriptionInfoDao.save(prescriptionInfoDO);
                }
                //诊断
                List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
                    diagnosisDO.setDel(0);
                    prescriptionDiagnosisDao.save(diagnosisDO);
                }
            }
        }else if (status.equalsIgnoreCase("3")){
            List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
            for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
                wlyyPrescriptionDO.setStatus(30);
                prescriptionDao.save(wlyyPrescriptionDO);
            }
        }
        return map;
    }
@ -1858,50 +1880,82 @@ public class XzzxEntranceService{
    public Map<String,Object> updatePreStatus(String admNo,String realOrder,String status) throws Exception {
        Map<String,Object> map = new HashedMap();
        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
        if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
            throw new Exception("该就诊号查不到!");
        }
        for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
            String registerNo = wlyyOutpatientDO.getRegisterNo();
            if (!StringUtils.isNoneBlank(registerNo)){
                throw new Exception("挂号流水号为空!");
        if (status.equalsIgnoreCase("1")){
            List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
            if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
                throw new Exception("该就诊号查不到!");
            }
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
            List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutpatientId(wlyyOutpatientDO.getId());
            if (prescriptionDOList==null||prescriptionDOList.size()==0){
                List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionList(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
                for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
                    WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
                    prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
                    if (status.equalsIgnoreCase("3")){
                        prescriptionDO.setStatus(30);
                    }
                    prescriptionDO= prescriptionDao.save(prescriptionDO);
                    //处方诊断表vo
                    List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
                    for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
                        WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
                        prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
                        diagnosisDao.save(prescriptionDiagnosisDO);
                    }
                    //药品表
                    List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
                    for (WlyyPrescriptionInfoVO infoVO:infoVOList){
                        WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
                        infoDO.setPrescriptionId(prescriptionDO.getId());
                        prescriptionInfoDao.save(infoDO);
                    }
            for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
                String registerNo = wlyyOutpatientDO.getRegisterNo();
                if (!StringUtils.isNoneBlank(registerNo)){
                    throw new Exception("挂号流水号为空!");
                }
                PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutpatientId(wlyyOutpatientDO.getId());
                if (prescriptionDOList==null||prescriptionDOList.size()==0){
                    List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionList(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
                    for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
                        WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
                        prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
                        if (status.equalsIgnoreCase("3")){
                            prescriptionDO.setStatus(30);
                        }
                        prescriptionDO= prescriptionDao.save(prescriptionDO);
                        //处方诊断表vo
                        List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
                        for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
                            WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
                            prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
                            diagnosisDao.save(prescriptionDiagnosisDO);
                        }
                        //药品表
                        List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
                        for (WlyyPrescriptionInfoVO infoVO:infoVOList){
                            WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
                            infoDO.setPrescriptionId(prescriptionDO.getId());
                            prescriptionInfoDao.save(infoDO);
                        }
                    List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
                    for (WlyyInspectionVO inspectionVO:inspectionVOList){
                        WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
                        BeanUtils.copyProperties(inspectionVO,inspectionDO);
                        inspectionDO.setPrescriptionId(prescriptionDO.getId());
                        wlyyInspectionDao.save(inspectionDO);
                        List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
                        for (WlyyInspectionVO inspectionVO:inspectionVOList){
                            WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
                            BeanUtils.copyProperties(inspectionVO,inspectionDO);
                            inspectionDO.setPrescriptionId(prescriptionDO.getId());
                            wlyyInspectionDao.save(inspectionDO);
                        }
                    }
                }
            }
        }else if (status.equalsIgnoreCase("2")){
            List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
            for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
                wlyyPrescriptionDO.setStatus(-1);
                prescriptionDao.save(wlyyPrescriptionDO);
                //检查
                List<WlyyInspectionDO> wlyyInspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                for (WlyyInspectionDO inspectionDO:wlyyInspectionDOS){
                    inspectionDO.setDel(0);
                    wlyyInspectionDao.save(inspectionDO);
                }
                //药品
                List<WlyyPrescriptionInfoDO> prescriptionInfoDOS=prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOS){
                    prescriptionInfoDO.setDel(0);
                    prescriptionInfoDao.save(prescriptionInfoDO);
                }
                //诊断
                List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
                    diagnosisDO.setDel(0);
                    prescriptionDiagnosisDao.save(diagnosisDO);
                }
            }
        }else if (status.equalsIgnoreCase("3")){
            List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
            for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
                wlyyPrescriptionDO.setStatus(30);
                prescriptionDao.save(wlyyPrescriptionDO);
            }
        }
        return map;
    }

+ 98 - 26
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -46,6 +46,7 @@ import org.apache.commons.lang3.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.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -134,7 +135,6 @@ public class YkyyEntranceService {
    private YkyyService ykyyService;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
    }
@ -395,8 +395,44 @@ public class YkyyEntranceService {
            return null;
        }
//KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
//                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH
        JSONArray jsonArray = new JSONArray();
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("BRID","1168517");
            jsonObject.put("BRXM","于小童");
            jsonObject.put("SJHM","");
            jsonObject.put("SFZH","");
            jsonObject.put("BRXZ","自费");
            jsonObject.put("YSDM","1630");
            jsonObject.put("KDYS","罗向东");
            jsonObject.put("KSDM","1101");
            jsonObject.put("KSMC","眼底病专科(五缘院区)");
            jsonObject.put("KSSJ","2020/04/28 15:55:29");
            jsonObject.put("ZDMC","高度近视");
            jsonObject.put("JZXH","2395501");
            JSONObject jsonObject2 = new JSONObject();
            jsonObject.put("BRID","1168517");
            jsonObject.put("BRXM","于小童");
            jsonObject.put("SJHM","");
            jsonObject.put("SFZH","");
            jsonObject.put("BRXZ","自费");
            jsonObject.put("YSDM","1630");
            jsonObject.put("KDYS","张纯");
            jsonObject.put("KSDM","1101");
            jsonObject.put("KSMC","高度近视专科(五缘院区)");
            jsonObject.put("KSSJ","2020/05/19 15:51:23");
            jsonObject.put("ZDMC","高度近视");
            jsonObject.put("JZXH","2395506");
            jsonArray.add(jsonObject);
            jsonArray.add(jsonObject2);
        }else {
            jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime);
        }
        //查找眼科数据
        JSONArray jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime);
        if (jsonArray.size() == 0) {
            return null;
        }
@ -443,7 +479,7 @@ public class YkyyEntranceService {
                wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                wlyyOutpatientVOS.add(wlyyOutpatientVO);
                List<WlyyInspectionVO> inspectionVOList = new ArrayList<>();
                JSONArray array = findV_ZKSG_JCCX(PAT_NO,wlyyOutpatientVO.getAdmNo());
                JSONArray array = findV_ZKSG_JCCX(PAT_NO,wlyyOutpatientVO.getAdmNo(),demoFlag);
                for (int j=0;j<array.size();j++){
                    JSONObject object = array.getJSONObject(j);
                    String ksdm = object.getString("ksdm");//科室代码
@ -549,7 +585,7 @@ public class YkyyEntranceService {
     * HIS就诊患者历史查询
     * @throws Exception
     */
    public JSONArray findV_ZKSG_JCCX(String brid,String conNo) throws Exception{
    public JSONArray findV_ZKSG_JCCX(String brid,String conNo,boolean demoFlag) throws Exception{
        String sql = "SELECT\n" +
                "\tz.BRID AS \"brid\",\n" +
                "\tz.BRXM AS \"brxm\",\n" +
@ -576,17 +612,36 @@ public class YkyyEntranceService {
                "WHERE\n" +
                "\tz.JZXH = '"+conNo+"'\n" +
                "AND z.brid = '"+brid+"'";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            return rs.getJSONArray("detailModelList");
        JSONArray jsonArray = new JSONArray();
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","769da42e4dda41b29e73ddf2450b42c2");
            jsonObject.put("brxm","李艳秋");
            jsonObject.put("kdrq","2020-06-15");
            jsonObject.put("zxrq","2020-06-25");
            jsonObject.put("ysdm","A0502541");
            jsonObject.put("fymc","珍视明眼药水");
            jsonObject.put("fydj","9.99");
            jsonObject.put("fysl","2");
            jsonObject.put("fyhj","19.98");
            jsonObject.put("yblb","甲类");
            jsonObject.put("jzhx","X44515865");
            jsonObject.put("yjxh","F0551285");
            jsonObject.put("zxks","高度近视专科(五缘院区)");
            jsonArray.add(jsonObject);
        }else {
            Map<String,Object> params = new HashedMap();
            params.put("sql",sql);
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if(status!=null&&status == 200){
                return rs.getJSONArray("detailModelList");
            }
        }
        return new JSONArray();
        return jsonArray;
    }
@ -1355,7 +1410,7 @@ public class YkyyEntranceService {
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatient(String ssc) throws Exception {
    public JSONArray findHisPatient(String ssc,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
@ -1378,14 +1433,31 @@ public class YkyyEntranceService {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
@ -1437,7 +1509,7 @@ public class YkyyEntranceService {
    public String findByRealOrder(String code) throws Exception {
    public String findByRealOrder(String code,boolean demoFlag) throws Exception {
        List<WlyyPrescriptionDO>  wlyyPrescriptionDOs = prescriptionDao.findById(code);
        if (wlyyPrescriptionDOs!=null&&wlyyPrescriptionDOs.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOs.get(0);
@ -1452,7 +1524,7 @@ public class YkyyEntranceService {
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            //诊断
            synPrescriptionDiagnosis(prescriptionVO,code);
            synPrescriptionDiagnosis(prescriptionVO,code,demoFlag);
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO,code);
@ -1564,7 +1636,7 @@ public class YkyyEntranceService {
     * 诊断
     * @param wlyyPrescriptionVO
     */
    public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception{
    public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO,String code,boolean demoFlag) throws Exception{
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
@ -1601,7 +1673,7 @@ public class YkyyEntranceService {
        hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
        hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode());
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);

+ 7 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -354,7 +354,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId) throws Exception {
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId,boolean payFlag) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        String body = businessOrderDO.getDescription();
@ -374,7 +374,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl);
        Map<String,Object> map = new HashedMap();
        if (payFlag){
            map = unifiedorder(wechatId,body,totalFee,tradeType,openid,ourTradeNo,notifyUrl);
        }else {
            updatePayStatusByRelation(relationCode);
        }
        return map;
    }

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

@ -80,7 +80,6 @@ public class YlzPayService {
            param.setOutTradeNo(outTradeNo);
            param.setCardNo(cardNo);
            param.setCardType(cardType);
            param.setAccountType(accountType);
            param.setDepositType(depositType);
            param.setRechargeAmount(rechargeAmount);
            param.setConsumeAmount(consumeAmount);

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

@ -179,7 +179,10 @@ public class ImService {
	
	@Value("${wechat.id}")
	private String wxId;
	
	@Value("${wechat.flag}")
	private boolean flag;
	
	
	/**
@ -202,7 +205,11 @@ public class ImService {
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\",";
		if("xm_ykyy_wx".equals(wxId)){
			sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
			if (flag){
				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}else {
				sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
			}
		}else{
			sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
		}
@ -252,6 +259,7 @@ public class ImService {
			sql += " and a.pay_status = " + payStatus + "";
		}
		sql += " ORDER BY a.czrq desc ";
		logger.info("sql="+sql);
		List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
		/*result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));*/
		return result;
@ -1519,7 +1527,7 @@ public class ImService {
			ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
		}
		prescriptionService.sendWxTemplateMsg(wxId,cons.getRelationCode(),type,"evaluateRemind",null);
		prescriptionService.sendWxTemplateMsg(wxId,"",consultTeam,type,"evaluateRemind","");
	}

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

@ -19,13 +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")
/*    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

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

@ -469,9 +469,6 @@ fast-dfs:
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段  # todo 待配置
---
spring:
  profiles: jwystest
@ -517,4 +514,4 @@ wechat:
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream

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

@ -372,7 +372,7 @@ testPattern:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService

+ 18 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -116,6 +116,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Value("${wechat.id}")
	private String wxId;
	@Value("${pay.flag}")
	private boolean payFlag;
	
	@Autowired
	private FileUtil fileUtil;
@ -440,10 +443,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				String msg= "";
				if (type==17){
					msg=re.getString("patientName")+",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
					prescriptionService.sendWxTemplateMsg(wxId,null,type+"","videoOrderRemind",null);
					prescriptionService.sendWxTemplateMsg(wxId,"",consult,type+"","videoOrderRemind","");
				}else {
					msg=re.getString("patientName")+",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}
				if (payFlag){
					prescriptionService.saveInquirySystemMessage(null,consult);
				}
				data.put("msg",msg);
				systemMessageDO.setData(data.toString());
				systemMessageService.saveMessage(systemMessageDO);
@ -506,6 +512,17 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
						consultDao.save(consultDo);
					}
					businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
				}else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
					Double price = 0.0;
					if(d!=null&& org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())){
						price = Double.parseDouble(d.getFee());
					}
					ConsultDo consultDo = consultDao.findOne(re.getString("consult"));
					if (price==0.0){
						consultDo.setPayStatus(1);
						consultDao.save(consultDo);
					}
					businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
				}
			}catch (Exception e){
			    logger.info("支付订单失败:"+e.getMessage());

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

@ -117,6 +117,9 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    
    @Value("${wechat.id}")
    private String wxId;
    @Value("${pay.flag}")
    private boolean payFlag;
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
@ -340,7 +343,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        
        //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
        //发送IM消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        
@ -847,7 +850,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType);
        
        //构建系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
        //发送系统消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        

+ 6 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -45,6 +45,10 @@ public class YkyyController extends EnvelopRestEndpoint {
    @Autowired
    private WxTemplateService wxTemplateService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${pay.flag}")
    private boolean payFlag;
    @GetMapping(value = "/selectCardList")
    @ApiOperation(value = "查询就诊卡")
@ -325,7 +329,7 @@ public class YkyyController extends EnvelopRestEndpoint {
            @ApiParam(name = "tradeType", value = "tradeType", required = false)
            @RequestParam(required = false)String tradeType) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,tradeType,wxId));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderByRelationCode(relationCode,tradeType,wxId,payFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -384,7 +388,7 @@ public class YkyyController extends EnvelopRestEndpoint {
            @ApiParam(name = "code", value = "code", required = true)
            @RequestParam(required = true)String code) throws Exception {
        try {
            ykyyEntranceService.findByRealOrder(code);
            ykyyEntranceService.findByRealOrder(code,demoFlag);
            return ObjEnvelop.getSuccess("ok","");
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());

+ 25 - 4
svr/svr-internet-hospital/src/main/resources/application.yml

@ -111,6 +111,7 @@ myFamily:
  qrCodeFailurTime: 2
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -183,6 +184,7 @@ fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -263,6 +265,7 @@ fast-dfs:
  tracker-server: 192.0.33.26:22122 #服务器地址
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
@ -352,6 +355,7 @@ fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -437,6 +441,7 @@ fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -519,6 +524,7 @@ fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
@ -599,6 +605,7 @@ fast-dfs:
  tracker-server: 172.16.100.240:22122 #服务器地址
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
@ -681,6 +688,7 @@ fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
@ -754,15 +762,16 @@ spring:
    password: admin
  redis:
#    host: 172.26.0.253 # Redis server host.
    host: 172.26.0.190 # Redis server host.
    port: 6379 # Redis server port.
    host: 172.26.0.190 # Redis server host
    port: 6379 # Redis server port
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -771,6 +780,9 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
@ -807,4 +819,13 @@ wlyy:
qywx:
  url: 2
  id: 1
  id: 1
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk