Forráskód Böngészése

三院患者诊前档案开发

wangzhinan 2 hete
szülő
commit
e09f757c46

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

@ -805,6 +805,42 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return object;
    }
    /**
     * 账户建档接口
     * @param operatorName 操作者姓名
     * @param userName 姓名
     * @param idNo 身份证
     * @param gend 性别 1男 2女
     * @param phone 手机号
     * @param cardType 01社保卡 其他自费
     * @return
     * @throws Exception
     */
    public JSONObject buildAccountAllToHospital(String operatorName,String userName,String idNo,String gend,String phone,String cardNo,String cardType,String addr,String age) throws Exception {
        String url = entranceUrl +"buildAccount";
        JSONObject object = new JSONObject();
        Map<String,Object> params = new HashedMap();
        params.put("operatorName",operatorName);
        params.put("userName",userName);
        params.put("idNo",idNo);
        params.put("gend",gend);
        params.put("phone",phone);
        params.put("cardNo",cardNo);
        params.put("cardType",cardType);
        params.put("addr",addr);
        params.put("age",age);
        HttpResponse response = HttpUtils.doPost(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            object = rs.getJSONObject("obj");
        }
        return object;
    }
    /**
     * 3.12住院申请单保存(门诊收入住院)
     *

+ 8 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java

@ -2084,7 +2084,7 @@ public class DsyyEntranceService {
     * @return
     * @throws Exception
     */
    public String buildAccount(String userName,String idNo,String gend,String phone,String cardNo,String cardType) throws  Exception{
    public String buildAccount(String userName,String idNo,String gend,String phone,String cardNo,String cardType,String addr,String age) throws  Exception{
        String api = "build_account";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
@ -2118,9 +2118,14 @@ public class DsyyEntranceService {
        if (StringUtils.isNoneBlank(cardType)){
            object.put("cardType",cardType);
        }
        if (!StringUtils.isNoneBlank(cardNo)){
            object.put("certType","6");
        if (!StringUtils.isNoneBlank(addr)){
            object.put("addr",addr);
        }
        if (!StringUtils.isNoneBlank(age)){
            object.put("age",age);
        }
        condition = object.toJSONString();
        String msgBody =condition;
        Map<String,String> params = new HashedMap();

+ 47 - 16
business/base-service/src/main/java/com/yihu/jw/patient/service/PatientPreDiagnosisInfoService.java

@ -2,11 +2,15 @@ package com.yihu.jw.patient.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.device.dao.DevicePatientHealthIndexDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.patient.PatientPreDiagnosisInfoDO;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyRecordDO;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
@ -14,11 +18,16 @@ import com.yihu.jw.patient.dao.PatientPreDiagnosisInfoDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.encrypt.MD5;
import com.yihu.jw.util.entity.ServiceException;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisServer;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -40,12 +49,16 @@ public class PatientPreDiagnosisInfoService extends BaseJpaService<PatientPreDia
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    @Autowired
    private DevicePatientHealthIndexDao patientHealthIndexDao;
    //诊前信息分页
    public PageEnvelop findByPage(String name,String mobile,String idcard,String chargeType,String fromSource,String systolicPressureStart
            ,String diastolicPressureStart,String systolicPressureEnd,String diastolicPressureEnd,String startTime,String endTime,int page,int size){
        String sql = "select * ";
        String countSql = "selcet count(*) ";
        String countSql = "select count(*) ";
        String filter = " from base_patient_pre_diagnosis_info where 1=1 ";
        String orderBy = " order by id desc limit "+(page-1)*size+","+size;
        if(StringUtils.isNotBlank(name)){
@ -87,15 +100,31 @@ public class PatientPreDiagnosisInfoService extends BaseJpaService<PatientPreDia
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    //保存患者档案
    public PatientPreDiagnosisInfoDO savePreDiagnosisInfo(PatientPreDiagnosisInfoDO infoDO) throws Exception{
        String idcard = infoDO.getIdcard();
        if(StringUtils.isNotBlank(infoDO.getIdcard())){
        if(!StringUtils.isNotBlank(infoDO.getIdcardType())){
            throw new ServiceException("请输入证件类型");
        }
        String cardType = infoDO.getIdcardType();
        String mobile = infoDO.getMobile();
        BasePatientDO patient = patientDao.findByIdcard(infoDO.getIdcard());
        String address = infoDO.getProvinceName()+infoDO.getCityName()+infoDO.getTownName()+infoDO.getStreetName()+infoDO.getAddress();
        JSONObject object = dsyyPrescriptionService.queryCardListToHospital("",infoDO.getIdcard());
        if (object!=null){
            if (object.getString("retCode").equalsIgnoreCase("00")){
                com.alibaba.fastjson.JSONArray array = object.getJSONArray("cardlist");
                if (array==null||array.size()==0){
                    JSONObject jsonObject = dsyyPrescriptionService.buildAccountAllToHospital(infoDO.getName(),infoDO.getName(),infoDO.getIdcard(),infoDO.getSex(),infoDO.getMobile(),infoDO.getCardNo(),infoDO.getChargeType(),address,infoDO.getAge());
                    if("00".equals(object.getString("retCode"))){
                        System.out.println("注册成功"+infoDO.getName());
                    }
                }
            }
        }
        if(patient==null){
            patient = new BasePatientDO();
            String salt = UUID.randomUUID().toString().substring(0, 5);
@ -132,9 +161,8 @@ public class PatientPreDiagnosisInfoService extends BaseJpaService<PatientPreDia
            PatientMedicareCardDO medicareCardDO = new PatientMedicareCardDO();
            medicareCardDO.setDel("1");
            medicareCardDO.setParentType("A");
            medicareCardDO.setType("A_01");
            medicareCardDO.setType("A_"+infoDO.getChargeType());
            medicareCardDO.setPatientCode(temp.getId());
            basePatientMedicareCardDao.save(medicareCardDO);
            WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
            wlyyPatientFamilyMemberDO.setIsDel(1);
@ -150,6 +178,19 @@ public class PatientPreDiagnosisInfoService extends BaseJpaService<PatientPreDia
        infoDO.setPatient(patient.getId());
        infoDO.setCreateTime(new Date());
        infoDO = patientPreDiagnosisInfoDao.save(infoDO);
        DevicePatientHealthIndex patientHealthIndex = new DevicePatientHealthIndex();
        patientHealthIndex.setCzrq(new Date());
        patientHealthIndex.setUser(infoDO.getPatient());
        patientHealthIndex.setType(2);
        patientHealthIndex.setValue2(infoDO.getDiastolicPressure());//舒张压
        patientHealthIndex.setValue1(infoDO.getSystolicPressure());//收缩压
        patientHealthIndex.setRecordDate(new Date());
        patientHealthIndex.setSortDate(new Date());
        patientHealthIndex.setStatus(0);
        patientHealthIndex.setDel("1");
        patientHealthIndex.setIsUpload(0);
        patientHealthIndex.setIdcard(infoDO.getIdcard());
        patientHealthIndexDao.save(patientHealthIndex);
        return infoDO;
    }
@ -158,22 +199,12 @@ public class PatientPreDiagnosisInfoService extends BaseJpaService<PatientPreDia
        return patientPreDiagnosisInfoDao.getOne(id);
    }
    //读卡
    public JSONObject cardReading(String cardNo){
        PatientPreDiagnosisInfoDO preDiagnosisInfoDO = patientPreDiagnosisInfoDao.getOne(1L);
        JSONObject json = (JSONObject) JSON.toJSON(preDiagnosisInfoDO);
        json.remove("id");
        json.put("cardNo",cardNo);
        json.remove("createTime");
        json.remove("patient");
        return json;
    }
    //关联平台测量数据
    public PageEnvelop findHealthIndexPage(String deviceSn,String dept,String startTime,String endTime,int page,int size){
        String sql = "SELECT  i.id,i.value1,i.value2,i.value3,date_format(i.record_date,'%Y-%m-%d %H:%i:%S' ) recordDate " +
                ",i.name,i.dept,i.dept_name deptName,d.device_name deviceName ";
        String countSql = "selcet count(i.id) ";
                ",i.name,i.dept,i.dept_name deptName,d.device_name deviceName,d.device_code as deviceCode ";
        String countSql = "select count(i.id) ";
        String filter = " from wlyy_patient_health_index i,wlyy_devices d " +
                " WHERE i.device_sn=d.device_code and i.type=2 and i.del=1 ";
        String orderBy = " order by id desc limit "+(page-1)*size+","+size;

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

@ -259,8 +259,12 @@ public class DsyyController extends EnvelopRestEndpoint {
                                   @ApiParam(name = "phone", value = "电话号码", required = false)
                                       @RequestParam(value = "phone",required = false)String phone,
                                   @ApiParam(name = "cardNo", value = "卡号", required = false)
                                       @RequestParam(value = "cardNo",required = false)String cardNo) throws Exception {
        return success("请求成功",dsyyEntranceService.buildAccount(userName,idNo,gend,phone,cardNo,cardType));
                                       @RequestParam(value = "cardNo",required = false)String cardNo,
                                   @ApiParam(name = "addr", value = "家庭地址", required = false)
                                       @RequestParam(value = "addr",required = false)String addr,
                                   @ApiParam(name = "age", value = "年龄", required = false)
                                       @RequestParam(value = "age",required = false)String age) throws Exception {
        return success("请求成功",dsyyEntranceService.buildAccount(userName,idNo,gend,phone,cardNo,cardType,addr,age));
    }
    /**
@ -441,7 +445,7 @@ public class DsyyController extends EnvelopRestEndpoint {
    @PostMapping(value = "/sendDispensingToHis")
    @ApiOperation(value = "互联网医院通知院内摆药")
    public ObjEnvelop buildAccount(@ApiParam(name = "hISTradeNo", value = "必填,挂号流水号", required = false)
    public ObjEnvelop sendDispensingToHis(@ApiParam(name = "hISTradeNo", value = "必填,挂号流水号", required = false)
                                   @RequestParam(value = "hISTradeNo",required = false)String hISTradeNo,
                                   @ApiParam(name = "payCardNo", value = "必填,就诊卡号", required = false)
                                   @RequestParam(value = "payCardNo",required = false)String payCardNo,

+ 180 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/archives/PreDiagnosisInfoEndpoint.java

@ -1,11 +1,31 @@
package com.yihu.jw.hospital.endpoint.archives;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.contant.CommonContant;
import com.yihu.jw.entity.base.inpatient.BaseInpatientRegistrationDO;
import com.yihu.jw.entity.base.patient.PatientPreDiagnosisInfoDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyRecordDO;
import com.yihu.jw.patient.service.PatientPreDiagnosisInfoService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.excel.ExportUtl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
 * Created by yeshijie on 2024/12/20.
@ -17,6 +37,164 @@ public class PreDiagnosisInfoEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientPreDiagnosisInfoService patientPreDiagnosisInfoService;
    @Autowired
    private ExportUtl exportUtl;
    @PostMapping(value = "savePreDiagnosisInfo")
    @ApiOperation(value = "保存档案数据")
    public ObjEnvelop savePreDiagnosisInfo (
            @ApiParam(name = "json", value = "档案json")
            @RequestParam(value = "json", required = true) String json) {
        try {
            PatientPreDiagnosisInfoDO patientPreDiagnosisInfoDO= toEntity(json, PatientPreDiagnosisInfoDO.class);
            return ObjEnvelop.getSuccess("获取成功",patientPreDiagnosisInfoService.savePreDiagnosisInfo(patientPreDiagnosisInfoDO));
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError(CommonContant.Message.SAVE_SUCCESS);
    }
    @GetMapping(value = "findByPage")
    @ApiOperation(value = "诊前信息分页")
    public Envelop findByPage(@ApiParam(name = "name", value = "姓名", required = false)
                                      @RequestParam(value = "name", required = false)String name,
                                      @ApiParam(name = "mobile", value = "手机号", required = false)
                                      @RequestParam(value = "mobile", required = false)String mobile,
                                      @ApiParam(name = "idcard", value = "身份证", required = false)
                                      @RequestParam(value = "idcard", required = false)String idcard,
                                      @ApiParam(name = "chargeType", value = "自费或者医保", required = false)
                                      @RequestParam(value = "chargeType", required = false)String chargeType,
                                      @ApiParam(name = "fromSource", value = "来源(读卡器或者扫码枪)", required = false)
                                      @RequestParam(value = "fromSource", required = false)String fromSource,
                                      @ApiParam(name = "systolicPressureStart", value = "收缩压开始", required = false)
                                      @RequestParam(value = "systolicPressureStart", required = false)String systolicPressureStart,
                                      @ApiParam(name = "diastolicPressureStart", value = "舒张压", required = false)
                                      @RequestParam(value = "diastolicPressureStart", required = false)String diastolicPressureStart,
                                      @ApiParam(name = "systolicPressureEnd", value = "收缩压结束", required = false)
                                      @RequestParam(value = "systolicPressureEnd", required = false)String systolicPressureEnd,
                                      @ApiParam(name = "diastolicPressureEnd", value = "舒张压结束", required = false)
                                      @RequestParam(value = "diastolicPressureEnd", required = false)String diastolicPressureEnd,
                                      @ApiParam(name = "startTime", value = "开始时间", required = false)
                                      @RequestParam(value = "startTime", required = false)String startTime,
                                      @ApiParam(name = "endTime", value = "结束时间", required = false)
                                      @RequestParam(value = "endTime", required = false)String endTime,
                                      @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
                                      @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                                      @ApiParam(name = "size", value = "每页分页大小", required = true, defaultValue = "10")
                                      @RequestParam(value = "size", required = true,defaultValue = "10")Integer size){
        try {
            PageEnvelop pageEnvelop = patientPreDiagnosisInfoService.findByPage(name,mobile,idcard,chargeType,fromSource,systolicPressureStart
                    ,diastolicPressureStart,systolicPressureEnd,diastolicPressureEnd,startTime,endTime,page,size);
            return pageEnvelop;
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @GetMapping(value = "open/exportExcel/exportPatientPreDisagnosisInfoRecord")
    @ApiOperation(value = " 导出诊前信息")
    public ListEnvelop exportPatientPreDisagnosisInfoRecord(
            @ApiParam(name = "name", value = "姓名", required = false)
            @RequestParam(value = "name", required = false)String name,
            @ApiParam(name = "mobile", value = "手机号", required = false)
            @RequestParam(value = "mobile", required = false)String mobile,
            @ApiParam(name = "idcard", value = "身份证", required = false)
            @RequestParam(value = "idcard", required = false)String idcard,
            @ApiParam(name = "chargeType", value = "自费或者医保", required = false)
            @RequestParam(value = "chargeType", required = false)String chargeType,
            @ApiParam(name = "fromSource", value = "来源(读卡器或者扫码枪)", required = false)
            @RequestParam(value = "fromSource", required = false)String fromSource,
            @ApiParam(name = "systolicPressureStart", value = "收缩压开始", required = false)
            @RequestParam(value = "systolicPressureStart", required = false)String systolicPressureStart,
            @ApiParam(name = "diastolicPressureStart", value = "舒张压", required = false)
            @RequestParam(value = "diastolicPressureStart", required = false)String diastolicPressureStart,
            @ApiParam(name = "systolicPressureEnd", value = "收缩压结束", required = false)
            @RequestParam(value = "systolicPressureEnd", required = false)String systolicPressureEnd,
            @ApiParam(name = "diastolicPressureEnd", value = "舒张压结束", required = false)
            @RequestParam(value = "diastolicPressureEnd", required = false)String diastolicPressureEnd,
            @ApiParam(name = "startTime", value = "开始时间", required = false)
            @RequestParam(value = "startTime", required = false)String startTime,
            @ApiParam(name = "endTime", value = "结束时间", required = false)
            @RequestParam(value = "endTime", required = false)String endTime,
            HttpServletResponse response) {
        try {
            PageEnvelop pageEnvelop = patientPreDiagnosisInfoService.findByPage(name,mobile,idcard,chargeType,fromSource,systolicPressureStart
                    ,diastolicPressureStart,systolicPressureEnd,diastolicPressureEnd,startTime,endTime,1,1000000000);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("surveyRecordExcel.xls"));
            OutputStream os = response.getOutputStream();
            pushTotalExcel(os, pageEnvelop.getDetailModelList());
            return success(pageEnvelop.getDetailModelList());
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    public void pushTotalExcel(OutputStream os, List<PatientPreDiagnosisInfoDO> list) 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) {
                exportUtl.addCell(ws, 0, k, h);//表名,行,列,header
                k++;
            }
            int i = 1;
            for (PatientPreDiagnosisInfoDO m : list) {
                exportUtl.addCell(ws, i, 0, m.getCardNo());
                exportUtl.addCell(ws, i, 1, m.getName());
                exportUtl.addCell(ws, i, 2, m.getMobile());
                exportUtl.addCell(ws, i, 3, m.getIdcard());
                exportUtl.addCell(ws, i, 4, m.getSex().equalsIgnoreCase("1")?"男":m.getSex().equalsIgnoreCase("2")?"女":"未知");
                exportUtl.addCell(ws, i, 5, m.getAge());
                exportUtl.addCell(ws, i, 6, m.getBirthday());
                exportUtl.addCell(ws, i, 7, m.getChargeTypeName());
                exportUtl.addCell(ws, i, 8, m.getFromSourceName());
                exportUtl.addCell(ws, i, 9, (m.getSystolicPressure()+"/"+m.getDiastolicPressure()));
                exportUtl.addCell(ws, i, 10, m.getDoctorName());
                exportUtl.addCell(ws, i, 11, m.getCreateTime());
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    @GetMapping(value = "findHealthIndexPage")
    @ApiOperation(value = "关联平台测量数据")
    public Envelop findHealthIndexPage(
                              @ApiParam(name = "deviceSn", value = "设备sn码", required = false)
                              @RequestParam(value = "deviceSn", required = false)String deviceSn,
                              @ApiParam(name = "dept", value = "科室", required = false)
                              @RequestParam(value = "dept", required = false)String dept,
                              @ApiParam(name = "startTime", value = "开始时间", required = false)
                              @RequestParam(value = "startTime", required = false)String startTime,
                              @ApiParam(name = "endTime", value = "结束时间", required = false)
                              @RequestParam(value = "endTime", required = false)String endTime,
                              @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
                              @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                              @ApiParam(name = "size", value = "每页分页大小", required = true, defaultValue = "10")
                              @RequestParam(value = "size", required = true,defaultValue = "10")Integer size){
        try {
            PageEnvelop pageEnvelop = patientPreDiagnosisInfoService.findHealthIndexPage(deviceSn,dept,startTime,endTime,page,size);
            return pageEnvelop;
        }catch (Exception e){
            return failedException2(e);
        }
    }