| 
					
				 | 
			
			
				@ -445,15 +445,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流配送新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(expressageLogDOs!=null&&expressageLogDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!wechatId.equalsIgnoreCase("xm_ykyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //物流配送新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(expressageLogDOs!=null&&expressageLogDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("expressageLogs",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //预约记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(timeDOs!=null&&timeDOs.size()>0){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1954,7 +1957,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (prescriptionCheckDOS==null || prescriptionCheckDOS.size() ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                savePrescriptionCheck(prescription.getDoctor(),"开具处方",5,prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNoneBlank(prescriptionDO.getId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (prescriptionDOs != null && prescriptionDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                savePrescriptionCheck(prescription.getDoctor(),"处方修改",3,prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1985,7 +1989,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //上传his开方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //sendHisDiagnosis(jsonData, outpatientDO, prescription) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //zsSynHis(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Map<String, Object> result1 = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result1.put("code", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result1.put("mes", "开方提交成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return result1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("code", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("mes", "诊断完成"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5328,7 +5335,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updateStatus(String prescriptionId,Integer status){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDao.updateStatus(prescriptionId,status,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionLogService.addPrescriptionLog(prescriptionId,status,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),null,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5366,38 +5375,41 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,operate,operateName,reason,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*if (wxId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("开始====="+wlyyPrescriptionDO.getCheckStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    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处方拼接开方条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (WlyyPrescriptionInfoDO info:infoDOS){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //设置his药品查询条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, info, outpatientDO.getIcd10()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (WlyyInspectionDO ins:inspectionDOS){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //设置his药品查询条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sendHisDiagnosis(jsonData, outpatientDO, prescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,operate,operateName,reason,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setCheckStatus(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setCheckReason(reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setStatus(20); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setCheckStatus(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setCheckReason(reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setStatus(11); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.save(wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDao.save(wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status==2||status==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5489,21 +5501,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setSender(operate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setSenderName(operateName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject data = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer age = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String gender = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(prescriptionDO.getIdcard())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                age = IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                gender=IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("name",prescriptionDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("age",IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("gender",IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("age",age); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("gender",gender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("outpatientId",prescriptionDO.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("prescriptionId",prescriptionDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (status==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDO.setType("9"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDO.setTitle("审方通过"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("message","审方通过"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方已审核通过。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("message","您为"+prescriptionDO.getPatientName()+"("+age+"岁 "+gender+")开具的处方已审核通过。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (status==1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDO.setType("8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDO.setTitle("审方退回"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("message","审方退回"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方被审方退回,请尽快处理"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("message","您为"+prescriptionDO.getPatientName()+"("+age+"岁 "+gender+")开具的处方被审方退回,请尽快处理"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageService.saveMessage(systemMessageDO); 
			 |