Browse Source

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

yeshijie 4 years ago
parent
commit
5c3854c116

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

@ -18,6 +18,9 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    List<WlyyOutpatientDO> findByDoctorAndStatus(String doctor,String status);
    @Query("from WlyyOutpatientDO a where a.doctor = ?1 and a.status in(2,3)")
    List<WlyyOutpatientDO> findByDoctorList(String doctor);
    Integer countByDoctorAndStatusAndOutpatientType(String doctor,String status,String outpatientType);
    List<WlyyOutpatientDO> findByDoctor(String doctor);

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

@ -431,7 +431,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param outpatientId
     * @return
     */
    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId){
    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId) throws Exception {
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        //复诊信息
@ -476,8 +476,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
                WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(outpatientDO.getOriginRegisterNo());
                //电子病历
                vo.setWlyyPrescriptionEmrDO(prescriptionEmrDao.findEmrByPrescriptionId(vo.getId()));
                vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
            }
        }
        rs.put("prescriptions",prescriptionVOs);
@ -2958,6 +2959,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("doctorAge","");
            }
            rs.put("doctor",doctorDO.getName());
            rs.put("fee",doctorDO.getFee());
            rs.put("jobTitleCode",doctorDO.getJobTitleCode());
            rs.put("jobTitleName",doctorDO.getJobTitleName());
            rs.put("chargeType",doctorDO.getChargeType());
@ -3014,12 +3016,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("registerCount",0);
            }
            //医生问诊量
//            List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorAndStatus(doctor,"2");
//            if(wlyyOutpatientDOs!=null&&wlyyOutpatientDOs.size()>0){
//                rs.put("outpatientCount",wlyyOutpatientDOs.size());
//            }else{
//                rs.put("outpatientCount",0);
//            }
            List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctor);
            if(wlyyOutpatientDOs!=null&&wlyyOutpatientDOs.size()>0){
                rs.put("outpatientCount",wlyyOutpatientDOs.size());
            }else{
                rs.put("outpatientCount",0);
            }
