| 
					
				 | 
			
			
				@ -31,15 +31,11 @@ import com.yihu.jw.hospital.prescription.dao.OutpatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.PrescriptionDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.ykyy.service.YkyyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.base.BaseRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.util.http.HttpClientUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -48,7 +44,6 @@ import com.yihu.jw.utils.hibernate.HibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.utils.network.HttpResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.utils.network.HttpUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.utils.security.MD5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.ylzinfo.ehc.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.Logger; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -58,7 +53,6 @@ import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.transaction.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -136,6 +130,9 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DictDoctorDutyDao dictDoctorDutyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YkyyService ykyyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return hibenateUtils.createSQLQuery(sql,params,page,size); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -477,16 +474,6 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String mappingCode = jsonObject.getString("DOCTORCODE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctorMappingDO.setMappingCode(mappingCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctorMappingDao.save(doctorMappingDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDO.setIntroduce(jsonObject.getString("DETAIL")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDO.setExpertise(jsonObject.getString("MAJOR")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String jobTitle = jsonObject.getString("LEVELNAME"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDO.setJobTitleName(jobTitle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<DictDoctorDutyDO> dictDoctorDutyDOS = dictDoctorDutyDao.findByName(jobTitle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (dictDoctorDutyDOS!=null&&dictDoctorDutyDOS.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        DictDoctorDutyDO dutyDO = dictDoctorDutyDOS.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        baseDoctorDO.setJobTitleCode(dutyDO.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDao.save(baseDoctorDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDao.save(baseDoctorDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -933,7 +920,7 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findYpyf(String pydm) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1  and y.pydm is not null"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(pydm)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and y.pydm='"+pydm+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1020,7 +1007,7 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray synYkICD10() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findIcd10() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray array = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1039,7 +1026,6 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                DictIcd10DO dictIcd10DO = new DictIcd10DO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dictIcd10DO.setCode(object.getString("code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dictIcd10DO.setName(object.getString("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dictIcd10DO.setDescription(object.getString("py_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ykDictIcd10Dao.save(dictIcd10DO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1047,27 +1033,6 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findIcd10(String pyCode) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray array = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(pyCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +="  where i.py_code like '%"+pyCode+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sql",sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("ICD10:"+sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(url,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String content = response.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("response:"+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject rs = JSON.parseObject(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer status = rs.getInteger("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            array = rs.getJSONArray("detailModelList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return array; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findByRealOrder(String code) throws Exception { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1392,7 +1357,7 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                hlwCf01DO.setGUID(wlyyPrescriptionVO.getOrderId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                hlwCf01DO.setGUID(getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                hlwCf01DO.setSJLY(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1561,6 +1526,50 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return response1.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 眼科通App消息推送接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orderType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String sendMesToYkt(String doctor, String patient, String orderType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String yktDoctor =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jsonObject = JSONObject.parseObject(doctorResponse); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (jsonObject.getInteger("code")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray array1 = jsonObject.getJSONArray("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (array1!=null&&array1.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    yktDoctor=array1.getJSONObject(0).getString("DOCTORUSERID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("医生映射表不存在!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(basePatientDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient = basePatientDO.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("doctorId",yktDoctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("patientId",patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("orderType",orderType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doPost("http://www.yanketong.com:90/api/share/PushNotificationToDoctor",params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String content = response.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("response:"+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject rs = JSON.parseObject(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer status = rs.getInteger("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null&&status == 10000){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs.getString("message");//推送失败原因 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "推送成功"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |