|  | @ -3524,73 +3524,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql = sql + "p.create_time\n" +
 | 
	
		
			
				|  |  |                 "as time,\n" +
 | 
	
		
			
				|  |  |                 "e. NAME\n" +
 | 
	
		
			
				|  |  |                 "as NAME,\n" +
 | 
	
		
			
				|  |  |                 "p.pay_time\n" +
 | 
	
		
			
				|  |  |                 "as pay_time,\n" +
 | 
	
		
			
				|  |  |                 "p.real_order\n" +
 | 
	
		
			
				|  |  |                 "as realOrder,\n" +
 | 
	
		
			
				|  |  |                 "o.patient_name\n" +
 | 
	
		
			
				|  |  |                 "as patientName,\n" +
 | 
	
		
			
				|  |  |                 "i.drug_name\n" +
 | 
	
		
			
				|  |  |                 "as infoName,\n" +
 | 
	
		
			
				|  |  |                 " CASE p.create_time\n" +
 | 
	
		
			
				|  |  |                 "WHEN NULL THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'否'\n" +
 | 
	
		
			
				|  |  |                 "ELSE\n" +
 | 
	
		
			
				|  |  |                 "\t'是'\n" +
 | 
	
		
			
				|  |  |                 "END \"create_time\",\n" +
 | 
	
		
			
				|  |  |                 " CASE e.oneself_pickup_flg\n" +
 | 
	
		
			
				|  |  |                 "WHEN 1 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'自取'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 2 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'快递配送'\n" +
 | 
	
		
			
				|  |  |                 "ELSE\n" +
 | 
	
		
			
				|  |  |                 "\t' '\n" +
 | 
	
		
			
				|  |  |                 "END \"oneself_pickup_flg\",\n" +
 | 
	
		
			
				|  |  |                 " CASE p. STATUS\n" +
 | 
	
		
			
				|  |  |                 "WHEN - 4 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'已作废'\n" +
 | 
	
		
			
				|  |  |                 "WHEN - 3 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'支付过期取消'\n" +
 | 
	
		
			
				|  |  |                 "WHEN - 2 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'患者自己取消'\n" +
 | 
	
		
			
				|  |  |                 "WHEN - 1 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'医生取消'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 0 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'候诊中'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 10 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'诊断中'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 11 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'药师审核失败 / 调整中'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 12 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'药师审核完成'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 13 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'开方失败/调整中'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 20 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'诊断完成/开方成功/待支付'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 30 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'支付成功/等待配药'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 31 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'配药成功/等待取药'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 32 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'配送中'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 100 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'已完成/未评价'\n" +
 | 
	
		
			
				|  |  |                 "WHEN 101 THEN\n" +
 | 
	
		
			
				|  |  |                 "\t'已完成/已经评价'\n" +
 | 
	
		
			
				|  |  |                 "ELSE\n" +
 | 
	
		
			
				|  |  |                 "\t' '\n" +
 | 
	
		
			
				|  |  |                 "END STATUS\n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "\twlyy_outpatient o\n" +
 | 
	
		
			
				|  |  |                 "LEFT JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
 | 
	
		
			
				|  |  |                 "LEFT JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
 | 
	
		
			
				|  |  |                 "LEFT JOIN wlyy_prescription_info i ON i.prescription_id = p.id\n" +
 | 
	
		
			
				|  |  |                 "WHERE\n" +
 | 
	
		
			
				|  |  |                 "\t1 = 1";
 | 
	
		
			
				|  |  |         sql = sql + " e.name as \"name\", " +
 | 
	
		
			
				|  |  |                 " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
 | 
	
		
			
				|  |  |                 " o.id AS \"outpatientId\", " +
 | 
	
		
			
				|  |  |                 " o.icd10_name AS \"icd10Name\", " +
 | 
	
		
			
				|  |  |                 " p.status as \"status\", " +
 | 
	
		
			
				|  |  |                 " p.id AS \"prescriptionId\" ," +
 | 
	
		
			
				|  |  |                 " e.id AS \"expressageId\" ,"+
 | 
	
		
			
				|  |  |                 " p.real_order AS \"realOrder\" ,"+
 | 
	
		
			
				|  |  |                 " p.origin_real_order AS \"originRealOrder\"," +
 | 
	
		
			
				|  |  |                 " o.patient_name as \"patientName\" "+
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_outpatient o " +
 | 
	
		
			
				|  |  |                 " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
 | 
	
		
			
				|  |  |                 " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id " +
 | 
	
		
			
				|  |  |                 " WHERE" +
 | 
	
		
			
				|  |  |                 " 1=1";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(status)) {
 | 
	
		
			
				|  |  |             sql += " AND p.status in(" + status + ") ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -3631,14 +3580,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql +=" order by p.create_time desc ";
 | 
	
		
			
				|  |  |         /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
 | 
	
		
			
				|  |  |         List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql,page,size);
 | 
	
		
			
				|  |  |         for (Map<String, Object> map : mapList) {
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, size);
 | 
	
		
			
				|  |  |         for (Map<String, Object> map : list) {
 | 
	
		
			
				|  |  |             if (map.get("prescriptionId") != null) {
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(), 1);
 | 
	
		
			
				|  |  |                 map.put("info", wlyyPrescriptionInfoDOS);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, mapList,page,size,count);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Boolean setMailno(String mailno, String expressageId) {
 | 
	
	
		
			
				|  | @ -12287,7 +12238,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setDoctorId(staffNo);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setConsumer(consumer);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setDoctorName(staffName);
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setAppointmentTime(new Date());
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
 | 
	
		
			
				|  |  |                 baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
 | 
	
		
			
				|  |  |                 logger.info("BaseNatAppointmentDO保存结束"+baseNatAppointmentDO.getId());
 | 
	
		
			
				|  |  |                 //添加订单
 | 
	
	
		
			
				|  | @ -13558,4 +13509,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param receiverType 1医生、2患者
 | 
	
		
			
				|  |  |      * @param oupatientId
 | 
	
		
			
				|  |  |      * @param sendType 1系统、2短信、3全部
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String sendMessageManger(String receiver,String receiverType,String oupatientId,String businessType,String sendType){
 | 
	
		
			
				|  |  |         String msg = "";
 | 
	
		
			
				|  |  |         WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(oupatientId);
 | 
	
		
			
				|  |  |         BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(receiverType)&&receiver.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             if (sendType.equalsIgnoreCase("2")){
 | 
	
		
			
				|  |  |                 ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
 | 
	
		
			
				|  |  |             }else if (sendType.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                 wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |             }else if (sendType.equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |                 ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
 | 
	
		
			
				|  |  |                 wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else if (StringUtils.isNoneBlank(receiverType)&&receiver.equalsIgnoreCase("2")){
 | 
	
		
			
				|  |  |             if (sendType.equalsIgnoreCase("2")){
 | 
	
		
			
				|  |  |                 ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
 | 
	
		
			
				|  |  |             }else if (sendType.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                 wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |             }else if (sendType.equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |                 ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
 | 
	
		
			
				|  |  |                 wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return "成功";
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |