| 
															
																@ -69,6 +69,7 @@ import com.yihu.jw.restmodel.web.PageEnvelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
															 | 
															
															 | 
															
																import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.rm.iot.IotRequestMapping; 
															 | 
															
															 | 
															
																import com.yihu.jw.rm.iot.IotRequestMapping; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.common.IdCardUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.common.IdCardUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.util.common.LatitudeUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.date.DateUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.date.DateUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.utils.StringUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.utils.StringUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.utils.WebserviceUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.utils.WebserviceUtil; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -4709,13 +4710,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient){ 
															 | 
															
															 | 
															
																    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        SystemMessageDO systemMessageDO = new SystemMessageDO(); 
															 | 
															
															 | 
															
																        SystemMessageDO systemMessageDO = new SystemMessageDO(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String msg=""; 
															 | 
															
															 | 
															
																        String msg=""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String type=""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if("1".equals(outpatient.getType())){ 
															 | 
															
															 | 
															
																        if("1".equals(outpatient.getType())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            type="9"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            msg=outpatient.getPatientName()+",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
															 | 
															
															 | 
															
																            msg=outpatient.getPatientName()+",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        }else { 
															 | 
															
															 | 
															
																        }else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            type="16"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            msg=outpatient.getPatientName()+",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
															 | 
															
															 | 
															
																            msg=outpatient.getPatientName()+",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        systemMessageDO.setTitle("线上问诊支付提醒"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        systemMessageDO.setTitle("支付提醒"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        systemMessageDO.setType("11"); 
															 | 
															
															 | 
															
																        systemMessageDO.setType("11"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        systemMessageDO.setSender(outpatient.getDoctor()); 
															 | 
															
															 | 
															
																        systemMessageDO.setSender(outpatient.getDoctor()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        systemMessageDO.setSenderName(outpatient.getDoctorName()); 
															 | 
															
															 | 
															
																        systemMessageDO.setSenderName(outpatient.getDoctorName()); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -4730,6 +4734,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard())); 
															 | 
															
															 | 
															
																            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard())); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            data.put("question",outpatient.getDescription()); 
															 | 
															
															 | 
															
																            data.put("question",outpatient.getDescription()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            data.put("msg",msg); 
															 | 
															
															 | 
															
																            data.put("msg",msg); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            data.put("type",type); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            systemMessageDO.setData(data.toString()); 
															 | 
															
															 | 
															
																            systemMessageDO.setData(data.toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            systemMessageService.saveMessage(systemMessageDO); 
															 | 
															
															 | 
															
																            systemMessageService.saveMessage(systemMessageDO); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -5730,7 +5735,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setTitle("处方支付提醒"); 
															 | 
															
															 | 
															
																            messageDO.setTitle("处方支付提醒"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setSender(outpatientDO.getDoctor()); 
															 | 
															
															 | 
															
																            messageDO.setSender(outpatientDO.getDoctor()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setSenderName(outpatientDO.getDoctorName()); 
															 | 
															
															 | 
															
																            messageDO.setSenderName(outpatientDO.getDoctorName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setRelationCode(outpatientDO.getId()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            messageDO.setRelationCode(outpatientDO.getId()+","+wlyyPrescriptionDO.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setReceiver(outpatientDO.getPatient()); 
															 | 
															
															 | 
															
																            messageDO.setReceiver(outpatientDO.getPatient()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            messageDO.setReceiverName(outpatientDO.getPatientName()); 
															 | 
															
															 | 
															
																            messageDO.setReceiverName(outpatientDO.getPatientName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -6306,4 +6311,76 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																// 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,pagesize,count); 
															 | 
															
															 | 
															
																//        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,pagesize,count); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//    } 
															 | 
															
															 | 
															
																//    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 查询患者所有处方信息 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param page 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param size 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String uid = userAgent.getUID(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        StringBuffer sql = new StringBuffer("select a.* from wlyy_prescription a,wlyy_prescription_info b where a.patient_code ='"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        StringBuffer countSql = new StringBuffer("select COUNT(a.id) count from wlyy_prescription a,wlyy_prescription_info b  where a.patient_code ='"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        countSql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if (StringUtils.isNotEmpty(keyName)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql.append(" AND (" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " a.doctor_name LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR a.dept_name LIKE'%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR a.hospital_name LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR b.drug_name LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR a.real_order LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    ")"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            countSql.append(" AND (" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " a.doctor_name LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR a.dept_name LIKE'%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR a.hospital_name LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR b.drug_name LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    " OR a.real_order LIKE '%"+keyName+"%' " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    ")"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if (StringUtils.isNotEmpty(status)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            sql.append(" AND a.`status`=").append(status); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            countSql.append(" AND a.`status`=").append(status); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql.append(" order by a.prescribe_time limit ").append((page-1)*size).append(",").append(size); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<WlyyPrescriptionDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionDO.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        long count = Long.parseLong(mapList.get(0).get("count").toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        logger.info("sql="+sql.toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        logger.info("countSql="+countSql.toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 查询取药地址 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param outpatientId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param longitude 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param dimension 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public MixEnvelop findDrugAddress(String outpatientId, String longitude, String dimension) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String sql="SELECT\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\ta.*\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "FROM\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\tbase_org a\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "LEFT JOIN (\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\tSELECT\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\t\tc.*\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\tFROM\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\t\twlyy_prescription_expressage c\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "\tWHERE\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                " c.outpatient_id = '"+outpatientId+"'" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                " ) d ON a.`code` = d.hospital_code"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        BaseOrgDO baseOrgDO = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BaseOrgDO.class)).get(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Map<String, String> rs = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        rs.put("hospital",baseOrgDO.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        rs.put("address",baseOrgDO.getAddress()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String distance = LatitudeUtils.getDistance(longitude, dimension, baseOrgDO.getLongitude(), baseOrgDO.getLatitude()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        rs.put("distance",distance); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,rs); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																} 
															 | 
															
															 | 
															
																} 
															 |