chenyongxing пре 7 година
родитељ
комит
4d7265cad0

+ 20 - 42
common/common-entity/src/main/java/com/yihu/mm/entity/patient/ExamReport.java

@ -15,20 +15,14 @@ public class ExamReport extends IdEntity implements Serializable {
    @Column(name="patient")
    private String patient;//居民code
    @Column(name="cc_id")
    private String ccId;//咨询结论编号
    @Column(name="ct_id")
    private String ctId;//咨询编号
    @Column(name="cl_id")
    private String clId;//结论编号
    @Column(name="cc_last")
    private String ccLast;//最终结论
    @Column(name="cl_template")
    private String clTemplate;//显示模板
    @Column(name="cl_sort")
    private String clSort;//结论排序权重
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    private Date createTime;
    @Column(name="report")
    private String report;
    @Column(name="report_detail")
    private String reportDetail;
    public String getPatient() {
        return patient;
@ -38,51 +32,35 @@ public class ExamReport extends IdEntity implements Serializable {
        this.patient = patient;
    }
    public String getCcId() {
        return ccId;
    public Date getCreateTime() {
        return createTime;
    }
    public void setCcId(String ccId) {
        this.ccId = ccId;
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCtId() {
        return ctId;
    }
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
    public String getClId() {
        return clId;
    public String getReport() {
        return report;
    }
    public void setClId(String clId) {
        this.clId = clId;
    public void setReport(String report) {
        this.report = report;
    }
    public String getCcLast() {
        return ccLast;
    public String getReportDetail() {
        return reportDetail;
    }
    public void setCcLast(String ccLast) {
        this.ccLast = ccLast;
    public void setReportDetail(String reportDetail) {
        this.reportDetail = reportDetail;
    }
    public String getClTemplate() {
        return clTemplate;
    }
    public void setClTemplate(String clTemplate) {
        this.clTemplate = clTemplate;
    }
    public String getClSort() {
        return clSort;
    public String getCtId() {
        return ctId;
    }
    public void setClSort(String clSort) {
        this.clSort = clSort;
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
}

+ 0 - 53
common/common-entity/src/main/java/com/yihu/mm/entity/patient/ExamReportDetail.java

@ -1,53 +0,0 @@
package com.yihu.mm.entity.patient;
import com.yihu.mm.entity.IdEntity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "exam_report_detail")
public class ExamReportDetail extends IdEntity implements Serializable {
    private String patient;
    private String ctId;
    private String reportDetail;
    private Date createTime;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "ct_id")
    public String getCtId() {
        return ctId;
    }
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
    @Column(name = "report_detail")
    public String getReportDetail() {
        return reportDetail;
    }
    public void setReportDetail(String reportDetail) {
        this.reportDetail = reportDetail;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 13 - 8
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -1,12 +1,10 @@
package com.yihu.mm.controller.medicine;
import com.yihu.mm.controller.BaseController;
import com.yihu.mm.entity.patient.ExamReport;
import com.yihu.mm.entity.patient.PatientExam;
import com.yihu.mm.entity.questionnaire.MedicineAnswerLog;
import com.yihu.mm.service.MedicineAnswerLogService;
import com.yihu.mm.service.PatientExamService;
import com.yihu.mm.service.PatientService;
import com.yihu.mm.service.PhysicalExaminationService;
import com.yihu.mm.service.*;
import com.yihu.wlyy.entity.patient.Patient;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -43,6 +41,9 @@ public class PhysicalExaminationController extends BaseController {
    @Autowired
    private PatientExamService patientExamService;
    @Autowired
    private ExamReportService examReportService;
    @ApiOperation(value = "获取试卷列表")
    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
@ -97,7 +98,7 @@ public class PhysicalExaminationController extends BaseController {
        //查找居民是否已经答过该试题
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
        jsonQuestion.put("answer",answer);
        jsonQuestion.put("answer",(answer==null?"":answer.getProblems()));
        return jsonQuestion.toString();
    }
@ -146,10 +147,14 @@ public class PhysicalExaminationController extends BaseController {
    @ApiOperation(value = "查看报告单")
    @RequestMapping(value = "/findconconhealth",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String showDetail(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
        String result = physicalExaminationService.findconconhealth(ct_id);
    public String showDetail(@ApiParam(name = "patientCode", value = "居民code", required = false)@RequestParam(required = true, name = "patientCode") String patientCode,
            @ApiParam(name = "ct_id", value = "咨询编号", required = false)@RequestParam(required = false, name = "ct_id") String ct_id){
        ExamReport examReport = examReportService.showDetail(patientCode, ct_id);
        return result;
        if(null!=examReport){
        }
        return write(200,"查询成功","recordset",examReport);
    }
}

+ 23 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/ExamReportDao.java

@ -0,0 +1,23 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.repository.mm.exam;
import com.yihu.mm.entity.patient.ExamReport;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface ExamReportDao extends PagingAndSortingRepository<ExamReport, String>,JpaSpecificationExecutor<ExamReport>  {
	@Query("select e from ExamReport e where e.patient=?1 order by e.createTime desc")
	public List<ExamReport> findByPatient(String patientCode);
	@Query("select e from ExamReport e where e.patient=?1 and e.ctId=?2")
	public ExamReport findByPatientAndCtId(String patientCode,String ctId);
}

+ 1 - 1
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/MedicineStroresNoDao.java

@ -10,7 +10,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface MedicineStroresNoDao extends PagingAndSortingRepository<MedicineStroresNo, Long>,JpaSpecificationExecutor<MedicineStroresNo>  {
public interface MedicineStroresNoDao extends PagingAndSortingRepository<MedicineStroresNo, String>,JpaSpecificationExecutor<MedicineStroresNo>  {
	// 根據CODE查詢医院名称
	@Query("select p from MedicineStroresNo p where p.city = ?1")
	MedicineStroresNo findByCity(String city);

+ 89 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/ExamReportService.java

@ -0,0 +1,89 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.service;
import com.yihu.mm.entity.patient.ExamReport;
import com.yihu.mm.repository.mm.exam.ExamReportDao;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 患者基本信息类.
 *
 * @author George
 */
@Service
public class ExamReportService {
    @Autowired
    private ExamReportDao examReportDao;
    @Autowired
    private PhysicalExaminationService physicalExaminationService;
    /**
     * 通过 patientCode 查找最新的测试报告
     * @param patientCode
     * @return
     */
    public ExamReport findByPatient(String patientCode){
        List<ExamReport> examReports = examReportDao.findByPatient(patientCode);
        if(examReports!=null&&examReports.size()>0){
            return examReports.get(0);
        }
        return null;
    }
    /**
     * 通过patientCode和ctId查找最新报告
     * @param patientCode
     * @param ctId
     * @return
     */
    public ExamReport findByPatientAndCtId(String patientCode,String ctId){
        return examReportDao.findByPatientAndCtId(patientCode,ctId);
    }
    /**
     * 参数patientCode不能为空----为空返回null
     * ctId可以为空(ctId为空,则不能从接口获取)
     * 通过patientCode和ctId获取报告(先从数据库获取,数据库获取不到,请求接口,获取数据)
     * @param patientCode
     * @param ctId
     * @return
     */
    public ExamReport showDetail(String patientCode,String ctId){
        ExamReport examReport = null;
        if(StringUtils.isBlank(patientCode)){
            return null;
        }
        if(StringUtils.isNotBlank(ctId)){
            //首先通过patientCode和ctId查找是否存在报告
            examReport = findByPatientAndCtId(patientCode, ctId);
            if(examReport==null){
                //为空,调用接口存入数据库,再次获取
                examReport = physicalExaminationService.saveReportDetail(patientCode, ctId);
                return examReport;
            }
            return examReport;
        }
        if( StringUtils.isBlank(ctId)){
            examReport = findByPatient(patientCode);
            return examReport;
        }
        return null;
    }
    public ExamReport save(ExamReport examReport){
        return examReportDao.save(examReport);
    }
}

+ 28 - 3
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java

@ -1,5 +1,6 @@
package com.yihu.mm.service;
import com.yihu.mm.entity.patient.ExamReport;
import com.yihu.mm.entity.yueren.MedicineStroresNo;
import com.yihu.mm.util.HttpClientUtil;
import com.yihu.wlyy.entity.patient.Patient;
@ -20,6 +21,9 @@ public class PhysicalExaminationService {
    @Autowired
    private MedicineStroresNoService medicineStroresNoService;
    @Autowired
    private ExamReportService examReportService;
    //查找试卷
    public String findExames(String type, String examCode) {
        JSONObject params = new JSONObject();
@ -52,7 +56,7 @@ public class PhysicalExaminationService {
        }
        params.put("u_sex",sexStr );
        MedicineStroresNo medicineStroresNo = medicineStroresNoService.findByCity("350200");
        params.put("sh_id", medicineStroresNo.getCity());
        params.put("sh_id", medicineStroresNo.getShId());
        params.put("u_idnum", patient.getIdcard());
        //params.put("u_native", u_native);//籍贯
        params.put("u_birthday", patient.getBirthday());
@ -138,13 +142,34 @@ public class PhysicalExaminationService {
        return HttpClientUtil.postBody(yuerenApi+"/findintegral", params);
    }
    public String showDetail(String patientCode,String ctId){
    /**
     * 请求接口,获取报告,将其存入数据库中
     * @param patientCode
     * @param ctId
     */
    public ExamReport saveReportDetail(String patientCode,String ctId){
        ExamReport examReport = null;
        String centralizedproblem = centralizedproblem(ctId);
        String conclusionfactor = conclusionfactor(ctId);
        String insertconconhealth = insertconconhealth(ctId);
        String findconconhealth = findconconhealth(ctId);
        String findintegral = findintegral(ctId);
        return null;
        JSONObject reportJson = new JSONObject(findconconhealth);
        JSONObject reportDetail = new JSONObject(findintegral);
        String status1 = reportJson.get("status").toString();
        String status2 = reportDetail.get("status").toString();
        if("200".equals(status1) && "200".equals(status2)){
            examReport = new ExamReport();
            examReport.setPatient(patientCode);
            examReport.setCtId(ctId);
            examReport.setCreateTime(new Date());
            examReport.setReport(reportJson.get("recordset").toString());
            examReport.setReportDetail(reportDetail.get("recordset").toString());
            examReport = examReportService.save(examReport);
        }
        return examReport;
    }
}