Bladeren bron

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

trick9191 7 jaren geleden
bovenliggende
commit
b22a83e814
16 gewijzigde bestanden met toevoegingen van 308 en 102 verwijderingen
  1. 3 0
      common/common-entity/src/main/java/com/yihu/mm/entity/patient/ExamReport.java
  2. 34 0
      common/common-entity/src/main/java/com/yihu/mm/entity/patient/PatientExam.java
  3. 9 0
      common/common-entity/src/main/java/com/yihu/mm/entity/questionnaire/MedicineAnswerLog.java
  4. 53 90
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  5. 2 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/MedicineAnswerLogDao.java
  6. 4 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/patient/PatientExamDao.java
  7. 17 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/hospital/HospitalDao.java
  8. 40 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/SignFamilyDao.java
  9. 41 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/FamilyContractService.java
  10. 29 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/HospitalService.java
  11. 2 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/MedicineAnswerLogService.java
  12. 15 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientExamService.java
  13. 33 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientService.java
  14. 21 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  15. 1 1
      patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml
  16. 4 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java

+ 3 - 0
common/common-entity/src/main/java/com/yihu/mm/entity/patient/ExamReport.java

@ -7,6 +7,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "exam_report")
@ -26,6 +27,8 @@ public class ExamReport extends IdEntity implements Serializable {
    private String clTemplate;//显示模板
    @Column(name="cl_sort")
    private String clSort;//结论排序权重
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    private Date createTime;
    public String getPatient() {
        return patient;

+ 34 - 0
common/common-entity/src/main/java/com/yihu/mm/entity/patient/PatientExam.java

@ -7,6 +7,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "patient_exam")
@ -27,6 +28,15 @@ public class PatientExam extends IdEntity implements Serializable {
    @Column(name="is_complete")
    private Integer isComplete;
    @Column(name="sl_id")
    private String slId;//预约单号
    @Column(name="u_no")
    private String uNo;//客户编号
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    private Date createTime;
    public String getPatient() {
        return patient;
    }
@ -66,4 +76,28 @@ public class PatientExam extends IdEntity implements Serializable {
    public void setTpName(String tpName) {
        this.tpName = tpName;
    }
    public String getSlId() {
        return slId;
    }
    public void setSlId(String slId) {
        this.slId = slId;
    }
    public String getuNo() {
        return uNo;
    }
    public void setuNo(String uNo) {
        this.uNo = uNo;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/mm/entity/questionnaire/MedicineAnswerLog.java

@ -21,6 +21,7 @@ public class MedicineAnswerLog extends IdEntity {
    private String pbId;//试题编号
    private Date createTime;    //创建时间
    private String problems;    //问题的集合
    private String ctId;//咨询编号
    public String getPatientCode() {
        return patientCode;
@ -78,4 +79,12 @@ public class MedicineAnswerLog extends IdEntity {
    public void setPbId(String pbId) {
        this.pbId = pbId;
    }
    public String getCtId() {
        return ctId;
    }
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
}

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

@ -7,11 +7,9 @@ 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.util.HttpClientUtil;
import com.yihu.wlyy.entity.patient.Patient;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -21,7 +19,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Date;
@ -51,35 +48,8 @@ public class PhysicalExaminationController extends BaseController {
    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findExames(@ApiParam(name = "tp_type", value = "'问卷类型',(备选值:1,2,4)1:初筛问卷,2:助理问卷,4:现场问卷", required = true)@RequestParam(required = false, name = "tp_type") String tp_type,
                             HttpServletRequest req
                             ) {
        HttpSession session = req.getSession();
            String key = (String) session.getAttribute("key");
            if(StringUtils.isBlank(key)){
                //通过接口查询key
                String result = HttpClientUtil.postBody(yuerenApi + "/phonekey", new JSONObject());
                JSONObject jsonObject = new JSONObject(result);
                String status = jsonObject.get("status").toString();
                if ("200".equals(status)) {
                    JSONObject recordset = jsonObject.getJSONObject("recordset");
                    key = recordset.getString("key");
                }else{
                    return result;
                }
                session.setMaxInactiveInterval(60*60*4);
                session.setAttribute("key",key);
        }
                             HttpServletRequest req) {
        String exames = physicalExaminationService.findExames(tp_type, examCode);
        //if(StringUtils.isNotBlank(examCode)){
        //    JSONObject examJson = new JSONObject(exames);
        //    String exam_status = examJson.get("status").toString();
        //    if ("200".equals(exam_status)) {
        //        JSONObject recordset = examJson.getJSONObject("recordset");
        //        key = recordset.getString("key");
        //    }else{
        //        return result;
        //    }
        //}
        return exames;
    }
@ -87,99 +57,92 @@ public class PhysicalExaminationController extends BaseController {
    @RequestMapping(value = "/insertslip",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode, HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        Patient patient = patientService.findByCode(patientCode);
        return physicalExaminationService.insertslip(patient);
        int isSignJM = patientService.isSignJM(patientCode);
        if(isSignJM==3){
            String insertslip = physicalExaminationService.insertslip(patient);
            JSONObject jsonQuestion = new JSONObject(insertslip);
            JSONObject recordset = jsonQuestion.getJSONObject("recordset");
            String ct_id = recordset.get("ct_id").toString();
            PatientExam patientExam = new PatientExam();
            patientExam.setCtId(ct_id);
            patientExam.setPatient(patientCode);
            patientExam.setIsComplete(0);
            patientExam.setTpId(examCode);
            patientExam.setCreateTime(new Date());
            patientExamService.save(patientExam);
            return insertslip;
        }else{
            return write(200,"未签约或者签约不在集美","isSignJM",isSignJM);
        }
    }
    @ApiOperation(value = "获取试题")
    @RequestMapping(value = "/findQuestion",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findQuestion(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
    public String findQuestion(
                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
                               @ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
                               HttpServletRequest req) throws IOException {
        String ct_id="";
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, tp_id);
        if(patientExam==null){
            Patient patient = patientService.findByCode(patientCode);
            String result = physicalExaminationService.insertslip(patient);
            JSONObject jsonObject = new JSONObject(result);
            String status = jsonObject.get("status").toString();
            if ("200".equals(status)) {
                JSONObject recordset = jsonObject.getJSONObject("recordset");
                ct_id = recordset.get("ct_id").toString();
                patientExam = new PatientExam();
                patientExam.setCtId(ct_id);
                patientExam.setPatient(patientCode);
                patientExam.setIsComplete(0);
                patientExam.setTpId(tp_id);
                patientExamService.save(patientExam);
            }else{
                return result;
            }
        }else{
            ct_id = patientExam.getCtId();
        }
        String question = physicalExaminationService.findQuestion(tp_id, pb_id, ct_id);
                               @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id) throws IOException {
        String question = physicalExaminationService.findQuestion(examCode, pb_id, ct_id);
        JSONObject jsonQuestion = new JSONObject(question);
        jsonQuestion.put("answer","");
        JSONObject recordset = jsonQuestion.getJSONObject("recordset");
        String _pb_id = recordset.get("pb_id").toString();//越人api问题,  我们数据库保存的居民答案的pb_id是这边返回下一题的pb_id
        //查找居民是否已经答过该试题
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, tp_id, pb_id);
        if(answer!=null){
            jsonQuestion.put("answer",answer);
        }
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
        jsonQuestion.put("answer",answer);
        //Map<String, Object> resp = customerService.findServerInfo(patient);
        //resp.put("patient",patient);
        //return write(1,"查询成功","data",resp);
        return question;
        return jsonQuestion.toString();
    }
    @ApiOperation(value = "提交试卷答案")
    @RequestMapping(value = "/handleExam",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String handleExam(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
    public String handleExam(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
                                @ApiParam(name = "i_multiselect", value = "试题类型(0单选 ,1多选)", required = true)@RequestParam(required = true, name = "i_multiselect") String i_multiselect,
                               @ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
                             @ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
                             @ApiParam(name = "isLast", value = "是否是最后一题(0否 ,1是)", required = true)@RequestParam(required = true, name = "isLast") String isLast,
                            HttpServletRequest req){
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, tp_id);
                             @ApiParam(name = "isLast", value = "是否是最后一题(0否 ,1是)", required = true)@RequestParam(required = false, name = "isLast") String isLast){
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, examCode,ct_id);
        String tpName = patientExam.getTpName();
        String ct_id = patientExam.getCtId();
        String result = physicalExaminationService.handleExam(tp_id, pb_id, dc_answer, ct_id);
        //将答案保存到自己数据库
        MedicineAnswerLog medicineAnswerLog = new MedicineAnswerLog();
        medicineAnswerLog.setPatientCode(patientCode);
        medicineAnswerLog.setTpId(tp_id);
        medicineAnswerLog.setTpName(tpName);
        medicineAnswerLog.setPbType(String.valueOf(i_multiselect));
        medicineAnswerLog.setCreateTime(new Date());
        medicineAnswerLog.setProblems(dc_answer);
        medicineAnswerLogService.save(medicineAnswerLog);
        //最后一题
        if("1".equals(isLast)){
        String result = physicalExaminationService.handleExam(examCode, pb_id, dc_answer, ct_id);
        //将答案保存/更新到自己数据库
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, pb_id, ct_id);
        if(answer==null){//新增
            answer = new MedicineAnswerLog();
            answer.setCreateTime(new Date());
            answer.setPatientCode(patientCode);
            answer.setPbId(pb_id);
            answer.setTpId(examCode);
            answer.setTpName(tpName);
            answer.setCtId(ct_id);
        }
        answer.setPbType(String.valueOf(i_multiselect));
        answer.setProblems(dc_answer);
        medicineAnswerLogService.save(answer);
        return result;
    }
    @ApiOperation(value = "四诊资料采集")
    @RequestMapping(value = "/dillphoneimgdata",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String dillphoneimgdata(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
                             @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
                             @ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
    public String dillphoneimgdata(@ApiParam(name = "at_id", value = "文件id", required = true)@RequestParam(required = true, name = "at_id") String at_id,
                             @ApiParam(name = "answer", value = "问题答案,文件名称", required = true)@RequestParam(required = true, name = "answer") String answer,
                              @ApiParam(name = "type", value = "1.脸型  2.舌像  3.声音", required = true)@RequestParam(required = true, name = "type") String type,
                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
        return null;
        String result = physicalExaminationService.dillphoneimgdata(at_id, answer, type, ct_id);
        return result;
    }
    @ApiOperation(value = "查找报告单")

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

@ -12,6 +12,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface MedicineAnswerLogDao extends PagingAndSortingRepository<MedicineAnswerLog, String>,JpaSpecificationExecutor<MedicineAnswerLog> {
	@Query("select m from MedicineAnswerLog m where m.patientCode=?1 and m.tpId=?2 and m.pbId=?3")
    MedicineAnswerLog findAnswer(String patientCode, String tp_id, String pb_id);
	@Query("select m from MedicineAnswerLog m where m.patientCode=?1 and m.tpId=?2 and m.pbId=?3 and m.ctId=?4")
    MedicineAnswerLog findAnswer(String patientCode, String tp_id, String pb_id,String ct_id);
}

+ 4 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/patient/PatientExamDao.java

@ -10,10 +10,12 @@ 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 PatientExamDao extends PagingAndSortingRepository<PatientExam, String>,JpaSpecificationExecutor<PatientExam> {
	// 查询患者code和试卷编号查询
	@Query("select p from PatientExam p where p.patient=?1 and p.tpId=?2")
	PatientExam findByPatientAndTpId(String patientCode, String tpId);
	@Query("select p from PatientExam p where p.patient=?1 and p.tpId=?2  and p.ctId=?3 order by p.createTime desc")
	List<PatientExam> findByPatientAndTpId(String patientCode, String tpId,String ctId);
}

+ 17 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/hospital/HospitalDao.java

@ -0,0 +1,17 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.repository.wlyy.hospital;
import com.yihu.wlyy.entity.organization.Hospital;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface HospitalDao extends PagingAndSortingRepository<Hospital, Long>,JpaSpecificationExecutor<Hospital>  {
	// 根據CODE查詢医院名称
	@Query("select p from Hospital p where p.code = ?1")
	Hospital findByCode(String code);
}

+ 40 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/SignFamilyDao.java

@ -0,0 +1,40 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.repository.wlyy.patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Long>, JpaSpecificationExecutor<SignFamily> {
	SignFamily findByCode(String code);
	@Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
    SignFamily findByIdcard(String idcard);
    @Modifying
    @Query("update SignFamily a set a.status = ?1 where a.id = ?2")
    int updateStatus(Integer status, Long id);
    @Query(value = "select distinct(a.id) from SignFamily a,Patient p where a.patient = p.code and p.address like ?1 ")
    Long[] findByPatientAddressLike(String address);
    @Query(value = "select distinct(a.id) from SignFamily a,Patient p where a.patient = p.code and p.address like ?1 ")
    Long[] findByTeamNameOrLeaderNameLike(String teamName, String leaderName);
    @Query("select a from SignFamily a where a.patient = ?1 and a.status >= 0")
    List<SignFamily> findAllSignByPatient(String patient);
    @Query("select a from SignFamily a where a.patient = ?1 and a.status > 0 and expensesStatus=1")
    SignFamily findSignByPatient(String patient);
}

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

@ -0,0 +1,41 @@
package com.yihu.mm.service;
import com.yihu.mm.repository.wlyy.patient.SignFamilyDao;
import com.yihu.wlyy.entity.patient.SignFamily;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * 家庭签约业务处理类
 *
 * @author George
 */
@Component
@Transactional
public class FamilyContractService{
    @Autowired
    private SignFamilyDao signFamilyDao;
    /**
     * 查询居民的所有签约
     *
     * @param patient
     * @return
     */
    public List<SignFamily> findAllSignByPatient(String patient) {
        return signFamilyDao.findAllSignByPatient(patient);
    }
    /**
     * 查询当前生效的签约
     * @param patient
     * @return
     */
    public SignFamily findSignByPatient(String patient){
        return signFamilyDao.findSignByPatient(patient);
    }
}

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

@ -0,0 +1,29 @@
/*******************************************************************************
 * 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.repository.wlyy.hospital.HospitalDao;
import com.yihu.wlyy.entity.organization.Hospital;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 患者基本信息类.
 *
 * @author George
 */
@Service
public class HospitalService {
    @Autowired
    private HospitalDao hospitalDao;
    public Hospital findByCode(String code){
        return hospitalDao.findByCode(code);
    }
}

+ 2 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/MedicineAnswerLogService.java

@ -30,7 +30,7 @@ public class MedicineAnswerLogService {
    }
    public MedicineAnswerLog findAnswer(String patientCode,String tp_id,String pb_id){
        return  medicineAnswerLogDao.findAnswer(patientCode,tp_id,pb_id);
    public MedicineAnswerLog findAnswer(String patientCode,String tp_id,String pb_id,String ct_id){
        return  medicineAnswerLogDao.findAnswer(patientCode,tp_id,pb_id,ct_id);
    }
}

+ 15 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientExamService.java

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.util.List;
/**
 * 患者基本信息类.
@ -25,12 +26,24 @@ public class PatientExamService{
    private PatientExamDao patientExamDao;
    public PatientExam findByPatientAndTpId(String patientCode, String tpId){
        return patientExamDao.findByPatientAndTpId(patientCode,tpId);
    /**
     * 根据居民code和试卷编号 获取最新记录
     * @param patientCode
     * @param tpId
     * @return
     */
    public PatientExam findByPatientAndTpId(String patientCode, String tpId,String ctId){
        List<PatientExam> exames = patientExamDao.findByPatientAndTpId(patientCode, tpId,ctId);
        if(exames!=null && exames.size()>0){
            return exames.get(0);
        }
        return null;
    }
    @Transient
    public void save(PatientExam patientExam){
         patientExamDao.save(patientExam);
    }
}

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

@ -7,7 +7,9 @@ package com.yihu.mm.service;
import com.yihu.mm.repository.wlyy.patient.PatientDao;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,9 +23,40 @@ public class PatientService {
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private HospitalService hospitalService;
    @Autowired
    private FamilyContractService familyContractService;
    public Patient findByCode(String code) {
        return patientDao.findByCode(code);
    }
    /**
     * 判断是否居民是否  是集美签约居民
     * 返回 0 :未签约,且非厦门市民
     *      1: 未签约,是厦门市民
     *      2: 签约   在集美
     *      3  签约不在集美
     * @return
     */
    public int isSignJM(String patientCode){
        SignFamily signFamily = familyContractService.findSignByPatient(patientCode);
        if(signFamily==null){
            Patient patient = findByCode(patientCode);
            String city = patient.getCity();
            if("350200".equals(city)){
                return 1;
            }
            return 0;
        }
        String hospitalCode = signFamily.getHospital();
        Hospital hospital = hospitalService.findByCode(hospitalCode);
        String town = hospital.getTown();
        if("350211".equals(town)){
            return 2;
        }
        return 3;
    }
}

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

@ -16,13 +16,18 @@ public class PhysicalExaminationService {
    private String yuerenApi;
    public String findExames(String type, String examCode) {
        //先获取key值
        JSONObject params = new JSONObject();
        params.put("tp_type", type);
        params.put("sh_id", examCode);
        //TODO
        params.put("sh_id", "52");
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
    }
    /**
     * 获取预约信息   ,并且将
     * @param patient
     * @return
     */
    public String insertslip(Patient patient) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -79,4 +84,18 @@ public class PhysicalExaminationService {
        params.put("reqtype", 1);
        return HttpClientUtil.postBody(yuerenApi+"/findconconhealth", params);
    }
    public String dillphoneimgdata(String at_id, String answer, String type, String ct_id) {
        JSONObject params = new JSONObject();
        params.put("at_id", at_id);
        params.put("ct_id", ct_id);
        params.put("answer", at_id+"/"+answer);
        if("1".equals(type)||"2".equals(type)){
            params.put("answer_type","图片");
        }else{
            params.put("answer_type","录音");
        }
        params.put("object_type",type);
        return HttpClientUtil.postBody(yuerenApi+"/dillphoneimgdata", params);
    }
}

+ 1 - 1
patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml

@ -1,7 +1,7 @@
server:
  port: 8080
examCode:         #越人试卷题目code
examCode: 84        #越人试卷编号
yuerenApi: http://192.168.131.123:8180/wlyy_admin/yueren       #越人api调用地址
security:

+ 4 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java

@ -76,8 +76,11 @@ public class YueRenController extends BaseController {
    @RequestMapping(value = "dillphoneimgdata", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String inserTemp(@RequestBody String jsonString) {
        String key = wlyyMedicineKeyService.getKey();
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        params.put("key",key);
        String answer = params.get("answer").toString();
        params.put("answer","/attach/"+key+"/"+answer);
        String postStr = remoteCall("/yueren/dillphoneimgdata", params);
        return postStr;
    }