Przeglądaj źródła

同安医院号源查询

wangjun 3 lat temu
rodzic
commit
77bd629127

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

@ -11698,6 +11698,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            List<WlyyHospitalSysDictDO> tasyList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
            String deptCode = "0001";
            String staffNo = "0001";
            String regDept="";
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:tasyList){
                if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"deptCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    deptCode = wlyyHospitalSysDictDO.getDictValue();
@ -11705,11 +11706,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"staffNo".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    staffNo = wlyyHospitalSysDictDO.getDictValue();
                }
                if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"regDept".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    regDept = wlyyHospitalSysDictDO.getDictValue();
                }
            }
            //先预约号源
            String regRes=tasyNatService.saveRegOrder(regDept,natTime,pm,preNo,cardNo,mobile,name,"3");
            com.alibaba.fastjson.JSONObject regObj = com.alibaba.fastjson.JSONObject.parseObject(regRes);
            String HisSeqNo="";
            String orderNum="";
            if (regObj!=null){
                if ("true".equalsIgnoreCase(regObj.getString("success"))){
                    com.alibaba.fastjson.JSONObject dataObj = com.alibaba.fastjson.JSONObject.parseObject(regObj.getString("data"));
                    HisSeqNo=dataObj.getString("HisSeqNo");
                    orderNum=dataObj.getString("OrderNumber");
                }else {
                    returnMap.put("msg",regObj.getString("msg"));
                    returnMap.put("status","-1");
                    return  returnMap;
                }
            }
            //先进行核算检测预约
            String realOrder="";
            String addressNow=provinceName+cityName+townName+streetName+address;
            String result = tasyNatService.initNatParams(preNo,name,mediaCard,addressNow,firstJobCode,secondJobCode);
            String result = tasyNatService.initNatParams(HisSeqNo,name,mediaCard,addressNow,firstJobCode,secondJobCode);
            Boolean flag = false;
            if (StringUtils.isNoneBlank(result)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
@ -11735,11 +11755,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                baseNatAppointmentDO.setChargeAmount(chargeAmount);
                baseNatAppointmentDO.setMedicare(mediaCard);
                baseNatAppointmentDO.setRegisterNo(HisSeqNo);
                baseNatAppointmentDO.setName(name);
                baseNatAppointmentDO.setCardNo(cardNo);
                baseNatAppointmentDO.setCardType(cardType);
                baseNatAppointmentDO.setAddress(address);
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO.setVoucherNo(orderNum);
                baseNatAppointmentDO.setCityName(cityName);
                baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                baseNatAppointmentDO.setFirstJobName(firstJobName);
@ -12218,6 +12240,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            //取消号源
                            tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getVoucherNo());
                            tasyNatService.cancelNat(baseNatAppointmentDO.getRealOrder(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getName());
                        }
                    }

+ 87 - 12
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TasyNatService.java

@ -36,10 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
@Transactional
@ -504,7 +501,7 @@ public class TasyNatService {
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setRequest(req);
        wlyyHttpLogDO.setName(name);
        wlyyHttpLogDO.setCode(code);
        //wlyyHttpLogDO.setCode(code);
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setResponse(res);
        wlyyHttpLogDao.save(wlyyHttpLogDO);
@ -569,12 +566,90 @@ public class TasyNatService {
        }
        return "";
    }
    public static void main(String[] args) throws Exception{
        String xml="<StringResponse><StringValue><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><ReturnCode>1</ReturnCode><hisTradeNo>599907010</hisTradeNo><ReturnMsg></ReturnMsg></root>]]></StringValue></StringResponse>";
        xml=xml.substring(xml.indexOf("<root>"),xml.lastIndexOf("]]"));
        System.out.println(xml);
    //查询排班部门
    public String departMent(String ApplyType){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("DepartMentUrl");
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        url+="?ApplyType="+ApplyType;
        System.out.println(url);
        String response = httpClientUtil.get(url,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("departMent",ApplyType,response,url);
        return response;
    }
    //保存预约
    public String saveRegOrder(String DepartId,String OrderDate,String OrderTime,String OrderID,String HisID,String Tel,
                               String HisName,String ApplyType){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("saveNatOrderUrl");
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        url+="?DepartId="+DepartId+"&OrderDate="+OrderDate+"&OrderTime="+OrderTime+"&OrderID="+OrderID
                +"&HisID="+HisID+"&Tel="+Tel+"&HisName="+HisName+"&ApplyType="+ApplyType;
        System.out.println(url);
        String response = httpClientUtil.get(url,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("saveRegOrder",url,response,url);
        return response;
    }
    //取消预约
    public String cancleOrder(String HisID,String HisSeqNo,String OrderNumber){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("CancleOrderUrl");
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        url+="?HisID="+HisID+"&HisSeqNo="+HisSeqNo+"&OrderNumber="+OrderNumber;
        System.out.println(url);
        String response = httpClientUtil.get(url,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("cancleOrder",url,response,url);
        return response;
    }
    //查询排班医生
    public String GetDoctorWorkDate(String ApplyType,String DepartId){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetDoctorWorkDateUrl");
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        url+="?ApplyType="+ApplyType+"&DepartId="+DepartId;
        System.out.println(url);
        String response = httpClientUtil.get(url,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("departMent",url,response,url);
        return response;
    }
    //预约查询
    public String GetOrderInfo(String HisID,String ApplyType){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetOrderInfoUrl");
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        url+="?ApplyType="+ApplyType+"&HisID="+HisID;
        System.out.println(url);
        String response = httpClientUtil.get(url,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("departMent",url,response,url);
        return response;
    }
    //获取号源
    public String GetOrderSource(String DepartId,String DoctorId,String QueryDate,String ApplyType,String IsAll,String QueryTime){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetOrderSourceUrl");
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
        url+="?DepartId="+DepartId+"&DoctorId="+DoctorId+"&QueryDate="+QueryDate+"&ApplyType="+ApplyType+"&IsAll="+IsAll+"&QueryTime="+QueryTime;
        System.out.println(url);
        String response = httpClientUtil.get(url,"UTF-8");
        System.out.println("res"+response);
        saveHttpLog("GetOrderInfo",url,response,url);
        return response;
    }
}

+ 90 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -81,6 +81,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.xml.XMLSerializer;
import org.apache.axis.utils.StringUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.http.NameValuePair;
@ -2276,6 +2277,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            if ("tmpPush".equalsIgnoreCase(api)){
                return success("操作成功",tasyNatService.tmpPush(jsonObject));
            }
            if ("CancleOrder".equalsIgnoreCase(api)){
                return success("操作成功",tasyNatService.cancleOrder(jsonObject.getString("HisID"),jsonObject.getString("no"),jsonObject.getString("OrderNumber")));
            }
            if ("GetOrderInfo".equalsIgnoreCase(api)){
                return success("操作成功",tasyNatService.GetOrderInfo(jsonObject.getString("HisID"),jsonObject.getString("ApplyType")));
            }
            return success("");
        } catch (Exception e){
            return  failedException(e);
@ -2401,4 +2408,87 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/BS10142")
    public ListEnvelop BS10142(
            @ApiParam(name = "deptCode", value = "deptCode")
            @RequestParam(value = "deptCode",required = false)String deptCode,
            @ApiParam(name = "docCode", value = "docCode")
            @RequestParam(value = "docCode",required = false)String docCode,
            @ApiParam(name = "chargeType", value = "chargeType")
            @RequestParam(value = "chargeType",required = false)String chargeType) throws Exception {
        if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            return success(entranceService.BS10142(deptCode,docCode,chargeType,false));
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String res=tasyNatService.departMent(deptCode);
            String dept="";
            JSONObject deptres = JSON.parseObject(res);
            if (deptres!=null){
                if (deptres.getString("success").equalsIgnoreCase("true")){
                    JSONObject data = JSON.parseObject(deptres.getString("data"));
                    dept=data.getString("Dept");
                    com.alibaba.fastjson.JSONArray jsonArray1 = JSON.parseArray(dept);
                    if (jsonArray1!=null&&jsonArray1.size()>0){
                        JSONObject jsonObject = jsonArray1.getJSONObject(0);
                        dept=jsonObject.getString("Id");
                        System.out.println(dept);
                    }
                    String json=tasyNatService.GetDoctorWorkDate("3",dept);
                    JSONObject jsonObject = JSON.parseObject(json);
                    jsonObject.put("dept",dept);
                    com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
                    jsonArray.add(jsonObject);
                    return success(jsonArray);
                }else {
                    return ListEnvelop.getError("获取部门编码失败");
                }
            }else {
                return ListEnvelop.getError("无效部门");
            }
        }else {
            return ListEnvelop.getError("未开放");
        }
    }
    @GetMapping("/BS10143")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "day")
                               @RequestParam(value = "day",required = false)String day,
                               @ApiParam(name = "dept", value = "dept")
                               @RequestParam(value = "dept",required = false)String dept,
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor",required = false)String doctor,
                               @ApiParam(name = "IsAll", value = "IsAll")
                               @RequestParam(value = "IsAll",required = false)String IsAll,
                               @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm",required = false)String pm) throws Exception {
        if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            return success(entranceService.BS10143(day,pm,false));
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String res=tasyNatService.GetOrderSource(dept,doctor,day,"3",IsAll,pm);
            String xml="";
            if (!StringUtils.isEmpty(res)){
                JSONObject jsonObject = JSON.parseObject(res);
                System.out.println("====="+jsonObject.getString("success"));
                if (jsonObject!=null&&jsonObject.getString("success").equalsIgnoreCase("true")){
                    xml=jsonObject.getString("data");
                    XMLSerializer xmlSerializer = new XMLSerializer();
                    String json = xmlSerializer.read(xml).toString();
                    JSONObject jsonObjectRes = JSON.parseObject(json);
                    com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
                    jsonArray.add(jsonObjectRes);
                    return success(jsonArray);
                }
            }
            return ListEnvelop.getError("查询失败");
        }else {
            return ListEnvelop.getError("未开放");
        }
    }
    @GetMapping("/DepartMent")
    public Envelop DepartMent(
            @ApiParam(name = "DepartMent", value = "DepartMent")
            @RequestParam(value = "DepartMent",required = false)String DepartMent) throws Exception {
        return success("查询成功",tasyNatService.departMent(DepartMent));
    }
}

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

@ -1,5 +1,6 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.area.service.BaseCityService;
@ -49,6 +50,7 @@ import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -132,6 +134,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private EntranceService entranceService;
    @Autowired
    private BaseOperateLogService baseOperateLogService;
    @Autowired
    private TasyNatService tasyNatService;
    @Value("${qywx.id}")
    private String qywxId;
@ -2873,14 +2877,61 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "docCode",required = false)String docCode,
            @ApiParam(name = "chargeType", value = "chargeType")
            @RequestParam(value = "chargeType",required = false)String chargeType) throws Exception {
        return success(entranceService.BS10142(deptCode,docCode,chargeType,demoFlag));
        if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            return success(entranceService.BS10142(deptCode,docCode,chargeType,demoFlag));
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String res=tasyNatService.departMent(deptCode);
            String dept="";
            JSONObject deptres = JSON.parseObject(res);
            if (deptres!=null){
                if (deptres.getString("success").equalsIgnoreCase("true")){
                    JSONObject data = JSON.parseObject(deptres.getString("data"));
                    dept=data.getString("Dept");
                    JSONArray jsonArray1 = JSON.parseArray(dept);
                    if (jsonArray1!=null&&jsonArray1.size()>0){
                        JSONObject jsonObject = jsonArray1.getJSONObject(0);
                        dept=jsonObject.getString("Id");
                        System.out.println(dept);
                    }
                    String json=tasyNatService.GetDoctorWorkDate("3",dept);
                    JSONObject jsonObject = JSON.parseObject(json);
                    com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
                    jsonArray.add(jsonObject);
                    return success(jsonArray);
                }else {
                    return ListEnvelop.getError("获取部门编码失败");
                }
            }else {
                return ListEnvelop.getError("无效部门");
            }
        }else {
            return ListEnvelop.getError("未开放");
        }
    }
    @GetMapping("/BS10143")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "day")
                               @RequestParam(value = "day",required = false)String day,
                               @ApiParam(name = "dept", value = "dept")
                               @RequestParam(value = "dept",required = false)String dept,
                               @ApiParam(name = "doctor", value = "doctor")
                                   @RequestParam(value = "doctor",required = false)String doctor,
                               @ApiParam(name = "IsAll", value = "IsAll")
                                   @RequestParam(value = "IsAll",required = false)String IsAll,
                               @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm",required = false)String pm) throws Exception {
        return success(entranceService.BS10143(day,pm,demoFlag));
        if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            return success(entranceService.BS10143(day,pm,demoFlag));
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String xml=tasyNatService.GetOrderSource(dept,doctor,day,"3",IsAll,pm);
            XMLSerializer xmlSerializer = new XMLSerializer();
            String json = xmlSerializer.read(xml).toString();
            JSONArray jsonArray = JSON.parseArray(json);
            return success(jsonArray);
        }else {
            return ListEnvelop.getError("未开放");
        }
    }
    @GetMapping("/BS10144")
    public Envelop BS10144(@ApiParam(name = "deptCode", value = "deptCode")