|  | @ -3231,8 +3231,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |      * @param size
 |  |      * @param size
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public MixEnvelop findExpressageList2(String status, String oneselfPickupFlg, String nameKey, String startTime, String endTime, Integer page, Integer size, String wxId,String patientName) {
 |  | 
 | 
												
													
														
															|  |         String totalSql = "SELECT " +
 |  | 
 | 
												
													
														
															|  | 
 |  |     public MixEnvelop  findExpressageList2(String status, String oneselfPickupFlg, String nameKey, String startTime, String endTime, Integer page, Integer size, String wxId,String patientName) {
 | 
												
													
														
															|  | 
 |  |         /*String totalSql = "SELECT " +
 | 
												
													
														
															|  |                 " COUNT(1) AS \"total\" " +
 |  |                 " COUNT(1) AS \"total\" " +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_outpatient o " +
 |  |                 " wlyy_outpatient o " +
 | 
												
											
												
													
														
															|  | @ -3282,6 +3282,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         if (rstotal != null && rstotal.size() > 0) {
 |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
												
													
														
															|  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 |  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = "SELECT  ";
 |  |         String sql = "SELECT  ";
 | 
												
													
														
															|  |         if ("xm_ykyy_wx".equals(wxId)) {
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  |             if (flag){
 |  |             if (flag){
 | 
												
											
												
													
														
															|  | @ -3317,108 +3320,192 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |             sql = sql +
 |  |             sql = sql +
 | 
												
													
														
															|  |                     "p.id AS \"prescriptionId\",\n" +
 |  |                     "p.id AS \"prescriptionId\",\n" +
 | 
												
													
														
															|  |                     "p.create_time AS \"time\",\n" +
 |  |                     "p.create_time AS \"time\",\n" +
 | 
												
													
														
															|  |                     "\te. NAME AS \"name\",\n" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                     "\te.name AS \"name\",\n" +
 | 
												
													
														
															|  |                     "\tp.pay_time AS \"pay_time\",\n" +
 |  |                     "\tp.pay_time AS \"pay_time\",\n" +
 | 
												
													
														
															|  |                     "\tp.real_order AS \"realOrder\",\n" +
 |  |                     "\tp.real_order AS \"realOrder\",\n" +
 | 
												
													
														
															|  | 
 |  |                     " o.icd10_name AS \"icd10Name\", " +
 | 
												
													
														
															|  | 
 |  |                     " e.id AS \"expressageId\" ,"+
 | 
												
													
														
															|  |                     "\to.patient_name AS \"patientName\",\n" +
 |  |                     "\to.patient_name AS \"patientName\",\n" +
 | 
												
													
														
															|  |                     "\tp.create_time AS \"create_time\",\n" +
 |  |                     "\tp.create_time AS \"create_time\",\n" +
 | 
												
													
														
															|  |                     "\te.oneself_pickup_flg AS \"oneself_pickup_flg\",\n" +
 |  |                     "\te.oneself_pickup_flg AS \"oneself_pickup_flg\",\n" +
 | 
												
													
														
															|  |                     "\tp. STATUS AS \"status\"\n" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                     "\tp.status AS \"status\"\n" +
 | 
												
													
														
															|  |                     "FROM\n" +
 |  |                     "FROM\n" +
 | 
												
													
														
															|  |                     "\twlyy_outpatient o\n" +
 |  |                     "\twlyy_outpatient o\n" +
 | 
												
													
														
															|  |                     "JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
 |  |                     "JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
 | 
												
													
														
															|  |                     "JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
 |  |                     "JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
 | 
												
													
														
															|  |                     "WHERE\n" +
 |  |                     "WHERE\n" +
 | 
												
													
														
															|  |                     "\t1 = 1\n";//oracle
 |  |                     "\t1 = 1\n";//oracle
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(status)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND p.status in(" + status + ") ";
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(oneselfPickupFlg)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND e.oneself_pickup_flg = " + oneselfPickupFlg+" ";
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(nameKey)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND e.name like '%" + nameKey + "%' ";
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(patientName)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND o.patient_name like '%" + patientName + "%' ";
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(startTime)) {
 |  | 
 | 
												
													
														
															|  |                 if ("xm_ykyy_wx".equals(wxId)) {
 |  | 
 | 
												
													
														
															|  |                     if (flag){
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }else {
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                 } else {
 |  | 
 | 
												
													
														
															|  |                     totalSql += " AND p.create_time >='" + startTime + " 00:00:00'";
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(endTime)) {
 |  | 
 | 
												
													
														
															|  |                 if ("xm_ykyy_wx".equals(wxId)) {
 |  | 
 | 
												
													
														
															|  |                     if (flag){
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }else {
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                 } else {
 |  | 
 | 
												
													
														
															|  |                     sql += " AND p.create_time <='" + endTime + " 23:59:59'";
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  |         } else {
 |  |         } else {
 | 
												
													
														
															|  |             sql = sql +
 |  |             sql = sql +
 | 
												
													
														
															|  |                     "p.id AS \"prescriptionId\",\n" +
 |  |                     "p.id AS \"prescriptionId\",\n" +
 | 
												
													
														
															|  |                     "\tp.create_time AS \"time\",\n" +
 |  |                     "\tp.create_time AS \"time\",\n" +
 | 
												
													
														
															|  |                     "\te. NAME AS \"name\",\n" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                     "\te.name AS \"name\",\n" +
 | 
												
													
														
															|  |                     "\tp.pay_time AS \"pay_time\",\n" +
 |  |                     "\tp.pay_time AS \"pay_time\",\n" +
 | 
												
													
														
															|  |                     "\tp.real_order AS \"realOrder\",\n" +
 |  |                     "\tp.real_order AS \"realOrder\",\n" +
 | 
												
													
														
															|  | 
 |  |                     " o.icd10_name AS \"icd10Name\", " +
 | 
												
													
														
															|  | 
 |  |                     " e.id AS \"expressageId\" ,"+
 | 
												
													
														
															|  |                     "\to.patient_name AS \"patientName\",\n" +
 |  |                     "\to.patient_name AS \"patientName\",\n" +
 | 
												
													
														
															|  |                     "\tp.create_time AS \"create_time\",\n" +
 |  |                     "\tp.create_time AS \"create_time\",\n" +
 | 
												
													
														
															|  |                     "\te.oneself_pickup_flg AS \"oneself_pickup_flg\",\n" +
 |  |                     "\te.oneself_pickup_flg AS \"oneself_pickup_flg\",\n" +
 | 
												
													
														
															|  |                     "\tp. STATUS AS \"status\"\n" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                     "\tp.status AS \"status\"\n" +
 | 
												
													
														
															|  |                     "FROM\n" +
 |  |                     "FROM\n" +
 | 
												
													
														
															|  |                     "\twlyy_outpatient o\n" +
 |  |                     "\twlyy_outpatient o\n" +
 | 
												
													
														
															|  |                     "JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
 |  |                     "JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
 | 
												
													
														
															|  |                     "JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
 |  |                     "JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
 | 
												
													
														
															|  |                     "WHERE\n" +
 |  |                     "WHERE\n" +
 | 
												
													
														
															|  |                     "\t1 = 1\n";//MySQL
 |  | 
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(status)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND p.status in(" + status + ") ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                     "\t1 = 1\n";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(status)) {
 | 
												
													
														
															|  | 
 |  |             sql += " AND p.status in(" + status + ") ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(oneselfPickupFlg)) {
 | 
												
													
														
															|  | 
 |  |             sql += " AND e.oneself_pickup_flg =" + oneselfPickupFlg+" ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(nameKey)) {
 | 
												
													
														
															|  | 
 |  |             sql += " AND e.name like '%" + nameKey + "%' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(patientName)) {
 | 
												
													
														
															|  | 
 |  |             sql += " AND o.patient_name like '%" + patientName + "%' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
												
													
														
															|  | 
 |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |                 if (flag){
 | 
												
													
														
															|  | 
 |  |                     sql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }else {
 | 
												
													
														
															|  | 
 |  |                     sql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  | 
 |  |                 sql += " AND p.create_time >='" + startTime + " 00:00:00'";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(oneselfPickupFlg)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND e.oneself_pickup_flg = " + oneselfPickupFlg+" ";
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(endTime)) {
 | 
												
													
														
															|  | 
 |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |                 if (flag){
 | 
												
													
														
															|  | 
 |  |                     sql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }else {
 | 
												
													
														
															|  | 
 |  |                     sql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  | 
 |  |                 sql += " AND p.create_time <='" + endTime + " 23:59:59'";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(nameKey)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND e.name like '%" + nameKey + "%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         sql +=" order by p.create_time desc ";
 | 
												
													
														
															|  | 
 |  |         *//*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*//*
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql);
 | 
												
													
														
															|  | 
 |  |         for (Map<String, Object> map : mapList) {
 | 
												
													
														
															|  | 
 |  |             if (map.get("prescriptionId") != null) {
 | 
												
													
														
															|  | 
 |  |                 List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(), 1);
 | 
												
													
														
															|  | 
 |  |                 map.put("info", wlyyPrescriptionInfoDOS);
 | 
												
													
														
															|  | 
 |  |                 String infoName = "";
 | 
												
													
														
															|  | 
 |  |                 for (WlyyPrescriptionInfoDO info:wlyyPrescriptionInfoDOS) {
 | 
												
													
														
															|  | 
 |  |                     infoName += info.getDrugName() + "*" + info.getQuantity() + ",";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 map.put("infooName",infoName);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(patientName)) {
 |  | 
 | 
												
													
														
															|  |                 totalSql += " AND o.patient_name like '%" + patientName + "%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |         }*/
 | 
												
													
														
															|  | 
 |  |         String totalSql = "SELECT " +
 | 
												
													
														
															|  | 
 |  |                 " COUNT(1) AS \"total\" " +
 | 
												
													
														
															|  | 
 |  |                 " 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)) {
 | 
												
													
														
															|  | 
 |  |             totalSql += " AND p.status in(" + status + ") ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(oneselfPickupFlg)) {
 | 
												
													
														
															|  | 
 |  |             totalSql += " AND e.oneself_pickup_flg = " + oneselfPickupFlg+" ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(nameKey)) {
 | 
												
													
														
															|  | 
 |  |             totalSql += " AND e.name like '%" + nameKey + "%' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(patientName)) {
 | 
												
													
														
															|  | 
 |  |             totalSql += " AND o.patient_name like '%" + patientName + "%' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
												
													
														
															|  | 
 |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |                 if (flag){
 | 
												
													
														
															|  | 
 |  |                     totalSql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }else {
 | 
												
													
														
															|  | 
 |  |                     totalSql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  | 
 |  |                 totalSql += " AND p.create_time >='" + startTime + " 00:00:00'";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(startTime)) {
 |  | 
 | 
												
													
														
															|  |                 if ("xm_ykyy_wx".equals(wxId)) {
 |  | 
 | 
												
													
														
															|  |                     if (flag){
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }else {
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                 } else {
 |  | 
 | 
												
													
														
															|  |                     totalSql += " AND p.create_time >='" + startTime + " 00:00:00'";
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(endTime)) {
 | 
												
													
														
															|  | 
 |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |                 if (flag){
 | 
												
													
														
															|  | 
 |  |                     totalSql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 }else {
 | 
												
													
														
															|  | 
 |  |                     totalSql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             } else {
 | 
												
													
														
															|  | 
 |  |                 totalSql += " AND p.create_time <='" + endTime + " 23:59:59'";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         Long count = 0L;
 | 
												
													
														
															|  | 
 |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
												
													
														
															|  | 
 |  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT  ";
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if (StringUtils.isNotBlank(endTime)) {
 |  | 
 | 
												
													
														
															|  |                 if ("xm_ykyy_wx".equals(wxId)) {
 |  | 
 | 
												
													
														
															|  |                     if (flag){
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }else {
 |  | 
 | 
												
													
														
															|  |                         totalSql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                 } else {
 |  | 
 | 
												
													
														
															|  |                     sql += " AND p.create_time <='" + endTime + " 23:59:59'";
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"expressCreateTime\",";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "date_format(p.pay_time,'YYYY-MM-DD hh24:mi:ss')  AS \"payTime\",";
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 sql = sql + "to_char(p.pay_time,'YYYY-MM-DD hh24:mi:ss')  AS \"payTime\",";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         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)) {
 |  |         if (StringUtils.isNotBlank(status)) {
 | 
												
													
														
															|  |             sql += " AND p.status in(" + status + ") ";
 |  |             sql += " AND p.status in(" + status + ") ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -3431,6 +3518,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (StringUtils.isNotBlank(patientName)) {
 |  |         if (StringUtils.isNotBlank(patientName)) {
 | 
												
													
														
															|  |             sql += " AND o.patient_name like '%" + patientName + "%' ";
 |  |             sql += " AND o.patient_name like '%" + patientName + "%' ";
 | 
												
													
														
															|  | 
 |  |             /*sql += " and (a.patient_name like '" + title + "' OR a.doctor_name like '" + title + "' OR a.dept_name like '" + title + "' )"*/
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (StringUtils.isNotBlank(startTime)) {
 |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
												
													
														
															|  |             if ("xm_ykyy_wx".equals(wxId)) {
 |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
											
												
													
														
															|  | @ -3459,16 +3547,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sql +=" order by p.create_time desc ";
 |  |         sql +=" order by p.create_time desc ";
 | 
												
													
														
															|  |         /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
 |  |         /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
 | 
												
													
														
															|  |         List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql);
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql, page, size);
 | 
												
													
														
															|  |         for (Map<String, Object> map : mapList) {
 |  |         for (Map<String, Object> map : mapList) {
 | 
												
													
														
															|  |             if (map.get("prescriptionId") != null) {
 |  |             if (map.get("prescriptionId") != null) {
 | 
												
													
														
															|  |                 List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(), 1);
 |  |                 List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(), 1);
 | 
												
													
														
															|  |                 map.put("info", wlyyPrescriptionInfoDOS);
 |  |                 map.put("info", wlyyPrescriptionInfoDOS);
 | 
												
													
														
															|  |                 String infoName = "";
 |  | 
 | 
												
													
														
															|  |                 for (WlyyPrescriptionInfoDO info:wlyyPrescriptionInfoDOS) {
 |  | 
 | 
												
													
														
															|  |                     infoName += info.getDrugName() + "*" + info.getQuantity() + ",";
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  |                 map.put("infooName",infoName);
 |  | 
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);
 |  |         return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);
 | 
												
											
												
													
														
															|  | @ -3837,31 +3920,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             for (Map<String, Object> m : list) {
 |  |             for (Map<String, Object> m : list) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 /*Object status = m.get("status");
 |  | 
 | 
												
													
														
															|  |                 String statuss = "";
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 if (status == null) {
 |  | 
 | 
												
													
														
															|  |                     statuss += " ";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("0")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "未支付";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("1")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "已支付";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("2")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "交易关闭";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("3")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "支付超时";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("4")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "交易完成";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("5")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "交易进行中";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("6")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "退款申请";
 |  | 
 | 
												
													
														
															|  |                 }else if (status.equals("9")) {
 |  | 
 | 
												
													
														
															|  |                     statuss += "退款完成";
 |  | 
 | 
												
													
														
															|  |                 }else {
 |  | 
 | 
												
													
														
															|  |                     statuss += " ";
 |  | 
 | 
												
													
														
															|  |                 }*/
 |  | 
 | 
												
													
														
															|  |                 String odry = "";
 |  |                 String odry = "";
 | 
												
													
														
															|  |                 String orderCategory = "";
 |  |                 String orderCategory = "";
 | 
												
													
														
															|  |                 String odte = "";
 |  |                 String odte = "";
 | 
												
											
												
													
														
															|  | @ -3871,34 +3929,37 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 if (m.get("orderCategory")==null){
 |  |                 if (m.get("orderCategory")==null){
 | 
												
													
														
															|  |                     odry = null;
 |  |                     odry = null;
 | 
												
													
														
															|  |                 }else {
 |  |                 }else {
 | 
												
													
														
															|  |                     orderCategory = m.get("orderCategory").toString();
 |  | 
 | 
												
													
														
															|  |                     if (orderCategory.equals("1")) {
 |  | 
 | 
												
													
														
															|  |                         odry += "专家咨询";
 |  | 
 | 
												
													
														
															|  |                     }else if (orderCategory.equals("2")) {
 |  | 
 | 
												
													
														
															|  |                         odry += "复诊";
 |  | 
 | 
												
													
														
															|  |                     }else if (orderCategory.equals("3")) {
 |  | 
 | 
												
													
														
															|  |                         odry += "视频诊室";
 |  | 
 | 
												
													
														
															|  |                     }else if (orderCategory.equals("4")) {
 |  | 
 | 
												
													
														
															|  |                         odry += "处方";
 |  | 
 | 
												
													
														
															|  |                         odte += "处方";
 |  | 
 | 
												
													
														
															|  |                     }else if (orderCategory.equals("5")) {
 |  | 
 | 
												
													
														
															|  |                         odry += "就诊卡充值";
 |  | 
 | 
												
													
														
															|  |                         odte += "就诊卡充值";
 |  | 
 | 
												
													
														
															|  |                     }else {
 |  | 
 | 
												
													
														
															|  |                         odry += " ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                     if(m.get("orderType") == null) {
 | 
												
													
														
															|  | 
 |  |                         odte = null;
 | 
												
													
														
															|  | 
 |  |                     }else{
 | 
												
													
														
															|  | 
 |  |                         String orderType =  m.get("orderType").toString();
 | 
												
													
														
															|  | 
 |  |                         orderCategory = m.get("orderCategory").toString();
 | 
												
													
														
															|  | 
 |  |                         if (orderCategory.equals("1")) {
 | 
												
													
														
															|  | 
 |  |                             odry += "专家咨询";
 | 
												
													
														
															|  | 
 |  |                             if (orderType.equalsIgnoreCase("1")) {
 | 
												
													
														
															|  | 
 |  |                                 odte += "图文";
 | 
												
													
														
															|  | 
 |  |                             }else if (orderType.equalsIgnoreCase("3")) {
 | 
												
													
														
															|  | 
 |  |                                 odte += "视频";
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  | 
 |  |                         }else if (orderCategory.equals("2")) {
 | 
												
													
														
															|  | 
 |  |                             odry += "在线复诊";
 | 
												
													
														
															|  | 
 |  |                             if (orderType.equalsIgnoreCase("1")) {
 | 
												
													
														
															|  | 
 |  |                                 odte += "图文";
 | 
												
													
														
															|  | 
 |  |                             }else if (orderType.equalsIgnoreCase("3")) {
 | 
												
													
														
															|  | 
 |  |                                 odte += "视频";
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  | 
 |  |                         }else if (orderCategory.equals("4")) {
 | 
												
													
														
															|  | 
 |  |                             odry += "处方";
 | 
												
													
														
															|  | 
 |  |                             odte += "处方";
 | 
												
													
														
															|  | 
 |  |                         }else if (orderCategory.equals("5")) {
 | 
												
													
														
															|  | 
 |  |                             odry += "就诊卡充值";
 | 
												
													
														
															|  | 
 |  |                             odte += "就诊卡充值";
 | 
												
													
														
															|  | 
 |  |                         }else {
 | 
												
													
														
															|  | 
 |  |                             odry += " ";
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 if(m.get("orderType") == null) {
 |  | 
 | 
												
													
														
															|  |                     odte = null;
 |  | 
 | 
												
													
														
															|  |                 }else{
 |  | 
 | 
												
													
														
															|  |                     String orderType =  m.get("orderType").toString();
 |  | 
 | 
												
													
														
															|  |                     if (orderType.equalsIgnoreCase("1")) {
 |  | 
 | 
												
													
														
															|  |                         odte += "图文";
 |  | 
 | 
												
													
														
															|  |                     }else if (orderType.equalsIgnoreCase("3")) {
 |  | 
 | 
												
													
														
															|  |                         odte += "视频";
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 if (m.get("status") == null) {
 |  |                 if (m.get("status") == null) {
 | 
												
													
														
															|  |                     status = null;
 |  |                     status = null;
 |