Browse Source

Merge branch 'dev' of huangwenjie/wlyy2.0 into dev

huangwenjie 5 years ago
parent
commit
d08eb2769e

+ 29 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -29,6 +29,8 @@ import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImageCompress;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
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.rm.base.BaseRequestMapping;
@ -37,6 +39,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
@ -55,6 +58,7 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import java.util.logging.Logger;
/**
 * IM接口业务类
@ -62,6 +66,9 @@ import java.util.*;
 */
@Service
public class ImService {
	
	private org.slf4j.Logger logger = LoggerFactory.getLogger(ImService.class);
	
	@Autowired
	public ConsultDao consultDao;
	
@ -1325,4 +1332,26 @@ public class ImService {
	public Integer sessionCountByType(String userid,Integer type,Integer status){
		return imUtil.sessionCountByType(userid,type,status);
	}
	
	/**
	 * 发送复诊诊断和药品消息
	 * @param wlyyPrescriptionVO
	 * @return
	 */
	public void pushPrescriptionImMessage(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception {
		
		//获取诊断
		List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = wlyyPrescriptionVO.getDiagnosisVOs();
		if(!wlyyPrescriptionDiagnosisVOS.isEmpty()){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "28", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
		}
		
		//获取药品
		List<WlyyPrescriptionInfoVO> infoVOs = wlyyPrescriptionVO.getInfoVOs();
		if(!infoVOs.isEmpty()){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "28", JSON.toJSONString(infoVOs),"1");
		}
	
	}
}

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

@ -292,14 +292,21 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patientCode",required = false) String patientCode
			) throws Exception {
		int resutl = imService.finish(consult,patientCode,1);
		BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
		
		BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
		JSONObject msgObj = new JSONObject();
		msgObj.put("msg",basePatientDO.getName()+"结束了咨询");
		msgObj.put("consultcode",consult);
		
		String jsonStr = "";
		
		String jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
		if(1 == resutl){
			jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
		}
//		else{
//			throw  new Exception("结束失败");
//		}
		return success(jsonStr);
	}