ソースを参照

处方记录适配器

zdm 6 年 前
コミット
31cf8cf008

+ 72 - 76
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -199,7 +199,7 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public Map<String,WlyyPrescriptionVO> BS16017ReturnObj(String REGISTER_SN,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
    public List<WlyyPrescriptionVO>  BS16017ReturnObj(String REGISTER_SN,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        String fid=BS16017;
        String resp = "";
        if (demoFlag) {
@ -234,15 +234,16 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public Map<String,WlyyPrescriptionVO> convertWlyyPrescriptionVOInBodyRow(String obj)throws Exception{
    public List<WlyyPrescriptionVO>  convertWlyyPrescriptionVOInBodyRow(String obj)throws Exception{
        net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo) {
                //处方实体
                WlyyPrescriptionVO wlyyPrescriptionVO=new WlyyPrescriptionVO();
                //用于存放已解析的处方
                Map<String, WlyyPrescriptionVO> wlyyPrescriptionVOMap = new HashMap<>();
                //用于存放已解析的诊断
                Map<String, String> wlyyPrescriptionDiagnosisVOHashMap = new HashMap<>();
                //诊断list
                List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
@ -258,84 +259,80 @@ public class EntranceService {
                        if (null != jsonObjectBody) {
                            //诊断
                            WlyyPrescriptionDiagnosisVO wlyyPrescriptionDiagnosisVO;
                            if (null != jsonObjectBody.get("YP_FLAG")) {
                                //是否为药品:0否,1是
                                String ypFlag =jsonObjectBody.get("YP_FLAG").toString();
                                Set<String> stringSet = new HashSet<>();
                                if ("1".equals(ypFlag) ) {
                                    String realOrder = null != jsonObjectBody.get("real_order") ? jsonObjectBody.get("real_order").toString() : "";
                                    if (!(null != stringSet && stringSet.contains(realOrder))) {
                                        wlyyPrescriptionVO = initWlyyPrescriptionVo(new WlyyPrescriptionVO(), jsonObjectBody, realOrder);
                                        wlyyPrescriptionVOMap.put(realOrder, wlyyPrescriptionVO);
                                        //主诊断 毒蛇咬伤&T63.001
                                        String[] icdName = jsonObjectBody.get("icd_name").toString().split("&");
                                        String[] diagTwo = jsonObjectBody.get("diag_two").toString().toString().split("&");
                                        String[] diagThree = jsonObjectBody.get("diag_three").toString().toString().split("&");
                                        String[] diagFour = jsonObjectBody.get("diag_four").toString().toString().split("&");
                                        String[] diagFive = jsonObjectBody.get("diag_five").toString().toString().split("&");
                                        if (null != icdName && icdName.length > 1&&!wlyyPrescriptionDiagnosisVOHashMap.containsKey(icdName[1].toString())) {
                                            //主诊断
                                            wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, icdName[0].toString(), icdName[1].toString(), 1);
                                            wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                            wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                        }
                                        if (null != diagTwo && diagTwo.length > 1&&!wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagTwo[1].toString())) {
                                            //第二诊断
                                            wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagTwo[0].toString(), diagTwo[1].toString(), 2);
                                            wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                            wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                        }
                                        if (null != diagThree && diagThree.length > 1&&!wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagThree[1].toString())) {
                                            //第三诊断
                                            wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagThree[0].toString(), diagThree[1].toString(), 2);
                                            wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                        }
                                        if (null != diagFour && diagFour.length > 1&&!wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagFour[1].toString())) {
                                            //第四诊断
                                            wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagFour[0].toString(), diagFour[1].toString(), 2);
                                            wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                            wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                        }
                                        if (null != diagFive && diagFive.length > 1&&!wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagFive[1].toString())) {
                                            //第五诊断
                                            wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagFive[0].toString(), diagFive[1].toString(), 2);
                                            wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                            wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                        }
                                    } else {
                                        wlyyPrescriptionVO = wlyyPrescriptionVOMap.get(realOrder);
                            //是否为药品:0否,1是
                            String ypFlag = null != jsonObjectBody.get("YP_FLAG") ? jsonObjectBody.get("YP_FLAG").toString() : "";
                            Set<String> stringSet = new HashSet<>();
                            if ("1".equals(ypFlag)) {
                                //处方号
                                String realOrder = null != jsonObjectBody.get("real_order") ? jsonObjectBody.get("real_order").toString() : "";
                                if (!(null != stringSet && stringSet.contains(realOrder))) {
                                    //初始化处方
                                    wlyyPrescriptionVO = initWlyyPrescriptionVo(new WlyyPrescriptionVO(), jsonObjectBody, realOrder);
                                    wlyyPrescriptionVOMap.put(realOrder, wlyyPrescriptionVO);
                                    //主诊断 毒蛇咬伤&T63.001
                                    String[] icdName = jsonObjectBody.get("icd_name").toString().split("&");
                                    String[] diagTwo = jsonObjectBody.get("diag_two").toString().toString().split("&");
                                    String[] diagThree = jsonObjectBody.get("diag_three").toString().toString().split("&");
                                    String[] diagFour = jsonObjectBody.get("diag_four").toString().toString().split("&");
                                    String[] diagFive = jsonObjectBody.get("diag_five").toString().toString().split("&");
                                    if (null != icdName && icdName.length > 1 && !wlyyPrescriptionDiagnosisVOHashMap.containsKey(icdName[1].toString())) {
                                        //主诊断
                                        wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, icdName[0].toString(), icdName[1].toString(), 1);
                                        wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                        wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                    }
                                    if (null != diagTwo && diagTwo.length > 1 && !wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagTwo[1].toString())) {
                                        //第二诊断
                                        wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagTwo[0].toString(), diagTwo[1].toString(), 2);
                                        wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                        wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                    }
                                    if (null != diagThree && diagThree.length > 1 && !wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagThree[1].toString())) {
                                        //第三诊断
                                        wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagThree[0].toString(), diagThree[1].toString(), 2);
                                        wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                    }
                                    if (null != diagFour && diagFour.length > 1 && !wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagFour[1].toString())) {
                                        //第四诊断
                                        wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagFour[0].toString(), diagFour[1].toString(), 2);
                                        wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                        wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                    }
                                    if (null != diagFive && diagFive.length > 1 && !wlyyPrescriptionDiagnosisVOHashMap.containsKey(diagFive[1].toString())) {
                                        //第五诊断
                                        wlyyPrescriptionDiagnosisVO = initWlyyPrescriptionDiagnosisVO(realOrder, diagFive[0].toString(), diagFive[1].toString(), 2);
                                        wlyyPrescriptionDiagnosisVOS.add(wlyyPrescriptionDiagnosisVO);
                                        wlyyPrescriptionDiagnosisVOHashMap.put(icdName[1].toString(), icdName[0].toString());
                                    }
                                    stringSet.add(realOrder);
                                    //药品
                                    wlyyPrescriptionInfoVO = new WlyyPrescriptionInfoVO();
                                    wlyyPrescriptionInfoVO.setPrescriptionId(realOrder);
                                    wlyyPrescriptionInfoVO.setDrugNo(null != jsonObjectBody.get("DRUG_CODE") ? jsonObjectBody.get("DRUG_CODE").toString() : "");
                                    wlyyPrescriptionInfoVO.setDrugName(null != jsonObjectBody.get("DRUG_NAME") ? jsonObjectBody.get("DRUG_NAME").toString() : "");
                                    wlyyPrescriptionInfoVO.setDispDeposite(null != jsonObjectBody.get("DISP_DEPOSITE") ? jsonObjectBody.get("DISP_DEPOSITE").toString() : "");
                                    wlyyPrescriptionInfoVO.setDosage(null != jsonObjectBody.get("YPYL00") ? jsonObjectBody.get("YPYL00").toString() : "");
                                    wlyyPrescriptionInfoVO.setQuantity(null != jsonObjectBody.get("DRUG_QTY") ? jsonObjectBody.get("DRUG_QTY").toString() : "");
                                    wlyyPrescriptionInfoVO.setUnit(null != jsonObjectBody.get("DCYYDW") ? jsonObjectBody.get("DCYYDW").toString() : "");
                                    wlyyPrescriptionInfoVO.setUsage(null != jsonObjectBody.get("YPPL00") ? jsonObjectBody.get("YPPL00").toString() : "");
                                    wlyyPrescriptionInfoVO.setSupplyCode(null != jsonObjectBody.get("YPYF00") ? jsonObjectBody.get("YPYF00").toString() : "");
                                    wlyyPrescriptionInfoVO.setDays(null != jsonObjectBody.get("days") ? jsonObjectBody.get("days").toString() : "");
                                    wlyyPrescriptionInfoVO.setFrequency(null != jsonObjectBody.get("frequency") ? jsonObjectBody.get("frequency").toString() : "");
                                    wlyyPrescriptionInfoVO.setDel(1);
                                    wlyyPrescriptionInfoVOS.add(wlyyPrescriptionInfoVO);
                                } else {
                                    wlyyPrescriptionVO = wlyyPrescriptionVOMap.get(realOrder);
                                }
                                //药品
                                wlyyPrescriptionInfoVO = new WlyyPrescriptionInfoVO();
                                wlyyPrescriptionInfoVO.setPrescriptionId(realOrder);
                                wlyyPrescriptionInfoVO.setDrugNo(null != jsonObjectBody.get("DRUG_CODE") ? jsonObjectBody.get("DRUG_CODE").toString() : "");
                                wlyyPrescriptionInfoVO.setDrugName(null != jsonObjectBody.get("DRUG_NAME") ? jsonObjectBody.get("DRUG_NAME").toString() : "");
                                wlyyPrescriptionInfoVO.setDispDeposite(null != jsonObjectBody.get("DISP_DEPOSITE") ? jsonObjectBody.get("DISP_DEPOSITE").toString() : "");
                                wlyyPrescriptionInfoVO.setDosage(null != jsonObjectBody.get("YPYL00") ? jsonObjectBody.get("YPYL00").toString() : "");
                                wlyyPrescriptionInfoVO.setQuantity(null != jsonObjectBody.get("DRUG_QTY") ? jsonObjectBody.get("DRUG_QTY").toString() : "");
                                wlyyPrescriptionInfoVO.setUnit(null != jsonObjectBody.get("DCYYDW") ? jsonObjectBody.get("DCYYDW").toString() : "");
                                wlyyPrescriptionInfoVO.setUsage(null != jsonObjectBody.get("YPPL00") ? jsonObjectBody.get("YPPL00").toString() : "");
                                wlyyPrescriptionInfoVO.setSupplyCode(null != jsonObjectBody.get("YPYF00") ? jsonObjectBody.get("YPYF00").toString() : "");
                                wlyyPrescriptionInfoVO.setDays(null != jsonObjectBody.get("days") ? jsonObjectBody.get("days").toString() : "");
                                wlyyPrescriptionInfoVO.setFrequency(null != jsonObjectBody.get("frequency") ? jsonObjectBody.get("frequency").toString() : "");
                                wlyyPrescriptionInfoVO.setDel(1);
                                wlyyPrescriptionInfoVOS.add(wlyyPrescriptionInfoVO);
                            }
