Browse Source

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
#	svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
mengkang 4 years ago
parent
commit
10a42d4a16

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

@ -4733,6 +4733,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            systemMessageService.saveMessage(systemMessageDO);
            BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                ykyyService.pushNotificationToYktPatient(patient.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString());
            }
        }catch (Exception e){
            logger.error("sendOutPatientMes :"+e.toString());
            return null;
@ -4769,11 +4775,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            data.put("msg",msg);
            data.put("type",type);
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        } catch (Exception e) {
            e.printStackTrace();
        }
        BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            ykyyService.pushNotificationToYktPatient(patient.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString());
        }
    }
@ -5771,9 +5780,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            messageDO.setRelationCode(outpatientDO.getId()+","+wlyyPrescriptionDO.getId());
            messageDO.setReceiver(outpatientDO.getPatient());
            messageDO.setReceiverName(outpatientDO.getPatientName());
            JSONObject data = new JSONObject();
            try {
                JSONObject data = new JSONObject();
                data.put("name",outpatientDO.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatientDO.getIdcard()));
                data.put("gender",IdCardUtil.getSexForIdcard_new(outpatientDO.getIdcard()));
@ -5782,9 +5790,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                data.put("msg",msg);
                messageDO.setData(data.toString());
                systemMessageService.saveMessage(messageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
            BasePatientDO patient = basePatientDao.findById(outpatientDO.getPatient());
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
            }
        }else{
            wlyyPrescriptionDO.setCheckStatus(status);
@ -6453,6 +6466,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("address",baseOrgDO.getAddress());
        String distance = LatitudeUtils.getDistance(longitude, dimension, baseOrgDO.getLongitude(), baseOrgDO.getLatitude());
        rs.put("distance",distance);
        rs.put("longitude",baseOrgDO.getLongitude());
        rs.put("dimension",baseOrgDO.getLatitude());
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,rs);
    }
@ -6479,4 +6494,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,object);
    }
    /**
     * 获取居民openId
     * @param patientCode
     * @return
     */
    public MixEnvelop findPatientOpenId(String patientCode) {
        BasePatientWechatDo basePatientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId, patientCode).get(0);
        if (basePatientWechatDo==null){
            return MixEnvelop.getError("居民不存在");
        }
        String openid = basePatientWechatDo.getOpenid();
        if (StringUtils.isEmpty(openid)){
            return MixEnvelop.getError("居民openID不存在");
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,openid);
    }
}

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -526,8 +526,8 @@ public class YkyyService {
    /**
     * 推送眼科通居民消息
     * @param patientId 眼科通id对应patient表里的yktId
     * @param attach
     * @param pushcontent
     * @param attach 标题
     * @param pushcontent  内容
     * @return
     */
    public String pushNotificationToYktPatient(String patientId,String attach,String pushcontent){

+ 55 - 42
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -29,6 +29,7 @@ import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.dao.ConsultTeamDoctorDao;
@ -119,6 +120,9 @@ public class ImService {
	
	@Autowired
	public WxAccessTokenService wxAccessTokenService;
	@Autowired
	private YkyyService ykyyService;
	
	@Value("${im.data_base_name}")
	private String data_base_name;
@ -1352,48 +1356,7 @@ public class ImService {
//		String response = imUtil.sendTopicIM(consultTeam.getDoctor(), doctor.getName(), consult, "28", evalueContent.toString(),null);
//		String response = imUtil.sendImMsg(consultTeam.getDoctor(), doctor.getName(), session_id, "28", evalueContent.toString(),null);
		//保存系统消息服务评价
		SystemMessageDO messageDO = new SystemMessageDO();
		messageDO.setType("10");
		messageDO.setTitle("服务评价");
		messageDO.setSender(doctor.getId());
		messageDO.setSenderName(doctor.getName());
		messageDO.setRelationCode(consult);
		messageDO.setReceiver(patient.getId());
		messageDO.setReceiverName(patient.getName());
		net.sf.json.JSONObject data = new net.sf.json.JSONObject();
		data.put("name",patient.getName());
		data.put("age",IdCardUtil.getAgeForIdcard(patient.getIdcard()));
		data.put("gender",patient.getSex().toString());
		data.put("question",consultTeam.getSymptoms());
		if (cons.getType()!=null&&1==cons.getType()){
			String msg =patient.getName()+ ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","1");
		}
		if (cons.getType()!=null&&9==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","9");
		}
		if (cons.getType()!=null&&16==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","16");
		}
		if (cons.getType()!=null&&17==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","17");
		}
		messageDO.setData(data.toString());
		try {
			systemMessageService.saveMessage(messageDO);
		} catch (Exception e) {
			e.printStackTrace();
		}
		systemMsgEvaluation(doctor,patient,cons,consultTeam,consult,wxId);
		String endName = "";
		String endId = "";
@ -1480,6 +1443,56 @@ public class ImService {
		return 1;
	}
	public void systemMsgEvaluation(BaseDoctorDO doctor,BasePatientDO patient,ConsultDo cons,ConsultTeamDo consultTeam ,String consult,String wxId){
		SystemMessageDO messageDO = new SystemMessageDO();
		messageDO.setType("10");
		messageDO.setTitle("服务评价");
		messageDO.setSender(doctor.getId());
		messageDO.setSenderName(doctor.getName());
		messageDO.setRelationCode(consult);
		messageDO.setReceiver(patient.getId());
		messageDO.setReceiverName(patient.getName());
		net.sf.json.JSONObject data = new net.sf.json.JSONObject();
		data.put("name",patient.getName());
		data.put("age",IdCardUtil.getAgeForIdcard(patient.getIdcard()));
		data.put("gender",patient.getSex().toString());
		data.put("question",consultTeam.getSymptoms());
		if (cons.getType()!=null&&1==cons.getType()){
			String msg =patient.getName()+ ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","1");
		}
		if (cons.getType()!=null&&9==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","9");
		}
		if (cons.getType()!=null&&16==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","16");
		}
		if (cons.getType()!=null&&17==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","17");
		}
		messageDO.setData(data.toString());
		try {
			systemMessageService.saveMessage(messageDO);
		} catch (Exception e) {
			e.printStackTrace();
		}
		if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
			ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
		}
	}
	
	/**
	 * 根据咨询CODE获取session_id

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

@ -442,6 +442,7 @@ public class BaseHospitalRequestMapping {
        public static final String findCommity="/findCommity";
        public static final String findProvince="/findProvince";
        public static final String findCity="/findCity";
        public static final String findPatientOpenId="/findPatientOpenId";
        public static final String selectByUrl="/selectByUrl";

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/sync/BaseSyncDataEndpoint.java

@ -48,7 +48,7 @@ public class BaseSyncDataEndpoint  extends EnvelopRestEndpoint {
                                           @RequestParam(value = "size") Integer size){
        try {
            return   baseSyncDataService.findAllSyncData(startTime,endTime,page,size);
            return   baseSyncDataService.findAllSyncData(startTime,endTime,page,size,wxId);
        }catch (Exception e){
            return PageEnvelop.getError(e.getMessage(),-1);
        }

+ 27 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java

@ -69,20 +69,44 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
    public PageEnvelop findAllSyncData(String startTime, String endTime,Integer page,Integer size,String wechatId) {
        StringBuffer sql= new StringBuffer("SELECT c.* FROM wlyy_data_sync c WHERE 1=1 ");
        StringBuffer sqlCount= new StringBuffer("SELECT COUNT(c.id) count FROM wlyy_data_sync c WHERE 1=1  ");
        StringBuffer sqlCount= new StringBuffer();
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sqlCount.append("SELECT COUNT(c.\"id\") AS count FROM wlyy_data_sync c WHERE 1=1  ");
        }else {
            sqlCount.append("SELECT COUNT(c.id) AS count FROM wlyy_data_sync c WHERE 1=1  ");
        }
        if (StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime)){
            sql.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
            sqlCount.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
        }
        List<BaseSyncDataDO> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql+=sql;
            oracleSql+="ORDER BY c.\"create_time\" DESC";
            oracleSql+="\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <="+page*size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= "+(page-1)*size;
            logger.info("oracleSql="+oracleSql);
            list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(BaseSyncDataDO.class));
        }else {
            sql.append(" ORDER BY c.create_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
            logger.info("sql="+sql);
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(BaseSyncDataDO.class));
        }
        logger.info("sqlCount="+sqlCount);
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());

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

@ -14,6 +14,7 @@ import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
@ -97,7 +98,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private ConsultDao consultDao;
	
	@Autowired
	private YkyyService ykyyService;
	@Value("${fastDFS.fastdfs_file_url}")
	private String fastdfs_file_url;
	
@ -440,6 +444,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				data.put("msg",msg);
				systemMessageDO.setData(data.toString());
				systemMessageService.saveMessage(systemMessageDO);
				BasePatientDO patientDO = basePatientDao.findById(patient);
				if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
					ykyyService.pushNotificationToYktPatient(patientDO.getYktId(),systemMessageDO.getTitle(),data.get("msg").toString());
				}
			}
			//发送系统消息

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

@ -34,12 +34,9 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -1732,4 +1729,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientOpenId)
    @ApiOperation(value = "获取居民OpenId")
    public MixEnvelop findCity (
            @ApiParam(name = "patientCode", value = "居民code")
            @RequestParam(value = "patientCode", required = false) String patientCode) throws Exception {
      return   prescriptionService.findPatientOpenId(patientCode);
    }
}