//
//            //协同门诊量
//            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
@ -4337,6 +4339,62 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        return list;
    }
    public String generalDoctorWaitingNumber(String doctor,String wxId,String outpatientId){
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
            condition+= "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            condition+= "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
        }else{
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
        }
        String sql ="SELECT " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
                "room.patient_name AS \"name\"," +
                "patient.sex AS \"sex\"," +
                "patient.idcard AS \"idcard\"," +
                "patient.photo AS \"photo\"," +
                "patient.birthday AS \"birthday\"," +
                "patient.mobile AS \"mobile\"," +
                "outpatient.mobile AS \"outpatient_mobile\"," +
                "room.consult_type AS \"consult_type\"," +condition+
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "outpatient.origin_con_no AS \"origin_con_no\", " +
                "room.reservation_type AS \"reservation_type\" " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "base_patient patient," +
                "wlyy_outpatient outpatient " +
                "WHERE " +
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 " +
                "AND outpatient.pay_status = 1 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.reservation_time is not null " +
                "AND room.consult_type= 2 ";/* +
                "AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC ";
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
        if("xm_ykyy_wx".equals(wxId)){
            sql+=" AND room.reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
        }else {
            sql +=" AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
        }
        sql+=" order by room.reservation_time ASC ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Integer waitCount =1;
        for (Map<String,Object> map:list){
            if (!map.get("id").toString().equalsIgnoreCase(outpatientId)){
                waitCount+=1;
            }
        }
        return waitCount.toString();
    }
    
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor,String wxId) {
        String condition = "";
@ -5167,7 +5225,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    
    /**
     * 查询医生所有可抢单的数量
     * @param doctor
@ -5536,7 +5598,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    
    public void followOrgByPatient(String patientid, String doctorid, String type) {
        List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(patientid,doctorid);
        List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(doctorid,patientid);
        if("1".equals(type)){//关注
            if(list.isEmpty()){
                BaseDoctorPatientFollowDO baseOrgPatientFollowDO = new BaseDoctorPatientFollowDO();
@ -5544,13 +5606,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseOrgPatientFollowDO.setPatient(patientid);
                baseOrgPatientDao.save(baseOrgPatientFollowDO);
            }
        }else if("0".equals(type)){//取消关注
        }
        if("0".equals(type)){//取消关注
            if(!list.isEmpty()){
                for (BaseDoctorPatientFollowDO baseOrgPatientFollowDO:list){
                    baseOrgPatientDao.delete(baseOrgPatientFollowDO.getId());
                }
            }
        }else{}
        }
    }
    
    public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
@ -5780,6 +5843,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
                    }
                    Map<String,Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                    //同步电子病历
                    WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
                    if (prescriptionEmrDO!=null){
                        writeOutPatient(outpatientDO.getRegisterNo(),prescriptionEmrDO.getComplaint(),prescriptionEmrDO.getMedicalHistory(),prescriptionEmrDO.getPastHistory(),prescriptionEmrDO.getPhysicalExamination(),prescriptionEmrDO.getAssistExamination());
                    }
                    if (map.get("code").toString().equalsIgnoreCase("0")){
                        //  * @param applyDepaName @param applyDoctorName
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
@ -5801,8 +5869,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if (patientMappingDO!=null){
                            userNo = patientMappingDO.getMappingCode();
                        }
                        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientCode,"1");
                        ylzPayService.msgPush("01",patientMedicareCardDO.getCode(),"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
                        String cardNo = null;
                        if (!StringUtils.isNoneBlank(outpatientDO.getCardNo())){
                            cardNo = outpatientDO.getCardNo();
                        }
                        ylzPayService.msgPush("01",cardNo,"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
                    }
                    //sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
@ -6172,7 +6243,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public String readOutPatientXml(String registerSn) throws Exception {
    public WlyyPrescriptionEmrDO readOutPatientXml(String registerSn) throws Exception {
        WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = new WlyyPrescriptionEmrDO();
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
        if (wlyyHospitalSysDictDO!=null){
@ -6181,7 +6253,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
                "<HtRequest>\n";
        xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
        xmlStr+="<SEARCH_IDS>CHIEF_COMPLAINT,HPI,ELAPSEMHIS,BODYCHECK,ASSISTANTCHECK</SEARCH_IDS>";
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss");
        xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
        xmlStr+="</HtRequest>";
        String returnValue = "";
@ -6197,8 +6270,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        XMLSerializer xmlSerializer = new XMLSerializer();
        net.sf.json.JSON json = xmlSerializer.read(returnValue);
        logger.info("返回json"+json);
        return json.toString();
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(json.toString());
        wlyyPrescriptionEmrDO.setComplaint(object.getString("CHIEF_COMPLAINT"));
        wlyyPrescriptionEmrDO.setMedicalHistory(object.getString("HPI"));
        wlyyPrescriptionEmrDO.setPastHistory(object.getString("ELAPSEMHIS"));
        wlyyPrescriptionEmrDO.setPhysicalExamination(object.getString("BODYCHECK"));
        wlyyPrescriptionEmrDO.setAssistExamination(object.getString("ASSISTANTCHECK"));
        return wlyyPrescriptionEmrDO;
    }
    public String writeOutPatient(String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck) throws Exception {
@ -6210,7 +6288,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
                "<HtRequest>\n";
        xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
        String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss");
        xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
        xmlStr+="<OUTPATIENT_INFO>";
        xmlStr+="<CHIEF_COMPLAINT>"+chiefComplaint+"</CHIEF_COMPLAINT>";
@ -6516,7 +6594,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public MixEnvelop selectByUrl(String prescriptionId,String wxId) throws Exception {
    public MixEnvelop selectByUrl(String oupatientId,String prescriptionId,String wxId) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wxId);
        if (wxWechatDO==null){
            throw new Exception("微信配置不存在!");
@ -6530,11 +6608,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            throw new Exception("openid不存在!");
        }
        BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",prescriptionDO.getPatientCode(),"1");
        if (patientMedicareCardDO==null){
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(oupatientId);
        String idcard=null;
        if (wlyyOutpatientDO!=null){
            idcard=wlyyOutpatientDO.getCardNo();
        }
        if (!StringUtils.isNoneBlank(idcard)){
            throw new Exception("就诊卡不存在!");
        }
        String url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),patientMedicareCardDO.getCode(),"WX");
        String url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),idcard,"WX");
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,object);
    }

+ 105 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
@ -24,6 +26,7 @@ import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -99,6 +102,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private YlzPayService ylzPayService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private EntranceService entranceService;
@ -512,6 +519,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            orderRefundDO.setStatus(2);
            orderRefundDO.setRefundTime(new Date());
            orderRefundDao.save(orderRefundDO);
            updatePayStatusByRefund(orderNo);
        }
        return map;
    }
@ -872,6 +880,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            orderRefundDO.setStatus(2);
            orderRefundDO.setRefundTime(new Date());
            orderRefundDao.save(orderRefundDO);
            updatePayStatusByRefund(orderNo);
        }
        return object;
@ -895,6 +904,32 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     *  退款修改状态
     * @param orderNo
     * @return
     */
    public BusinessOrderDO updatePayStatusByRefund(String orderNo) throws Exception {
        logger.info("入参:"+orderNo);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
            consultDo.setPayStatus(2);
            consultOrderDao.save(consultDo);
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(2);
            outpatientDao.save(wlyyOutpatientDO);
        }
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(9);
        businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
    }
    /**
     *
     * @param orderNo
@ -930,6 +965,41 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     *无需支付
     * @param relationCode
     * @return
     */
    public BusinessOrderDO updatePayStatusByRelation(String relationCode) throws Exception {
        logger.info("入参:"+relationCode);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
            consultDo.setPayStatus(1);
            consultOrderDao.save(consultDo);
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);
            outpatientDao.save(wlyyOutpatientDO);
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
            List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
            if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                wlyyPrescriptionDO.setPayStatus(1);
                prescriptionDao.save(wlyyPrescriptionDO);
                prescriptionLogService.addPrescriptionLog(businessOrderDO.getRelationCode(),30,1,businessOrderDO.getPatient(),businessOrderDO.getPatientName(),businessOrderDO.getDescription(),new Date());
            }
        }
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(1);
        businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
    }
    public JSONObject selectOrderTime(String relationCode){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("PAY_TIME");
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
@ -958,7 +1028,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @return
     * @throws Exception
     */
    public String ylzRechargeJson(String code,String depositType,String wechatId,String cardType,String cardNo) throws Exception {
    public String ylzRechargeJson(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag) throws Exception {
        String response = null;
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
@ -974,6 +1044,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                idcard = patientDO.getIdcard();
            }
            String openId = "";
            BaseDoctorDO doctorDO = doctorDao.findById(businessOrderDO.getDoctor());
            String fee = doctorDO.getFee();
            if (!StringUtils.isNoneBlank(fee)){
                throw new Exception("医生费用为空");
            }
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            Double doctorFee = Double.parseDouble(fee);
            Double balance = doctorFee-cardFee;
            businessOrderDO.setPayPrice(balance);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
@ -1005,4 +1086,27 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        return response;
    }
    /**
     * 咨询退费
     * @param consult
     * @return
     */
    public BusinessOrderDO consultRefund(String consult,String wxId) throws Exception {
        String base = hospitalSysDictDao.findByDictName("imData").get(0).getDictCode();
        String sql ="select id as \"id\",reply as \"reply\" from "+base+".topics where id='"+consult+"' AND (reply=0 OR reply IS NULL OR reply <>'')";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        logger.info("maplist"+mapList);
        if (mapList!=null&&mapList.size()!=0){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(consult);
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                this.orderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
            }else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                this.ylzOrderRefund(wxId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
            }
            return businessOrderDO;
        }
        return null;
    }
}

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