//                            jsonArray.add(jsonObjectBody.get("row"));
                        }
                    } else {
                        return null;
                    }
                    wlyyPrescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                    wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                }
                return wlyyPrescriptionVOMap;
                Collection<WlyyPrescriptionVO> wlyyPrescriptionVOCollection=wlyyPrescriptionVOMap.values();
                return new ArrayList<WlyyPrescriptionVO>(wlyyPrescriptionVOCollection);
            }else {
                return null;
            }
@ -357,12 +354,11 @@ public class EntranceService {
        wlyyPrescriptionVO.setSerialNo(null != jsonObjectBody.get("REGISTER_SN") ? jsonObjectBody.get("REGISTER_SN").toString() : "");
        wlyyPrescriptionVO.setType(1);
        wlyyPrescriptionVO.setPatientCode(null != jsonObjectBody.get("PAT_NO") ? jsonObjectBody.get("PAT_NO").toString() : "");
        //TODO 通过居民唯一号获取居民姓名
        wlyyPrescriptionVO.setPatientName(null != jsonObjectBody.get("UOM") ? jsonObjectBody.get("UOM").toString() : "");
        //TODO 通过映射表获取居民身份证号
        wlyyPrescriptionVO.setIdcard(null != jsonObjectBody.get("ADM_NO") ? jsonObjectBody.get("ADM_NO").toString() : "");
        //TODO 通过映射表获取居民身份证号e
        wlyyPrescriptionVO.setIdcard("");
        //TODO 社保卡号
        wlyyPrescriptionVO.setSsc(null != jsonObjectBody.get("YP_FLAG") ? jsonObjectBody.get("YP_FLAG").toString() : "");
        wlyyPrescriptionVO.setSsc("");
        wlyyPrescriptionVO.setHisDoctorCode(null != jsonObjectBody.get("PRESC_DOC") ? jsonObjectBody.get("PRESC_DOC").toString() : "");
        wlyyPrescriptionVO.setHisDeptCode(null != jsonObjectBody.get("PRESC_SPEC") ? jsonObjectBody.get("PRESC_SPEC").toString() : "");
        return  wlyyPrescriptionVO;

+ 3 - 3
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -74,15 +74,15 @@ public class MqSdkController extends EnvelopRestEndpoint {
    @GetMapping(value = "/BS16017ListObj")
    @ApiOperation(value = "根据流水号或者居民id查找门诊处方信息(所有处方)")
    public Map<String,WlyyPrescriptionVO> BS16017ListObj(
    public ListEnvelop BS16017ListObj(
            @ApiParam(name = "registerSn", value = "流水号", required = false)
            @RequestParam(value = "registerSn",required = false) String registerSn,
            @ApiParam(name = "patNo", value = "病人id", required = false)
            @RequestParam(value = "patNo",required = false) String patNo,
            @ApiParam(name = "admNo", value = "住院唯一号", required = false)
            @RequestParam(value = "admNo",required = false) String admNo) throws Exception {
        Map<String,WlyyPrescriptionVO> BS16017ReturnObj= entranceService.BS16017ReturnObj(registerSn, patNo, admNo, demoFlag);
        return BS16017ReturnObj;
        List<WlyyPrescriptionVO>  BS16017ReturnObj= entranceService.BS16017ReturnObj(registerSn, patNo, admNo, demoFlag);
        return success(BS16017ReturnObj);
    }
    @GetMapping(value = "/BS30025")