|  | @ -8539,22 +8539,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setId(prescriptionId);
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckStatus(status);
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckReason(reason);
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setStatus(11);
 | 
	
		
			
				|  |  |             /*if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(10);
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(11);
 | 
	
		
			
				|  |  |             }*/
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(10);
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     if(inspectionDOS!=null&&inspectionDOS.size()>0){
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setStatus(20);
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setStatus(9);
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setCheckReason("只开检查检验,不开药品无需审方");
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setCheckStatus(2);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |           /*  }*/
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(11);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
	
		
			
				|  | @ -9321,24 +9325,53 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param size
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient) {
 | 
	
		
			
				|  |  |     public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  |         if (patientDO==null){
 | 
	
		
			
				|  |  |             return PageEnvelop.getError("找不到该患者",-1);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer(" SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
 | 
	
		
			
				|  |  |         StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
 | 
	
		
			
				|  |  |         StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
 | 
	
		
			
				|  |  |         sql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
 | 
	
		
			
				|  |  |         countSql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(isSelectDrug)){
 | 
	
		
			
				|  |  |             if("0".equalsIgnoreCase(isSelectDrug)){
 | 
	
		
			
				|  |  |                 sql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
 | 
	
		
			
				|  |  |                 countSql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equalsIgnoreCase(isSelectDrug)){
 | 
	
		
			
				|  |  |                 sql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
 | 
	
		
			
				|  |  |                 countSql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(status)) {
 | 
	
		
			
				|  |  |             status = status.substring(1, status.length() - 1);
 | 
	
		
			
				|  |  |             sql.append(" where b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |             countSql.append(" where b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(isSelectDrug)){
 | 
	
		
			
				|  |  |                 if("0".equalsIgnoreCase(isSelectDrug)){
 | 
	
		
			
				|  |  |                     sql.append(" where b.status IN( 9,").append(status).append(")");
 | 
	
		
			
				|  |  |                     countSql.append(" where b.status IN( 9,").append(status).append(")");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql.append(" where b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |                     countSql.append(" where b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 sql.append(" where b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |                 countSql.append(" where b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql.append("  where b.status IN(20,21,30,31,32,100,101)");
 | 
	
		
			
				|  |  |             countSql.append(" where b.status IN(20,21,30,31,32,100,101) ");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(isSelectDrug)){
 | 
	
		
			
				|  |  |             if("0".equalsIgnoreCase(isSelectDrug)){
 | 
	
		
			
				|  |  |                 sql.append(" and m.del =1 ");
 | 
	
		
			
				|  |  |                 countSql.append(" and m.del =1 ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equalsIgnoreCase(isSelectDrug)){
 | 
	
		
			
				|  |  |                 sql.append(" and m.del =1");
 | 
	
		
			
				|  |  |                 countSql.append(" and m.del =1");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(keyName)) {
 | 
	
		
			
				|  |  |             sql.append(" and (" +
 |