@ -1179,6 +1179,8 @@ public class ImService {
			ct.setEvaluate(0);
			// 医生未读数量为1
			ct.setDoctorRead(1);
			//添加就诊图片
			ct.setImages(wlyyOutpatientDO.getDiseaseImg());
			// 添加咨询记录
			ConsultDo consult = addConsult(ct.getPatient(), consultTitle, ct.getSymptoms(), ct.getImages(), ct.getType());
			// 设置关联指导
@ -1429,7 +1431,7 @@ public class ImService {
		if(cons.getRelationCode() != null){
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(cons.getRelationCode());
			if(wlyyOutpatientDO != null && wlyyOutpatientDO.getId() != null){
				wlyyOutpatientDO.setStatus("2");
				wlyyOutpatientDO.setStatus("3");
			}
			
			List<WlyyHospitalWaitingRoomDO> wlyyHospitalWaitingRoomDOS = hospitalWaitingRoomDao.findByOutpatientId(cons.getRelationCode());

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

@ -25,7 +25,7 @@ public abstract class IntegerIdentityEntity implements Serializable {
//==========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;

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

@ -399,6 +399,8 @@ public class BaseHospitalRequestMapping {
        public static final String selectOrderByRelationCode = "/selectOrderByRelationCode";
        public static final String ylzRechargeJson="ylzRechargeJson";
        public static final String ylzRefund = "/ylzRefund";
@ -446,6 +448,8 @@ public class BaseHospitalRequestMapping {
        public static final String selectByUrl="/selectByUrl";
        public static final String updatePayStatus = "/updatePayStatus";
    }

+ 2 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -467,7 +467,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        String loginType = getLogintype();
        List<WlyyUserSimple> users = null;
        logger.info("login:登录进入5");
        //1或默认查找user表,为平台管理员账号
        if (StringUtils.isBlank(loginType) || "1".equals(loginType)) {
            //更新登录时间
@ -488,6 +488,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
            this.getJdbcTemplate().update("update base_patient p set p.login_failure_count = 0, p.login_date = ? where p.mobile = ? or p.idcard = ?", new Date(), username, getIdcard());
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_IDCARD_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), getIdcard());
        }
        logger.info("login:登录进入6");
        return users;
    }

+ 5 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -160,6 +160,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @RequestMapping(value = "/oauth/login", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> login(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
        logger.info("login:登录进入1");
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
@ -168,6 +169,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                throw new ImgCaptchaException("img_captcha error");
            }
        }
        logger.info("login:登录进入2");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(username)) {
@ -191,11 +193,13 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        } else {
            parameters.put("grant_type", "captcha");
        }
        logger.info("login:登录进入3");
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        if (null == authenticatedClient) {
            throw new InvalidRequestException("client_id");
        }
        logger.info("login:登录进入4");
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
@ -224,6 +228,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        String wechatId = parameters.get("wechatId");
        logger.info("login:登录进入7");
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        logger.info("gengxin开始");

+ 2 - 2
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -158,8 +158,8 @@ public class OauthYlzConfigService {
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            logger.info("TransResponse:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS")+" "+rs);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
            JSONObject json =JSONObject.parseObject(rs);
            JSONObject biz = json.getJSONObject("biz_content");
            InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
            ByteToInputStream byteToInputStream = new ByteToInputStream();

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

@ -427,9 +427,11 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "全科医生等候协同门诊,排队数量", notes = "全科医生等候协同门诊,排队数量")
	public Envelop generalDoctorWaitingNumber(
			@ApiParam(name = "outpatientid", value = "就诊记录CODE")
			@RequestParam(value = "outpatientid",required = true) String outpatientid){
			@RequestParam(value = "outpatientid",required = true) String outpatientid,
			@ApiParam(name = "doctor", value = "医生code")
			@RequestParam(value = "doctor",required = true) String doctor){
		JSONObject result = new JSONObject();
		result.put("waitingNumber",1);
		result.put("waitingNumber",prescriptionService.generalDoctorWaitingNumber(doctor,wxId,outpatientid));
		return success("请求成功",result);
	}
	

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

