|  | @ -5,10 +5,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorPatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.service.BaseDoctorInfoService;
 | 
	
		
			
				|  |  | 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.doctor.BaseDoctorPatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorVo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
	
		
			
				|  | @ -43,6 +46,7 @@ import com.yihu.jw.hospital.message.service.SystemMessageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.ykyy.service.YkyyService;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.BusinessOrderService;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderDao;
 | 
	
	
		
			
				|  | @ -52,6 +56,7 @@ import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.org.BaseOrgVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
 | 
	
	
		
			
				|  | @ -59,7 +64,10 @@ import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.PageEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.iot.IotRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.StringUtil;
 | 
	
	
		
			
				|  | @ -195,6 +203,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     private PrescriptionEmrDao prescriptionEmrDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyConsultAdviceDao wlyyConsultAdviceDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoctorPatientDao baseDoctorPatientDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseUserAgent userAgent;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyHospitalSysDictDao hospitalSysDictDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
	
		
			
				|  | @ -2043,7 +2056,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 result.put("mes", "诊断完成");
 | 
	
		
			
				|  |  |                 return result;
 | 
	
		
			
				|  |  |             }else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
 | 
	
		
			
				|  |  |                 Double price =  prescription.getDrugFee();
 | 
	
		
			
				|  |  |                 Double price = 0.01;
 | 
	
		
			
				|  |  |                 businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
 | 
	
		
			
				|  |  |                 //上传his开方
 | 
	
		
			
				|  |  |                 //sendHisDiagnosis(jsonData, outpatientDO, prescription)
 | 
	
	
		
			
				|  | @ -2998,9 +3011,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | //            //协同门诊量
 | 
	
		
			
				|  |  | //            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
 | 
	
		
			
				|  |  | //            rs.put("coordinationCout",coordinationCout);
 | 
	
		
			
				|  |  |             //医生关注
 | 
	
		
			
				|  |  |             List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |             if (doctorPatientFollowDOS!=null&&doctorPatientFollowDOS.size()>0){
 | 
	
		
			
				|  |  |                 rs.put("attention","1");
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 rs.put("attention","0");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             //专家咨询
 | 
	
		
			
				|  |  |             String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
 | 
	
	
		
			
				|  | @ -3678,7 +3697,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String patientid,String orgCode, String dept,
 | 
	
		
			
				|  |  |                                                                           String diseaseKey, String doctorNameKey,
 | 
	
		
			
				|  |  |                                                                           String jobTitleNameKey, String outpatientType,
 | 
	
		
			
				|  |  |                                                                           String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
 | 
	
		
			
				|  |  |                                                                           String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,String isAttention,Integer page,Integer pagesize) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |       /*  if(page >=1){
 | 
	
		
			
				|  |  |             page --;
 | 
	
	
		
			
				|  | @ -3702,14 +3721,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 " d.outpatient_type AS \"outpatientType\"," +
 | 
	
		
			
				|  |  |                 " a.total AS \"consultTotal\"," +
 | 
	
		
			
				|  |  |                 " h.org_name AS \"orgName\"," +
 | 
	
		
			
				|  |  |                 " follow.patient AS \"followid\"," +
 | 
	
		
			
				|  |  |                 " h.org_code AS \"orgCode\"" +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " base_doctor d " +
 | 
	
		
			
				|  |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
 | 
	
		
			
				|  |  |                 " Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient='"+patientid+"'"+
 | 
	
		
			
				|  |  |                 " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if ("1".equalsIgnoreCase(isAttention)){
 | 
	
		
			
				|  |  |             sql+=" join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='"+patientid+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("0".equalsIgnoreCase(isAttention)) {
 | 
	
		
			
				|  |  |             sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(diseaseKey)){
 | 
	
		
			
				|  |  |             sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -4051,43 +4074,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address,String photo,String mobile){
 | 
	
		
			
				|  |  |     public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(name)){
 | 
	
		
			
				|  |  |             basePatientDO.setName(name);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(idcard)){
 | 
	
		
			
				|  |  |             basePatientDO.setIdcard(idcard);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (sex!=null){
 | 
	
		
			
				|  |  |             basePatientDO.setSex(sex);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(townCode)){
 | 
	
		
			
				|  |  |             basePatientDO.setTownCode(townCode);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(townName)){
 | 
	
		
			
				|  |  |             basePatientDO.setTownName(townName);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(committeeCode)){
 | 
	
		
			
				|  |  |             basePatientDO.setCommitteeCode(committeeCode);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(committeeName)){
 | 
	
		
			
				|  |  |             basePatientDO.setCommitteeName(committeeName);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(address)){
 | 
	
		
			
				|  |  |             basePatientDO.setAddress(address);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(photo)){
 | 
	
		
			
				|  |  |             basePatientDO.setPhoto(photo);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(mobile)){
 | 
	
		
			
				|  |  |             basePatientDO.setMobile(mobile);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         basePatientDO.setName(name);
 | 
	
		
			
				|  |  |         basePatientDO.setIdcard(idcard);
 | 
	
		
			
				|  |  |         basePatientDO.setSex(sex);
 | 
	
		
			
				|  |  |         basePatientDO.setTownCode(townCode);
 | 
	
		
			
				|  |  |         basePatientDO.setTownName(townName);
 | 
	
		
			
				|  |  |         basePatientDO.setCommitteeCode(committeeCode);
 | 
	
		
			
				|  |  |         basePatientDO.setCommitteeName(committeeName);
 | 
	
		
			
				|  |  |         basePatientDO.setAddress(address);
 | 
	
		
			
				|  |  |         basePatientDO = basePatientDao.save(basePatientDO);
 | 
	
		
			
				|  |  |         if (patientMedicareCardDO!=null){
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setCode(ssc);
 | 
	
	
		
			
				|  | @ -4652,9 +4650,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 if("1".equals(outpatient.getType())){
 | 
	
		
			
				|  |  |                     systemMessageDO.setTitle("图文复诊");
 | 
	
		
			
				|  |  |                     systemMessageDO.setType("1");
 | 
	
		
			
				|  |  |                     saveInquirySystemMessage(outpatient);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     systemMessageDO.setTitle("视频复诊");
 | 
	
		
			
				|  |  |                     systemMessageDO.setTitle("视频复诊预约成功");
 | 
	
		
			
				|  |  |                     systemMessageDO.setType("2");
 | 
	
		
			
				|  |  |                     saveInquirySystemMessage(outpatient);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             systemMessageDO.setReceiver(outpatient.getDoctor());
 | 
	
	
		
			
				|  | @ -4669,6 +4669,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
 | 
	
		
			
				|  |  |             data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
 | 
	
		
			
				|  |  |             data.put("question",outpatient.getDescription());
 | 
	
		
			
				|  |  |             String msg="您的视频复诊已预约成功。\n" +
 | 
	
		
			
				|  |  |                     "预计"+outpatient.getDoctorName()+"医生将于"+outpatient.getRegisterDate()+" 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
 | 
	
		
			
				|  |  |             data.put("msg",msg);
 | 
	
		
			
				|  |  |             systemMessageDO.setData(data.toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             systemMessageService.saveMessage(systemMessageDO);
 | 
	
	
		
			
				|  | @ -4680,6 +4683,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return systemMessageDO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void saveInquirySystemMessage(WlyyOutpatientDO outpatient){
 | 
	
		
			
				|  |  |         SystemMessageDO systemMessageDO = new SystemMessageDO();
 | 
	
		
			
				|  |  |         String msg="";
 | 
	
		
			
				|  |  |         if("1".equals(outpatient.getType())){
 | 
	
		
			
				|  |  |             msg=outpatient.getPatientName()+",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             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);
 | 
	
		
			
				|  |  |             systemMessageDO.setData(data.toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             systemMessageService.saveMessage(systemMessageDO);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 指定门诊医生医生
 | 
	
		
			
				|  |  |      * @param outpatientJson
 | 
	
	
		
			
				|  | @ -5612,11 +5648,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if (status==2){
 | 
	
		
			
				|  |  |             /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
 | 
	
		
			
				|  |  |             logger.info("开始====="+wlyyPrescriptionDO.getCheckStatus());
 | 
	
		
			
				|  |  |             WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |             if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
 | 
	
		
			
				|  |  |                     List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
 | 
	
		
			
				|  |  |                     WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |                     DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     //his处方拼接开方条件
 | 
	
	
		
			
				|  | @ -5625,7 +5661,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                         //设置his药品查询条件
 | 
	
		
			
				|  |  |                         setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, info, outpatientDO.getIcd10());
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     for (WlyyInspectionDO ins:inspectionDOS){
 | 
	
		
			
				|  |  |                         //设置his药品查询条件
 | 
	
		
			
				|  |  |                         setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
 | 
	
	
		
			
				|  | @ -5655,6 +5690,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                         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");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 } catch (Exception e) {
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
	
		
			
				|  | @ -5663,6 +5700,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckStatus(2);
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckReason(reason);
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setStatus(20);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //发送系统消息 处方支付提醒
 | 
	
		
			
				|  |  |             SystemMessageDO messageDO = new SystemMessageDO();
 | 
	
		
			
				|  |  |             messageDO.setType("6");
 | 
	
		
			
				|  |  |             messageDO.setTitle("处方支付提醒");
 | 
	
		
			
				|  |  |             messageDO.setSender(outpatientDO.getDoctor());
 | 
	
		
			
				|  |  |             messageDO.setSenderName(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |             messageDO.setRelationCode(outpatientDO.getId());
 | 
	
		
			
				|  |  |             messageDO.setReceiver(outpatientDO.getPatient());
 | 
	
		
			
				|  |  |             messageDO.setReceiverName(outpatientDO.getPatientName());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             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()));
 | 
	
		
			
				|  |  |                 data.put("question","");
 | 
	
		
			
				|  |  |                 String msg=outpatientDO.getPatientName()+",您好!医生已为您开具处方,请及时支付。如您已支付请忽略本条信息。";
 | 
	
		
			
				|  |  |                 data.put("msg",msg);
 | 
	
		
			
				|  |  |                 messageDO.setData(data.toString());
 | 
	
		
			
				|  |  |                 systemMessageService.saveMessage(messageDO);
 | 
	
		
			
				|  |  |             } catch (Exception e) {
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckStatus(status);
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckReason(reason);
 | 
	
	
		
			
				|  | @ -5672,6 +5734,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if (status==2||status==1){
 | 
	
		
			
				|  |  |             sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return prescriptionCheckDO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5929,7 +5993,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 保存排班规则
 | 
	
		
			
				|  |  |      * @param
 | 
	
		
			
				|  |  |      * @param advicesJson
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Boolean sendOutPatientSuggest(String advicesJson){
 | 
	
	
		
			
				|  | @ -6020,4 +6084,203 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 关注医生
 | 
	
		
			
				|  |  |      * @param doctorId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  | //    public Envelop attentionDoctor(String doctorId){
 | 
	
		
			
				|  |  | //        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
 | 
	
		
			
				|  |  | //        if (doctorDO==null){
 | 
	
		
			
				|  |  | //            return Envelop.getError("医生不存在");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        BaseDoctorPatientDO doctorPatientDO = new BaseDoctorPatientDO();
 | 
	
		
			
				|  |  | //        doctorPatientDO.setDoctorCode(doctorId);
 | 
	
		
			
				|  |  | //        doctorPatientDO.setDoctorName(doctorDO.getName());
 | 
	
		
			
				|  |  | //        String uid = userAgent.getUID();
 | 
	
		
			
				|  |  | //        BasePatientDO patientDO = basePatientDao.findById(uid);
 | 
	
		
			
				|  |  | //        if (patientDO==null){
 | 
	
		
			
				|  |  | //            return ObjEnvelop.getError("患者不存在");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        doctorPatientDO.setPatientCode(uid);
 | 
	
		
			
				|  |  | //        doctorPatientDO.setPatientName(patientDO.getName());
 | 
	
		
			
				|  |  | //        doctorPatientDO.setStatus(1);
 | 
	
		
			
				|  |  | //        baseDoctorPatientDao.save(doctorPatientDO);
 | 
	
		
			
				|  |  | //        return ObjEnvelop.getSuccess("关注成功");
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *查询患者关注的医生
 | 
	
		
			
				|  |  |      * @param keyWord
 | 
	
		
			
				|  |  |      * @param outPatient
 | 
	
		
			
				|  |  |      * @param jobTitleCode
 | 
	
		
			
				|  |  |      * @param shift
 | 
	
		
			
				|  |  |      * @param page
 | 
	
		
			
				|  |  |      * @param pagesize
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  | //    public PageEnvelop findAllAttentionDoctor(String keyWord, Integer outPatient, String jobTitleCode, Integer shift, Integer page, Integer pagesize) {
 | 
	
		
			
				|  |  | //        StringBuffer sql = new StringBuffer("SELECT DISTINCT\n" +
 | 
	
		
			
				|  |  | //                "\tc.*, e.org_name,\n" +
 | 
	
		
			
				|  |  | //                "\te.dept_name,\n" +
 | 
	
		
			
				|  |  | //                "\tIFNULL(k.disease_name,NULL)\n" +
 | 
	
		
			
				|  |  | //                "\tdisease_name\n" +
 | 
	
		
			
				|  |  | //                "FROM\n" +
 | 
	
		
			
				|  |  | //                "\tbase_doctor c\n" +
 | 
	
		
			
				|  |  | //                "RIGHT JOIN (\n" +
 | 
	
		
			
				|  |  | //                "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                "\t\tdoctor_code\n" +
 | 
	
		
			
				|  |  | //                "\tFROM\n" +
 | 
	
		
			
				|  |  | //                "\t\tbase_doctor_paitent\n" +
 | 
	
		
			
				|  |  | //                "\tWHERE\n" + " patient_code = '"+userAgent.getUID()+"'\n" +
 | 
	
		
			
				|  |  | //                " ) d ON c.id = d.doctor_code\n" +
 | 
	
		
			
				|  |  | //                "LEFT JOIN (\n" +
 | 
	
		
			
				|  |  | //                "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                "\t\t*\n" +
 | 
	
		
			
				|  |  | //                "\tFROM\n" +
 | 
	
		
			
				|  |  | //                "\t\twlyy_doctor_special_disease\n" +
 | 
	
		
			
				|  |  | //                ") k ON k.doctor_code = c.id\n" +
 | 
	
		
			
				|  |  | //                "LEFT JOIN (\n" +
 | 
	
		
			
				|  |  | //                "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                "\t\t*\n" +
 | 
	
		
			
				|  |  | //                "\tFROM\n" +
 | 
	
		
			
				|  |  | //                "\t\tbase_doctor_hospital\n" +
 | 
	
		
			
				|  |  | //                ") e ON e.doctor_code = c.id");
 | 
	
		
			
				|  |  | //        StringBuffer countSql = new StringBuffer("SELECT DISTINCT\n" +
 | 
	
		
			
				|  |  | //                "\tc.*, e.org_name,\n" +
 | 
	
		
			
				|  |  | //                "\te.dept_name,\n" +
 | 
	
		
			
				|  |  | //                "\tk.disease_name\n" +
 | 
	
		
			
				|  |  | //                "FROM\n" +
 | 
	
		
			
				|  |  | //                "\tbase_doctor c\n" +
 | 
	
		
			
				|  |  | //                "RIGHT JOIN (\n" +
 | 
	
		
			
				|  |  | //                "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                "\t\tdoctor_code\n" +
 | 
	
		
			
				|  |  | //                "\tFROM\n" +
 | 
	
		
			
				|  |  | //                "\t\tbase_doctor_paitent\n" +
 | 
	
		
			
				|  |  | //                "\tWHERE\n" + " patient_code = '"+userAgent.getUID()+"'\n" +
 | 
	
		
			
				|  |  | //                " ) d ON c.id = d.doctor_code\n" +
 | 
	
		
			
				|  |  | //                "LEFT JOIN (\n" +
 | 
	
		
			
				|  |  | //                "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                "\t\t*\n" +
 | 
	
		
			
				|  |  | //                "\tFROM\n" +
 | 
	
		
			
				|  |  | //                "\t\twlyy_doctor_special_disease\n" +
 | 
	
		
			
				|  |  | //                ") k ON k.doctor_code = c.id\n" +
 | 
	
		
			
				|  |  | //                "LEFT JOIN (\n" +
 | 
	
		
			
				|  |  | //                "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                "\t\t*\n" +
 | 
	
		
			
				|  |  | //                "\tFROM\n" +
 | 
	
		
			
				|  |  | //                "\t\tbase_doctor_hospital\n" +
 | 
	
		
			
				|  |  | //                ") e ON e.doctor_code = c.id");
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        if (shift==1){
 | 
	
		
			
				|  |  | //            sql.append(" JOIN (\n" +
 | 
	
		
			
				|  |  | //                    "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                    "\t\t*\n" +
 | 
	
		
			
				|  |  | //                    "\tFROM\n" +
 | 
	
		
			
				|  |  | //                    "\t\tbase_doctor_hospital\n" +
 | 
	
		
			
				|  |  | //                    "\tWHERE\n" +
 | 
	
		
			
				|  |  | //                    "\t\tdept_name = '发热门诊'\n" +
 | 
	
		
			
				|  |  | //                    ") h ON h.doctor_code = c.id ");
 | 
	
		
			
				|  |  | //            countSql.append(" JOIN (\n" +
 | 
	
		
			
				|  |  | //                    "\tSELECT\n" +
 | 
	
		
			
				|  |  | //                    "\t\t*\n" +
 | 
	
		
			
				|  |  | //                    "\tFROM\n" +
 | 
	
		
			
				|  |  | //                    "\t\tbase_doctor_hospital\n" +
 | 
	
		
			
				|  |  | //                    "\tWHERE\n" +
 | 
	
		
			
				|  |  | //                    "\t\tdept_name = '发热门诊'\n" +
 | 
	
		
			
				|  |  | //                    ") h ON h.doctor_code = c.id ");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        if (StringUtils.isNotEmpty(jobTitleCode)){
 | 
	
		
			
				|  |  | //            sql.append(" AND c.job_title_code =").append(jobTitleCode);
 | 
	
		
			
				|  |  | //            countSql.append(" AND c.job_title_code =").append(jobTitleCode);
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        if (outPatient==1){
 | 
	
		
			
				|  |  | //            sql.append(" JOIN (\n" +
 | 
	
		
			
				|  |  | //                    "\tSELECT DISTINCT\n" +
 | 
	
		
			
				|  |  | //                    "\t\t*\n" +
 | 
	
		
			
				|  |  | //                    "\tFROM\n" +
 | 
	
		
			
				|  |  | //                    "\t\twlyy_doctor_work_time\n" +
 | 
	
		
			
				|  |  | //                    "\tGROUP BY\n" +
 | 
	
		
			
				|  |  | //                    "\t\tdoctor\n" +
 | 
	
		
			
				|  |  | //                    ") f ON f.doctor = c.id");
 | 
	
		
			
				|  |  | //            countSql.append(" JOIN (\n" +
 | 
	
		
			
				|  |  | //                    "\tSELECT DISTINCT\n" +
 | 
	
		
			
				|  |  | //                    "\t\t*\n" +
 | 
	
		
			
				|  |  | //                    "\tFROM\n" +
 | 
	
		
			
				|  |  | //                    "\t\twlyy_doctor_work_time\n" +
 | 
	
		
			
				|  |  | //                    "\tGROUP BY\n" +
 | 
	
		
			
				|  |  | //                    "\t\tdoctor\n" +
 | 
	
		
			
				|  |  | //                    ") f ON f.doctor = c.id");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        if(StringUtils.isNotEmpty(keyWord)){
 | 
	
		
			
				|  |  | //            sql.append(" WHERE\n" +
 | 
	
		
			
				|  |  | //                    "\t(\n" +
 | 
	
		
			
				|  |  | //                    " c.`name` LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR e.dept_name LIKE '%"+keyWord+"%' " +
 | 
	
		
			
				|  |  | //                    " OR e.org_name LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR c.expertise LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR c.introduce LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR k.disease_name LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    ") ");
 | 
	
		
			
				|  |  | //            countSql.append(" WHERE\n" +
 | 
	
		
			
				|  |  | //                    "\t(\n" +
 | 
	
		
			
				|  |  | //                    " c.`name` LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR e.dept_name LIKE '%"+keyWord+"%' " +
 | 
	
		
			
				|  |  | //                    " OR e.org_name LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR c.expertise LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR c.introduce LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    " OR k.disease_name LIKE  '%"+keyWord+"%'" +
 | 
	
		
			
				|  |  | //                    ") ");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        countSql.append(" GROUP BY c.id");
 | 
	
		
			
				|  |  | //        List<Map<String, Object>> countList = jdbcTemplate.queryForList(countSql.toString());
 | 
	
		
			
				|  |  | //        long count=countList.size();
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        sql.append(" ORDER BY C.update_time LIMIT ").append((page-1)*pagesize).append(",").append(pagesize);
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
 | 
	
		
			
				|  |  | //        List<BaseDoctorVO> list = new ArrayList<>();
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        mapList.forEach(one->{
 | 
	
		
			
				|  |  | //            String json = com.alibaba.fastjson.JSONObject.toJSONString(one);
 | 
	
		
			
				|  |  | //            BaseDoctorDO doctorDO = com.alibaba.fastjson.JSONObject.parseObject(json, BaseDoctorDO.class);
 | 
	
		
			
				|  |  | //            BaseDoctorVO doctorVO = convertToModel(doctorDO, BaseDoctorVO.class);
 | 
	
		
			
				|  |  | //            if (one.get("org_name")!=null&&StringUtils.isNotEmpty(one.get("org_name").toString())){
 | 
	
		
			
				|  |  | //                doctorVO.setHospital(one.get("org_name").toString());
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //            if(one.get("dept_name")!=null&&StringUtils.isNotEmpty(one.get("dept_name").toString())){
 | 
	
		
			
				|  |  | //                ArrayList<String> deptList = new ArrayList<>();
 | 
	
		
			
				|  |  | //                deptList.add(one.get("dept_name").toString());
 | 
	
		
			
				|  |  | //                doctorVO.setDepartment(deptList);
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //            if (one.get("disease_name")!=null&&StringUtils.isNotEmpty(one.get("disease_name").toString())){
 | 
	
		
			
				|  |  | //                ArrayList<String> disList = new ArrayList<>();
 | 
	
		
			
				|  |  | //                disList.add(one.get("disease_name").toString());
 | 
	
		
			
				|  |  | //                doctorVO.setDisease(disList);
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  | //                list.forEach(tow->{
 | 
	
		
			
				|  |  | //                    if (doctorVO.getId().equalsIgnoreCase(tow.getId())){
 | 
	
		
			
				|  |  | //                        if (tow.getDepartment()!=null&&StringUtils.isNotEmpty(tow.getDepartment().get(0))){
 | 
	
		
			
				|  |  | //                            doctorVO.getDepartment().add(tow.getDepartment().get(0));
 | 
	
		
			
				|  |  | //                        }
 | 
	
		
			
				|  |  | //                        if (tow.getDisease()!=null&&StringUtils.isNotEmpty(tow.getDisease().get(0))){
 | 
	
		
			
				|  |  | //                            doctorVO.getDisease().add(tow.getDisease().get(0));
 | 
	
		
			
				|  |  | //                        }
 | 
	
		
			
				|  |  | //                        list.remove(tow);
 | 
	
		
			
				|  |  | //                    }
 | 
	
		
			
				|  |  | //                });
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            list.add(doctorVO);
 | 
	
		
			
				|  |  | //        });
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,pagesize,count);
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | }
 |