|
@ -3232,183 +3232,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @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 " +
|
|
|
" 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(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\",";
|
|
|
}
|
|
|
|
|
|
} 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\",";
|
|
|
}
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
sql = sql +
|
|
|
"p.id AS \"prescriptionId\",\n" +
|
|
|
"p.create_time AS \"time\",\n" +
|
|
|
"\te.name AS \"name\",\n" +
|
|
|
"\tp.pay_time AS \"pay_time\",\n" +
|
|
|
"\tp.real_order AS \"realOrder\",\n" +
|
|
|
" o.icd10_name AS \"icd10Name\", " +
|
|
|
" e.id AS \"expressageId\" ,"+
|
|
|
"\to.patient_name AS \"patientName\",\n" +
|
|
|
"\tp.create_time AS \"create_time\",\n" +
|
|
|
"\te.oneself_pickup_flg AS \"oneself_pickup_flg\",\n" +
|
|
|
"\tp.status AS \"status\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_outpatient o\n" +
|
|
|
"JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
|
|
|
"JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
|
|
|
"WHERE\n" +
|
|
|
"\t1 = 1\n";//oracle
|
|
|
} else {
|
|
|
sql = sql +
|
|
|
"p.id AS \"prescriptionId\",\n" +
|
|
|
"\tp.create_time AS \"time\",\n" +
|
|
|
"\te.name AS \"name\",\n" +
|
|
|
"\tp.pay_time AS \"pay_time\",\n" +
|
|
|
"\tp.real_order AS \"realOrder\",\n" +
|
|
|
" o.icd10_name AS \"icd10Name\", " +
|
|
|
" e.id AS \"expressageId\" ,"+
|
|
|
"\to.patient_name AS \"patientName\",\n" +
|
|
|
"\tp.create_time AS \"create_time\",\n" +
|
|
|
"\te.oneself_pickup_flg AS \"oneself_pickup_flg\",\n" +
|
|
|
"\tp.status AS \"status\"\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_outpatient o\n" +
|
|
|
"JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
|
|
|
"JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
|
|
|
"WHERE\n" +
|
|
|
"\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(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'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
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);
|
|
|
}
|
|
|
}*/
|
|
|
String totalSql = "SELECT " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
" FROM " +
|
|
@ -3461,9 +3284,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
String sql = "SELECT ";
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
if (flag) {
|
|
|
sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss') AS \"expressCreateTime\",";
|
|
|
}else {
|
|
|
} else {
|
|
|
sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss') AS \"expressCreateTime\",";
|
|
|
}
|
|
|
|
|
@ -3471,9 +3294,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' ) AS \"expressCreateTime\",";
|
|
|
}
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
if (flag) {
|
|
|
sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss') AS \"createTime\",";
|
|
|
}else {
|
|
|
} else {
|
|
|
sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss') AS \"createTime\",";
|
|
|
}
|
|
|
|
|
@ -3481,9 +3304,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' ) AS \"createTime\",";
|
|
|
}
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
if (flag) {
|
|
|
sql = sql + "date_format(p.pay_time,'YYYY-MM-DD hh24:mi:ss') AS \"payTime\",";
|
|
|
}else {
|
|
|
} else {
|
|
|
sql = sql + "to_char(p.pay_time,'YYYY-MM-DD hh24:mi:ss') AS \"payTime\",";
|
|
|
}
|
|
|
|
|
@ -3496,10 +3319,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" o.icd10_name AS \"icd10Name\", " +
|
|
|
" p.status as \"status\", " +
|
|
|
" p.id AS \"prescriptionId\" ," +
|
|
|
" e.id AS \"expressageId\" ,"+
|
|
|
" p.real_order AS \"realOrder\" ,"+
|
|
|
" e.id AS \"expressageId\" ," +
|
|
|
" p.real_order AS \"realOrder\" ," +
|
|
|
" p.origin_real_order AS \"originRealOrder\"," +
|
|
|
" o.patient_name as \"patientName\" "+
|
|
|
" o.patient_name as \"patientName\" " +
|
|
|
" FROM " +
|
|
|
" wlyy_outpatient o " +
|
|
|
" JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
|
|
@ -3510,7 +3333,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
sql += " AND p.status in(" + status + ") ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(oneselfPickupFlg)) {
|
|
|
sql += " AND e.oneself_pickup_flg =" + oneselfPickupFlg+" ";
|
|
|
sql += " AND e.oneself_pickup_flg =" + oneselfPickupFlg + " ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(nameKey)) {
|
|
|
sql += " AND e.name like '%" + nameKey + "%' ";
|
|
@ -3522,9 +3345,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startTime)) {
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
if (flag) {
|
|
|
sql += " and p.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
} else {
|
|
|
sql += " and p.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
} else {
|
|
@ -3534,9 +3357,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endTime)) {
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
if (flag){
|
|
|
if (flag) {
|
|
|
sql += " and p.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}else {
|
|
|
} else {
|
|
|
sql += " and p.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
|
|
|
}
|
|
|
|
|
@ -3545,13 +3368,18 @@ 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 + "";*/
|
|
|
List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql, page, size);
|
|
|
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);
|
|
|
}
|
|
|
}
|
|
|
return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);
|