|  | @ -1,5 +1,6 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.hospital.endpoint.prescription;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.InspectionService;
 | 
	
	
		
			
				|  | @ -7,18 +8,27 @@ import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.PrescriptionService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.DoctorPreSignService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.service.ImService;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.org.BaseOrgVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.im.ConsultVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ListEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | 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;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import net.sf.json.JSONArray;
 | 
	
		
			
				|  |  | import net.sf.json.JSONObject;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
	
		
			
				|  | @ -51,9 +61,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DoctorPreSignService doctorPreSignService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HospitalSystemMessageService hospitalSystemMessageService;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ImService imService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${demo.flag}")
 | 
	
		
			
				|  |  |     private boolean demoFlag;
 | 
	
	
		
			
				|  | @ -240,14 +253,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |                                          @RequestParam(value = "registerJson", required = false)String registerJson,
 | 
	
		
			
				|  |  |                                          @ApiParam(name = "chargeType", value = "预约实体json")
 | 
	
		
			
				|  |  |                                          @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         //发送系统消息
 | 
	
		
			
				|  |  |         SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
 | 
	
		
			
				|  |  |         //发送IM消息
 | 
	
		
			
				|  |  |         hospitalSystemMessageService.sendImMessage(systemMessageDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -571,12 +584,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |                                             @ApiParam(name = "chargeType", value = "号别")
 | 
	
		
			
				|  |  |                                             @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
 | 
	
		
			
				|  |  |         WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         //构建系统消息
 | 
	
		
			
				|  |  |         SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
 | 
	
		
			
				|  |  |         //发送系统消息
 | 
	
		
			
				|  |  |         hospitalSystemMessageService.sendImMessage(systemMessageDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         return success(wlyyOutpatientDO);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -802,5 +815,62 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |                                     @RequestParam(value = "doctor",required = true) String doctor)throws Exception{
 | 
	
		
			
				|  |  |         return success("获取医生二维码成功",wlyyBusinessService.makeBase64Qrcode(doctor));
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @GetMapping(value = BaseHospitalRequestMapping.Prescription.doctorUpcomingList)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "医生待办事项列表")
 | 
	
		
			
				|  |  |     public Envelop doctorUpcomingList(@ApiParam(name = "doctorCode", value = "医生CODE")
 | 
	
		
			
				|  |  |                                       @RequestParam(value = "doctorCode",required = true) String doctorCode,
 | 
	
		
			
				|  |  |                                       @ApiParam(name = "type", value = "类型:1.视频复诊(16)、2.专科协同(12)、3.图文复诊(9)、4.专家咨询(1,15)")
 | 
	
		
			
				|  |  |                                       @RequestParam(value = "type",required = true) String type)throws Exception{
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
 | 
	
		
			
				|  |  |         List<ConsultVO> data = imService.doctorUpcomingList(doctorCode, type);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if (data != null) {
 | 
	
		
			
				|  |  |             for (ConsultVO consult : data) {
 | 
	
		
			
				|  |  |                 if (consult == null) {
 | 
	
		
			
				|  |  |                     continue;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                 json.put("id", consult.getId());
 | 
	
		
			
				|  |  |                 // 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
 | 
	
		
			
				|  |  |                 json.put("type", consult.getType());
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //                //如果是协同门诊,多返回全科医生的详细信息
 | 
	
		
			
				|  |  | //                if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
 | 
	
		
			
				|  |  | //                    BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
 | 
	
		
			
				|  |  | //                    json.put("generalDoctorName", baseDoctorDO.getName());
 | 
	
		
			
				|  |  | //                }
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |                 // 设置显示标题
 | 
	
		
			
				|  |  |                 json.put("title", consult.getTitle());
 | 
	
		
			
				|  |  |                 // 设置主诉
 | 
	
		
			
				|  |  |                 json.put("symptoms", consult.getSymptoms());
 | 
	
		
			
				|  |  |                 // 咨询状态
 | 
	
		
			
				|  |  |                 json.put("status", consult.getStatus());
 | 
	
		
			
				|  |  |                 // 设置咨询日期
 | 
	
		
			
				|  |  |                 json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
 | 
	
		
			
				|  |  |                 //是否评价
 | 
	
		
			
				|  |  |                 json.put("evaluate", consult.getEvaluate());
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |                 //患者ID
 | 
	
		
			
				|  |  |                 json.put("patientId", consult.getPatientId());
 | 
	
		
			
				|  |  |                 //患者性别
 | 
	
		
			
				|  |  |                 json.put("patientsex", consult.getPatientsex());
 | 
	
		
			
				|  |  |                 //患者姓名
 | 
	
		
			
				|  |  |                 json.put("patientName", consult.getPatientName());
 | 
	
		
			
				|  |  |                 //患者年龄
 | 
	
		
			
				|  |  |                 json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
 | 
	
		
			
				|  |  |                 //就诊记录ID
 | 
	
		
			
				|  |  |                 json.put("outpatientId", consult.getOutpatientid());
 | 
	
		
			
				|  |  |                 //图文或者视频类型
 | 
	
		
			
				|  |  |                 json.put("consultType", consult.getConsultType());
 | 
	
		
			
				|  |  |                 //诊断
 | 
	
		
			
				|  |  |                 json.put("icd10Name", consult.getIcd10Name());
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |                 array.add(json);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return success(array);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |