Browse Source

保存门诊医生

Trick 5 years ago
parent
commit
eea8b4a953

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

@ -3009,6 +3009,58 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return outpatient;
    }
    /**
     * 指定门诊医生医生
     * @param outpatientJson
     * @return
     * @throws Exception
     */
    public WlyyOutpatientDO saveOutpatientDoctor(String outpatientJson,String registerJson,String chargeType)throws Exception{
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        WlyyOutpatientDO one = outpatientDao.findOne(outpatientDO.getId());
        if(StringUtils.isNotBlank(one.getDoctor())){
            throw new RuntimeException("已有医生接诊");
        }
        one.setDoctor(outpatientDO.getDoctor());
        one.setDoctorName(outpatientDO.getDoctorName());
        one.setRegisterDate(outpatientDO.getRegisterDate());
        one.setDept(outpatientDO.getDept());
        one.setDeptName(outpatientDO.getDeptName());
        WlyyOutpatientDO outpatient = outpatientDao.save(one);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
            //如果是视频预约咨询
            if(StringUtils.isNotBlank(registerJson)){
                registerTimeDO = objectMapper.readValue(registerJson,WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
            }
        }catch (Exception e){
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        //更新候诊室
        List<WlyyHospitalWaitingRoomDO> roomDOs = hospitalWaitingRoomDao.findByOutpatientId(outpatientDO.getId());
        if(roomDOs!=null&&roomDOs.size()>0){
            for(WlyyHospitalWaitingRoomDO room:roomDOs){
                room.setDept(outpatientDO.getDept());
                room.setDeptName(outpatientDO.getDeptName());
                room.setDoctor(outpatientDO.getDoctor());
                room.setDoctorName(outpatientDO.getDoctorName());
                room.setChargeType(chargeType);
            }
            hospitalWaitingRoomDao.save(roomDOs);
        }
        return outpatient;
    }
    /**
     * 验证电子健康卡授权

+ 5 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -221,6 +221,11 @@ public class BaseHospitalRequestMapping {
         */
        public static final String cooperativeOutpatient = "/cooperativeOutpatient";
        /**
         * 设置门诊医生
         */
        public static final String saveOutpatientDoctor = "/saveOutpatientDoctor";
        /**
         * 验证授权
         */

+ 4 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -116,15 +116,16 @@ public class OauthYlzConfigService {
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
            InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
            String QRCodeImg = ByteToInputStream.getBase64FromInputStream(qrcode);
            ByteToInputStream byteToInputStream = new ByteToInputStream();
            String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
            Map<String,Object> map = new HashedMap();
            map.put("QRCodeImg","data:image/png;base64,"+ QRCodeImg);
            map.put("out_authorize_no",no);
            return map;
        } catch (Exception var5) {
            var5.printStackTrace();
        } catch (Exception e) {
            logger.error(e.toString());
        }
        return null;

+ 5 - 5
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ByteToInputStream.java

@ -16,11 +16,11 @@ public class ByteToInputStream {
    private static final Logger logger = LoggerFactory.getLogger(ByteToInputStream.class);
    public static final InputStream byte2Input(byte[] buf) {
    public InputStream byte2Input(byte[] buf) {
        return new ByteArrayInputStream(buf);
    }
    public static final byte[] input2byte(InputStream inStream)
    public byte[] input2byte(InputStream inStream)
            throws IOException {
        ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
        byte[] in2b = null;
@ -41,7 +41,7 @@ public class ByteToInputStream {
        return in2b;
    }
    public static String getBase64FromInputStream(InputStream in) {
    public String getBase64FromInputStream(InputStream in) {
        // 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
        byte[] data = null;
        // 读取图片字节数组
@ -54,13 +54,13 @@ public class ByteToInputStream {
            }
            data = swapStream.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
            logger.error("ByteToInputStream.getBase64FromInputStream:"+e.toString());
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    logger.error(e.toString());
                }
            }
        }

+ 12 - 0
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.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
@ -537,6 +538,17 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveOutpatientDoctor)
    @ApiOperation(value = "发起协同门诊", notes = "发起协同门诊")
    public ObjEnvelop saveOutpatientDoctor(@ApiParam(name = "outpatientJson", value = "复诊实体json")
                                             @RequestParam(value = "outpatientJson", required = true)String outpatientJson,
                                             @ApiParam(name = "registerJson", value = "预约实体json")
                                             @RequestParam(value = "registerJson", required = false)String registerJson,
                                             @ApiParam(name = "chargeType", value = "号别")
                                             @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        return success(prescriptionService.saveOutpatientDoctor(outpatientJson,registerJson,chargeType));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOauthQRCode)
    @ApiOperation(value = "验证授权", notes = "验证授权")
    public ObjEnvelop checkOauthQRCode(@ApiParam(name = "authorizeNo", value = "流水编号")