@ -564,8 +564,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "patientCode", value = "居民COEE")
			@RequestParam(value = "patientCode",required = false) String patientCode
			) throws Exception {
		int resutl = imService.finish(consult,patientCode,1);
		
		//医生未回复可以退费
		try {
			businessOrderService.consultRefund(consult,wxId);
		}catch (Exception e){
			e.printStackTrace();
		}
		BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
		JSONObject msgObj = new JSONObject();
		msgObj.put("msg",basePatientDO.getName()+"结束了咨询");

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

@ -1197,6 +1197,30 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 易联众统一支付
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.ylzRechargeJson)
    @ApiOperation("统一支付--预交金支付")
    public ObjEnvelop ylzRechargeJson(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "depositType", value = "depositType", required = true)
            @RequestParam(required = true)String depositType,
            @ApiParam(name = "cardType", value = "cardType", required = true)
            @RequestParam(required = true)String cardType,
            @ApiParam(name = "cardNo", value = "cardNo", required = true)
            @RequestParam(required = true)String cardNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.ylzRechargeJson(relationCode,depositType,wxId,cardType,cardNo,demoFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
@ -1722,9 +1746,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("获取诊间支付url")
    public ObjEnvelop selectByUrl(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true)String prescriptionId) throws Exception {
            @RequestParam(required = true)String prescriptionId,
            @ApiParam(name = "oupatientId", value = "oupatientId", required = true)
            @RequestParam(required = true)String oupatientId) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrl(prescriptionId,wxId));
            return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrl(oupatientId,prescriptionId,wxId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -1737,4 +1763,16 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "patientCode", required = false) String patientCode) throws Exception {
      return   prescriptionService.findPatientOpenId(patientCode);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.updatePayStatus)
    @ApiOperation(value = "无需支付时调用")
    public ObjEnvelop updatePayStatus (
            @ApiParam(name = "relationCode", value = "业务code")
            @RequestParam(value = "relationCode", required = false) String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.updatePayStatusByRelation(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}