Browse Source

眼科电子病历及检查接口开发

wangzhinan 1 year ago
parent
commit
2a2e09d604

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java

@ -73,6 +73,9 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.createTime>?1 and  a.createTime <?2 and a.status >=30 ")
    List<WlyyPrescriptionDO> findListBySuccessStatus(Date startTime,Date endTime);
    @Query("select a from WlyyPrescriptionDO a where a.createTime>?1 and  a.createTime <?2  ")
    List<WlyyPrescriptionDO> findListInspectBySuccessStatus(Date startTime,Date endTime);
    @Query("select a from WlyyPrescriptionDO a,WlyyDoorPrescriptionDO p where a.id=p.code and p.orderId = ?1 and p.isAfterDoor = ?2  order by a.createTime desc")
    List<WlyyPrescriptionDO> findByOrderIdAndIsAfterDoor(String id, Integer isAfterDoor);

+ 103 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -16154,6 +16154,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return mapList;
    }
    /**
     * 药品明细表
     *
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>> selectInspectTotal(String startTime,String endTime){
        List<Map<String, Object>> mapList = new ArrayList<>();
        Date stateDate = DateUtil.strToDateLong(startTime);
        Date endDate = DateUtil.strToDateLong(endTime);
        List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findListInspectBySuccessStatus(stateDate,endDate);
        for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
            com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDO);
            List<WlyyInspectionDO> inspectionDOList = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(),1);
            objectString.put("inspect",inspectionDOList);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
            if (outpatientDO!=null){
                objectString.put("consumerName",outpatientDO.getConsumerName());
            }else {
                objectString.put("consumerName","");
            }
            Map<String,Object> map = new HashedMap();
            map.put("prescription",objectString);
            mapList.add(map);
        }
        return mapList;
    }
    /**
     * 药品明细表导出
     *
@ -16192,7 +16222,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            for (Map<String, Object> m : ls) {
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(m.get("prescription").toString());
                com.alibaba.fastjson.JSONArray array = jsonObject.getJSONArray("info");
                com.alibaba.fastjson.JSONArray array = jsonObject.getJSONArray("inspect");
                int j = i;
                addCell(ws, i, 0,jsonObject.get("patientName")!=null?jsonObject.get("patientName").toString():n);
                addCell(ws, i, 1,jsonObject.get("consumerName")!=null?jsonObject.get("consumerName").toString():n);
@ -16248,7 +16278,79 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    /**
     * 检查明细表导出
     *
     * @param ls
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    public void pushListInspectDrugTotal(OutputStream os, List<Map<String, Object>> ls,String startTime,String endTime) throws Exception {
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"互联网医院检查明细表","","","","","","","",""};//
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
                k++;
            }
            String[] header1 = {"汇总日期:"+startTime+"至"+endTime,"","","","","","","",""};//
            int k1 = 0;
            for (String h : header1) {
                addCell(ws, 1, k1, h);//表名,行,列,header
                k1++;
            }
            String[] header2 = {"患者名称","代问诊人","检查项目","检查部位","执行院区","执行科室","总量","价格","开方时间","开方医生"};//
            int k2 = 0;
            for (String h : header2) {
                addCell(ws, 2, k2, h);//表名,行,列,header
                k2++;
            }
            int i = 3;
            String n = " ";
            for (Map<String, Object> m : ls) {
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(m.get("prescription").toString());
                com.alibaba.fastjson.JSONArray array = jsonObject.getJSONArray("info");
                int j = i;
                addCell(ws, i, 0,jsonObject.get("patientName")!=null?jsonObject.get("patientName").toString():n);
                addCell(ws, i, 1,jsonObject.get("consumerName")!=null?jsonObject.get("consumerName").toString():n);
                DecimalFormat df = new DecimalFormat("#.00");
                if(array!=null&&array.size()!=0){
                    for (int z=0;z<array.size();z++){
                        com.alibaba.fastjson.JSONObject object = array.getJSONObject(z);
                        addCell(ws, i, 2, object.get("name")!=null?object.get("name").toString():n);
                        addCell(ws, i, 3, object.get("checkPartName")!=null?object.get("checkPartName").toString():n);
                        addCell(ws, i, 4, object.get("orgName")!=null?object.get("orgName").toString():n);
                        addCell(ws, i, 5, object.get("deptName")!=null?object.get("deptName").toString():n);
                        addCell(ws, i, 6, object.get("quantity")!=null?object.get("quantity").toString():n);
                        addCell(ws, i, 7,object.get("chargeAmount")!=null?object.get("chargeAmount").toString():n);
                        addCell(ws, i, 8,jsonObject.get("createTime")!=null?DateUtil.stampToString(jsonObject.get("createTime").toString()):n);
                        addCell(ws, i, 9,jsonObject.get("doctorName")!=null?jsonObject.get("doctorName").toString():n);
                        i++;
                    }
                    ws.mergeCells(0,j,0,i-1);
                    ws.mergeCells(1,j,1,i-1);
                }else {
                    i++;
                }
            }
            ws.mergeCells(0,0,7,0);
            ws.mergeCells(0,1,8,1);
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }

+ 10 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -892,6 +892,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                list = prescriptionService.selectDrugTotal(startTime,endTime);
            }else if (type.equalsIgnoreCase("6")){
                list = prescriptionService.selectPrescriptionFeeTotal(startTime,endTime);
            }else if (type.equalsIgnoreCase("7")){
                list = prescriptionService.selectInspectTotal(startTime,endTime);
            }
            if (businessType.equalsIgnoreCase("2")){
                if (type.equalsIgnoreCase("1")){
@ -924,6 +926,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                    response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("门诊收入项目汇总报表_"+startTime+"_"+endTime)+".xls"));
                    OutputStream os = response.getOutputStream();
                    prescriptionService.pushListWritePrescriptionPriceTotal(os, list,startTime,endTime);
                }else if (type.equalsIgnoreCase("7")){
                    response.setContentType("octets/stream");
                    response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("互联网医院药品明细表_"+startTime+"_"+endTime)+".xls"));
                    OutputStream os = response.getOutputStream();
                    prescriptionService.pushListInspectDrugTotal(os, list,startTime,endTime);
                }
            }
@ -961,6 +968,9 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                list = prescriptionService.selectDrugTotal(startTime,endTime);
            }else if (type.equalsIgnoreCase("6")){
                list = prescriptionService.selectPrescriptionFeeTotal(startTime,endTime);
            }else if (type.equalsIgnoreCase("7")){
                //检查汇总表
                list = prescriptionService.selectInspectTotal(startTime,endTime);
            }
            if (businessType.equalsIgnoreCase("2")){
                if (type.equalsIgnoreCase("1")){