Explorar el Código

Merge branch 'dev' of chenyongxing/patient-co-management into dev

chenweida hace 7 años
padre
commit
9e5c736532

+ 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;
    }
}

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

@ -1,23 +1,22 @@
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;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Date;
@ -42,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")
@ -91,16 +93,13 @@ public class PhysicalExaminationController extends BaseController {
        String question = physicalExaminationService.findQuestion(examCode, pb_id, ct_id);
        JSONObject jsonQuestion = new JSONObject(question);
        JSONObject recordset = jsonQuestion.getJSONObject("recordset");
        String _pb_id = recordset.get("pb_id").toString();//越人api问题,  我们数据库保存的居民答案的pb_id是这边返回下一题的pb_id
        //查找居民是否已经答过该试题
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
        jsonQuestion.put("answer",answer);
        jsonQuestion.put("answer",(answer==null?"":answer.getProblems()));
        //Map<String, Object> resp = customerService.findServerInfo(patient);
        //resp.put("patient",patient);
        //return write(1,"查询成功","data",resp);
        return jsonQuestion.toString();
    }
@ -145,45 +144,17 @@ public class PhysicalExaminationController extends BaseController {
        return result;
    }
    @ApiOperation(value = "查找报告单")
    @ApiOperation(value = "查看报告单")
    @RequestMapping(value = "/findconconhealth",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findconconhealth(@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){
    @RequestMapping(value = "/testUploadFile", method = RequestMethod.POST)
    public String testUploadFile(@RequestParam("test") MultipartFile file) {
        if (file.isEmpty()) {
            return "文件为空";
        }
        // 获取文件名
        String fileName = file.getOriginalFilename();
        // 获取文件的后缀名
        String suffixName = fileName.substring(fileName.lastIndexOf("."));
        // 文件上传后的路径
        String filePath = "E://test//";
        // 解决中文问题,liunx下中文路径,图片显示问题
        // fileName = UUID.randomUUID() + suffixName;
        File dest = new File(filePath + fileName);
        // 检测是否存在目录
        if (!dest.getParentFile().exists()) {
            dest.getParentFile().mkdirs();
        }
        try {
            file.transferTo(dest);
            return "上传成功";
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "上传失败";
        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);
    }
}

+ 36 - 10
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;
@ -7,15 +8,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -28,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();
@ -60,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());
@ -146,4 +142,34 @@ public class PhysicalExaminationService {
        return HttpClientUtil.postBody(yuerenApi+"/findintegral", params);
    }
    /**
     * 请求接口,获取报告,将其存入数据库中
     * @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);
        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;
    }
}

+ 17 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -3,12 +3,14 @@ package com.yihu.wlyy.controller.common.account;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import com.yihu.wlyy.repository.ManageDictDao;
import com.yihu.wlyy.service.manager.account.CustomerService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.patient.AdminPatientService;
import com.yihu.wlyy.service.manager.sign.SignFamilyService;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.manager.user.WlyyCustomerLogService;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Map;
/**
@ -41,6 +44,9 @@ public class CustomerController extends BaseController {
    @Autowired
    private SignFamilyService signFamilyService;
    @Autowired
    private WlyyCustomerLogService wlyyCustomerLogService;
    @RequestMapping(value = "/login",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String login(@ApiParam(name = "userName", value = "账号", required = true)@RequestParam(required = true, name = "userName") String userName,
@ -63,6 +69,11 @@ public class CustomerController extends BaseController {
            req.getSession().setAttribute("name",curUser.getName());
            req.getSession().setAttribute("isLogin", "true");
            req.getSession().setMaxInactiveInterval(-1);//设置session用不过期
            WlyyCustomerLog wlyyCustomerLog = new WlyyCustomerLog();
            wlyyCustomerLog.setCreateTime(new Date());
            wlyyCustomerLog.setUser(curUser.getCode());
            wlyyCustomerLog.setType(1);
            wlyyCustomerLogService.save(wlyyCustomerLog);
            return write(1,"登入成功","user",curUser);
        }
    }
@ -70,11 +81,17 @@ public class CustomerController extends BaseController {
    @RequestMapping(value = "/logout",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String logout(HttpServletRequest req) throws Exception {
        String code = (String) req.getSession().getAttribute("code");
        req.getSession().removeAttribute("userInfo");
        req.getSession().removeAttribute("mobile");
        req.getSession().removeAttribute("code");
        req.getSession().removeAttribute("name");
        req.getSession().removeAttribute("isLogin");
        WlyyCustomerLog wlyyCustomerLog = new WlyyCustomerLog();
        wlyyCustomerLog.setCreateTime(new Date());
        wlyyCustomerLog.setUser(code);
        wlyyCustomerLog.setType(0);
        wlyyCustomerLogService.save(wlyyCustomerLog);
        return write(1,"退出成功");
    }

+ 5 - 5
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/User.java

@ -51,7 +51,7 @@ public class User extends IdEntity {
    private String organizationName;
    //客服工号
    private String jonNo;
    private String jobNo;
    //客服坐席号
    private String seat;
@ -179,12 +179,12 @@ public class User extends IdEntity {
        return ImmutableList.copyOf(StringUtils.split("", ","));
    }
    public String getJonNo() {
        return jonNo;
    public String getJobNo() {
        return jobNo;
    }
    public void setJonNo(String jonNo) {
        this.jonNo = jonNo;
    public void setJobNo(String jobNo) {
        this.jobNo = jobNo;
    }
    public String getSeat() {

+ 41 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyCustomerLog.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "wlyy_customer_log")
public class WlyyCustomerLog extends IdEntity{
    private String user;
    private Date createTime;
    private Integer type;
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}

+ 15 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyCustomerLogDao.java

@ -0,0 +1,15 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface WlyyCustomerLogDao extends PagingAndSortingRepository<WlyyCustomerLog, Long>, JpaSpecificationExecutor<WlyyCustomerLog> {
}

+ 26 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/WlyyCustomerLogService.java

@ -0,0 +1,26 @@
package com.yihu.wlyy.service.manager.user;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import com.yihu.wlyy.repository.WlyyCustomerLogDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
/**
 * Created by yww on 2016/10/8.
 */
@Service
public class WlyyCustomerLogService extends BaseJpaService<WlyyCustomerLog,WlyyCustomerLogDao> {
    @Autowired
    private WlyyCustomerLogDao wlyyCustomerLogDao;
    @Transient
    public WlyyCustomerLog save(WlyyCustomerLog wlyyCustomerLog){
        wlyyCustomerLogDao.save(wlyyCustomerLog);
        return wlyyCustomerLog;
    }
}