ソースを参照

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

wangzhinan 1 年間 前
コミット
816ef4c281

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

@ -2808,9 +2808,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = com.alibaba.fastjson.JSONObject.parseObject(emrJson, WlyyPrescriptionEmrDO.class);
            wlyyPrescriptionEmrDO.setDel(1);
            wlyyPrescriptionEmrDO.setPrescriptionId(prescription.getId());
            prescriptionEmrDao.save(wlyyPrescriptionEmrDO);
            wlyyPrescriptionEmrDO = prescriptionEmrDao.save(wlyyPrescriptionEmrDO);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
                BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
                if (null!=basePatientDO){
                    object.put("patientAge",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
                    object.put("patientsex",IdCardUtil.getSexForIdcard(basePatientDO.getIdcard()));
                    object.put("patientName",basePatientDO.getName());
                    object.put("patientClan","0"); }
                if (null!=outpatientDO){
                    object.put("deptCode",outpatientDO.getDeptName());
                    object.put("outpatientCode",outpatientDO.getRegisterNo());
                    object.put("eventno","R"+outpatientDO.getRegisterNo());
                }
                com.alibaba.fastjson.JSONObject jsonObject = ykyyService.getSignPicture(outpatientDO.getDoctor());
                if (jsonObject!=null){
                    if (jsonObject.getString("code").equalsIgnoreCase("1000")){
                        com.alibaba.fastjson.JSONObject dataJson = jsonObject.getJSONObject("data");
                        object.put("baseSign",dataJson.getString("image"));
                    }
                }
                object.put("diseaseName",outpatientDO.getDiseaseName());
                ykyyPrescriptionService.returnEmrHtmlByHLW(object,wlyyPrescriptionEmrDO);
            }
        }
        //=====================电子病历=================================================end
        //=====================保存日志 start=========================================================
        List<WlyyPrescriptionCheckDO> prescriptionCheckDOS = prescriptionCheckDao.findByStatus(prescription.getId(), 5);

+ 80 - 8
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -26,11 +26,11 @@ import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationInvoiceDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
@ -52,7 +52,6 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
@ -64,13 +63,9 @@ import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import jdk.nashorn.internal.ir.IfNode;
import nuonuo.open.sdk.NNOpenSDK;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -78,7 +73,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -152,6 +147,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionEmrDao prescriptionEmrDao;
    private final static String saveUrl = "http://192.168.20.55:10023/ykyy/save";
    private final static String updateEntityUrl = "http://192.168.20.55:10023/ykyy/update";
@ -1824,6 +1821,81 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    //==========================视力报告结束====================================
    /**
     * 获取历史病历
     * @param patientId
     * @param eventNo
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> selectHistoryEmrFromEntrance(String patientId,String eventNo) throws Exception {
        JSONArray jsonArray = new JSONArray();
        String sql = "SELECT\n" +
                "\to.dept_name AS \"DEPT_NAME\",\n" +
                "\tto_char (\n" +
                "\t\to.register_date,\n" +
                "\t\t'YYYY-MM-DD hh24:mi:ss'\n" +
                "\t) AS \"TREAT_DATE_TIME\",\n" +
                "\temr.id AS \"OPID\",\n" +
                "\to.doctor_name AS \"TREAT_DOCTOR_NAME\"\n" +
                "FROM\n" +
                "\twlyy_outpatient o\n" +
                "LEFT JOIN wlyy_prescription p ON o.id = p.outpatient_id\n" +
                "LEFT JOIN wlyy_prescription_emr emr ON emr.prescription_id = p.id\n" +
                "where emr.id is not null\n" +
                "and o.PATIENT = '"+patientId+"' and emr.html_str is not null ";
        sql+=" ORDER BY o.CREATE_TIME DESC  ";
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        return maps;
    }
    /**
     * 查询病历文书html信息
     * @param bstrEmrID
     * @return
     */
    public WlyyPrescriptionEmrDO selectBrowseSingleEMR(String bstrEmrID) throws Exception {
        return prescriptionEmrDao.findOne(bstrEmrID);
    }
    /**
     * 同步门诊病历
     * @return
     */
    public WlyyPrescriptionEmrDO returnEmrHtmlByHLW(JSONObject jsonObject,WlyyPrescriptionEmrDO prescriptionEmrDO)throws Exception{
        String htmlDeo = "";
        if (null!=prescriptionEmrDO){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("EMRHTMLDEMO");
            if (null!=wlyyHospitalSysDictDO){
                htmlDeo = wlyyHospitalSysDictDO.getDictValue();
                htmlDeo = replaceHtml(htmlDeo,"@patientName@",jsonObject.getString("patientName"));
                htmlDeo = replaceHtml(htmlDeo,"@patientAge@",jsonObject.getString("patientAge"));
                htmlDeo = replaceHtml(htmlDeo,"@patientsex@",jsonObject.getString("patientsex"));
                htmlDeo = replaceHtml(htmlDeo,"@deptCode@",jsonObject.getString("deptCode"));
                htmlDeo = replaceHtml(htmlDeo,"@baseSign@",jsonObject.getString("baseSign"));
                htmlDeo = replaceHtml(htmlDeo,"@outpatientCode@",jsonObject.getString("outpatientCode"));
                htmlDeo = replaceHtml(htmlDeo,"@patientClan@",jsonObject.getString("patientClan"));
                htmlDeo = replaceHtml(htmlDeo,"@Special@",prescriptionEmrDO.getSpecialHistory());
                SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                htmlDeo = replaceHtml(htmlDeo,"@createTime@",sf.format(prescriptionEmrDO.getCreateTime()));
                htmlDeo = replaceHtml(htmlDeo,"@complaint@",prescriptionEmrDO.getComplaint());
                htmlDeo = replaceHtml(htmlDeo,"@diseaseName@",jsonObject.getString("diseaseName"));
                htmlDeo = replaceHtml(htmlDeo,"@medicalHistory@",prescriptionEmrDO.getMedicalHistory());
                htmlDeo = replaceHtml(htmlDeo,"@popularHistory@",prescriptionEmrDO.getPopularHistory());
                htmlDeo = replaceHtml(htmlDeo,"@pastHistory@",prescriptionEmrDO.getPastHistory());
                htmlDeo = replaceHtml(htmlDeo,"@allergicHistory@",prescriptionEmrDO.getAllergicHistory());
                htmlDeo = replaceHtml(htmlDeo,"@physicalExamination@",prescriptionEmrDO.getPhysicalExamination());
                htmlDeo = replaceHtml(htmlDeo,"@assistExamination@",prescriptionEmrDO.getAssistExamination());
            }
        }
        prescriptionEmrDO.setHtmlStr(htmlDeo);
        return prescriptionEmrDao.save(prescriptionEmrDO);
    }
 /*   public JSONObject select*/
    public String replaceHtml(String demoData,String oldChar,String newChar){
        return demoData.replace(oldChar,null==newChar?"无":newChar);
    }
}

+ 10 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -2193,9 +2193,15 @@ public class YkyyEntranceService {
            prescriptionId=prescriptionDO.getId();
        }
        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doctor);
        String deptCode=null;
        if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
            deptCode = doctorHospitalDOS.get(0).getDeptCode();
        String ksdm = "";
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        //操作工号
        JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
        if(jsonArray1!=null&&jsonArray1.size()>0){
            //获取医生信息
            JSONObject json = jsonArray1.getJSONObject(0);
            ksdm=json.getString("ksdm");
        }
        for (WlyyInspectionDO wlyyInspectionDO:inspectionDOS){
            YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
@ -2219,7 +2225,7 @@ public class YkyyEntranceService {
            ykEmrJcsqDO.setJclx(Integer.valueOf(wlyyInspectionDO.getCheckPart()));
            ykEmrJcsqDO.setXmdw(wlyyInspectionDO.getTotalUnit());
            ykEmrJcsqDO.setKdsj(new Date());
            ykEmrJcsqDO.setKdks(deptCode==null?0:Integer.parseInt(deptCode));
            ykEmrJcsqDO.setKdks(ksdm==null?0:Integer.parseInt(ksdm));
            ykEmrJcsqDOS.add(ykEmrJcsqDO);
        }

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionEmrDO.java

@ -68,6 +68,19 @@ public class WlyyPrescriptionEmrDO extends UuidIdentityEntityWithOperator {
     *特殊病史
     */
    private String specialHistory;
    private String htmlStr;
    @Column(name = "html_str")
    public String getHtmlStr() {
        return htmlStr;
    }
    public void setHtmlStr(String htmlStr) {
        this.htmlStr = htmlStr;
    }
    @Column(name = "popular_history")
    public String getPopularHistory() {
        return popularHistory;

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

@ -2704,7 +2704,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
                return ObjEnvelop.getSuccess("ok", hcyyPrescriptionService.selectHistoryEmrFromEntrance(patient, null));
            }  else if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                return ObjEnvelop.getSuccess("ok", hcyyPrescriptionService.selectHistoryEmrFromEntrance(patient, null));
                return ObjEnvelop.getSuccess("ok", ykyyPrescriptionService.selectHistoryEmrFromEntrance(patient, null));
            }else {
                return ObjEnvelop.getSuccess("ok", prescriptionService.outpatient(patient, doctorId));
            }
@ -2739,6 +2739,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                return ObjEnvelop.getSuccess("ok", xzzxEntranceService.selectBrowseSingleEMR(opid));
            }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
                return ObjEnvelop.getSuccess("ok", hcyyPrescriptionService.selectBrowseSingleEMR(opid));
            } else if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                return ObjEnvelop.getSuccess("ok", ykyyPrescriptionService.selectBrowseSingleEMR(opid));
            }  else {
                return ObjEnvelop.getSuccess("ok", prescriptionService.getPatInfoDataXml(opid, recSn));
            }