Selaa lähdekoodia

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

chenweida 7 vuotta sitten
vanhempi
commit
217e22c10a
49 muutettua tiedostoa jossa 1151 lisäystä ja 1439 poistoa
  1. 88 0
      common/common-entity/src/main/java/com/yihu/mm/entity/patient/ExamReport.java
  2. 45 0
      common/common-entity/src/main/java/com/yihu/mm/entity/patient/PatientExam.java
  3. 18 0
      common/common-entity/src/main/java/com/yihu/mm/entity/questionnaire/MedicineAnswerLog.java
  4. 9 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  5. 0 22
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/BaseController.java
  6. 76 66
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  7. 17 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/MedicineAnswerLogDao.java
  8. 4 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/patient/PatientExamDao.java
  9. 17 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/hospital/HospitalDao.java
  10. 40 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/SignFamilyDao.java
  11. 41 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/FamilyContractService.java
  12. 29 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/HospitalService.java
  13. 36 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/MedicineAnswerLogService.java
  14. 15 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientExamService.java
  15. 33 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientService.java
  16. 36 14
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  17. 46 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/JSONUtil.java
  18. 1 1
      patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml
  19. 15 9
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java
  20. 7 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/medicine/entity/WlyyMedicineKey.java
  21. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/medicine/repository/WlyyMedicineKeyDao.java
  22. 4 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  23. 32 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/medicine/WlyyMedicineKeyService.java
  24. 4 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java
  25. 10 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java
  26. 0 70
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyCommonDict.java
  27. 0 85
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptDict.java
  28. 0 65
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptStaffAllotDict.java
  29. 0 109
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseClassDict.java
  30. 0 111
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseDict.java
  31. 0 54
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java
  32. 0 223
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvPhysicDict.java
  33. 0 146
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffDict.java
  34. 0 88
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffRegTypeAllotDict.java
  35. 0 88
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvSubjectClassDict.java
  36. 1 1
      patient-co/patient-co-wlyy/pom.xml
  37. 240 221
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java
  38. 0 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  39. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  40. 13 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  41. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  42. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  43. 14 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java
  44. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  45. 15 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  46. 208 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/express/DoctorSFExpressController.java
  47. 5 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java
  48. 2 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/express/SFExpressApiController.java
  49. 4 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/express/SFExpressController.java

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

@ -0,0 +1,88 @@
package com.yihu.mm.entity.patient;
import com.yihu.mm.entity.IdEntity;
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")
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;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getCcId() {
        return ccId;
    }
    public void setCcId(String ccId) {
        this.ccId = ccId;
    }
    public String getCtId() {
        return ctId;
    }
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
    public String getClId() {
        return clId;
    }
    public void setClId(String clId) {
        this.clId = clId;
    }
    public String getCcLast() {
        return ccLast;
    }
    public void setCcLast(String ccLast) {
        this.ccLast = ccLast;
    }
    public String getClTemplate() {
        return clTemplate;
    }
    public void setClTemplate(String clTemplate) {
        this.clTemplate = clTemplate;
    }
    public String getClSort() {
        return clSort;
    }
    public void setClSort(String clSort) {
        this.clSort = clSort;
    }
}

+ 45 - 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")
@ -18,12 +19,24 @@ public class PatientExam extends IdEntity implements Serializable {
    @Column(name="tp_id")
    private String tpId;
    @Column(name="tp_name")
    private String tpName;
    @Column(name="ct_id")
    private String ctId;
    @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;
    }
@ -55,4 +68,36 @@ public class PatientExam extends IdEntity implements Serializable {
    public void setIsComplete(Integer isComplete) {
        this.isComplete = isComplete;
    }
    public String getTpName() {
        return tpName;
    }
    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;
    }
}

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

@ -18,8 +18,10 @@ public class MedicineAnswerLog extends IdEntity {
    private String tpId;    //试卷编号
    private String tpName; //试卷名称
    private String pbType;  //问卷类型
    private String pbId;//试题编号
    private Date createTime;    //创建时间
    private String problems;    //问题的集合
    private String ctId;//咨询编号
    public String getPatientCode() {
        return patientCode;
@ -69,4 +71,20 @@ public class MedicineAnswerLog extends IdEntity {
    public void setPbType(String pbType) {
        this.pbType = pbType;
    }
    public String getPbId() {
        return pbId;
    }
    public void setPbId(String pbId) {
        this.pbId = pbId;
    }
    public String getCtId() {
        return ctId;
    }
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -89,6 +89,8 @@ public class Prescription extends IdEntity {
    private String dispensaryTypeName; //类型翻译
    private Integer jwPayStatus;//处方结算状态,0为未结算,1为结算成功,默认为0
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
        return code;
@ -652,4 +654,11 @@ public class Prescription extends IdEntity {
    }
    public Integer getJwPayStatus() {
        return jwPayStatus;
    }
    public void setJwPayStatus(Integer jwPayStatus) {
        this.jwPayStatus = jwPayStatus;
    }
}

+ 0 - 22
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/BaseController.java

@ -1,7 +1,6 @@
package com.yihu.mm.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.IdEntity;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -389,27 +388,6 @@ public class BaseController {
		}
	}
	/**
	* 返回接口处理结果
	*
	*
	* @param code 结果码,成功为200
	* @param msg 结果提示信息
	* @return
	*/
	public String write(int code, String msg, String key, IdEntity entity) {
		try {
			Map<Object, Object> map = new HashMap<Object, Object>();
			ObjectMapper mapper = new ObjectMapper();
			map.put("status", code);
			map.put("msg", msg);
			map.put(key, entity);
			return mapper.writeValueAsString(map);
		} catch (Exception e) {
			error(e);
			return error(-1, "服务器异常,请稍候再试!");
		}
	}
	/**
	 * 返回接口处理结果

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

@ -2,13 +2,14 @@ package com.yihu.mm.controller.medicine;
import com.yihu.mm.controller.BaseController;
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.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;
@ -18,7 +19,8 @@ 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;
@RestController
@RequestMapping(value = "/medicine/physicalExamination")
@ -35,6 +37,8 @@ public class PhysicalExaminationController extends BaseController {
    @Autowired
    private PhysicalExaminationService physicalExaminationService;
    @Autowired
    private MedicineAnswerLogService medicineAnswerLogService;
    @Autowired
    private PatientExamService patientExamService;
@ -44,104 +48,110 @@ 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);
        }
        return physicalExaminationService.findExames(key,tp_type, examCode);
                             HttpServletRequest req) {
        String exames = physicalExaminationService.findExames(tp_type, examCode);
        return exames;
    }
    @ApiOperation(value = "新增预约单/获取咨询编号等信息")
    @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(key,patient);
        return null;
        Patient patient = patientService.findByCode(patientCode);
        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){
        HttpSession session = req.getSession();
        String key = (String) session.getAttribute("key");
        String ct_id="";
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, tp_id);
        if(patientExam==null){
            //Patient patient = patientService.findByCode(patientCode);
            //String result = physicalExaminationService.insertslip(key, patient);
            //JSONObject jsonObject = new JSONObject(result);
            //String status = jsonObject.get("status").toString();
            //if ("200".equals(status)) {
            //    JSONObject recordset = jsonObject.getJSONObject("recordset");
            //    ct_id = recordset.getString("ct_id");
            //    patientExam = new PatientExam();
            //    patientExam.setCtId(ct_id);
            //    patientExam.setPatient(patientCode);
            //    patientExam.setIsComplete(0);
            //    patientExam.setTpId(tp_id);
            //    patientExamService.save(patientExam);
            //}else{
            //    return result;
            //}
        }
        String question = physicalExaminationService.findQuestion(key, tp_id, pb_id, ct_id);
        return question;
                               @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);
        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);
        //Map<String, Object> resp = customerService.findServerInfo(patient);
        //resp.put("patient",patient);
        //return write(1,"查询成功","data",resp);
        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,
                            HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, tp_id);
        String ct_id = patientExam.getCtId();
        String result = physicalExaminationService.handleExam(key, tp_id, pb_id, dc_answer, ct_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 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 = "查找报告单")
    @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);
        return null;
    }

+ 17 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/MedicineAnswerLogDao.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.mm.exam;
import com.yihu.mm.entity.questionnaire.MedicineAnswerLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
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 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.id=?1 and p.tpId=?2")
	PatientExam findByPatientAndTpId(String id, 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);
    }
}

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

@ -0,0 +1,36 @@
/*******************************************************************************
 * 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.questionnaire.MedicineAnswerLog;
import com.yihu.mm.repository.mm.exam.MedicineAnswerLogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
/**
 * 患者基本信息类.
 *
 * @author George
 */
@Service
public class MedicineAnswerLogService {
    @Autowired
    private MedicineAnswerLogDao medicineAnswerLogDao;
    @Transient
    public void save(MedicineAnswerLog medicineAnswerLog){
        medicineAnswerLogDao.save(medicineAnswerLog);
    }
    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;
    }
}

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

@ -15,21 +15,24 @@ public class PhysicalExaminationService {
    @Value(("${yuerenApi}"))
    private String yuerenApi;
    public String findExames(String key,String type, String examCode) {
        //先获取key值
    public String findExames(String type, String examCode) {
        JSONObject params = new JSONObject();
        params.put("key",key);
        params.put("tp_type", type);
        params.put("sh_id", examCode);
        //TODO
        params.put("sh_id", "52");
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
    }
    public String insertslip(String key,Patient patient) {
    /**
     * 获取预约信息   ,并且将
     * @param patient
     * @return
     */
    public String insertslip(Patient patient) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("sl_date", sdf.format(date));
        params.put("sl_state", "未签到");
        params.put("u_tel", patient.getMobile());
@ -44,7 +47,7 @@ public class PhysicalExaminationService {
        params.put("u_sex",sexStr );
        //todo    sh_id 需要从数据库获取   wlyy_medicine_strores_no
        params.put("sh_id", "");
        params.put("sh_id", "52");
        params.put("u_idnum", patient.getIdcard());
        //params.put("u_native", u_native);//籍贯
        params.put("u_birthday", patient.getBirthday());
@ -53,27 +56,46 @@ public class PhysicalExaminationService {
        params.put("u_area", patient.getTownName());
        params.put("u_address", patient.getAddress());
        //params.put("sl_pass", );//报告单是否审核通过
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
        return HttpClientUtil.postBody(yuerenApi + "/insertslip", params);
    }
    public String findQuestion(String key, String tp_id, String pb_id, String ct_id) {
    public String findQuestion(String tp_id, String pb_id, String ct_id) {
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("ct_id", ct_id);
        params.put("tp_id", tp_id);
        params.put("pb_id", pb_id);
        String postStr = HttpClientUtil.postBody("/yueren/giveproblem", params);
        String postStr = HttpClientUtil.postBody(yuerenApi+"/giveproblem", params);
        return postStr;
    }
    public String handleExam(String key, String tp_id, String pb_id, String dc_answer, String ct_id) {
    public String handleExam(String tp_id, String pb_id, String dc_answer, String ct_id) {
        JSONObject params = new JSONObject();
        params.put("key", key);
        params.put("ct_id", ct_id);
        params.put("tp_id", tp_id);
        params.put("pb_id", pb_id);
        params.put("dc_answer", dc_answer);
        return HttpClientUtil.postBody("/yueren/handleproblem", params);
        return HttpClientUtil.postBody(yuerenApi+"/handleproblem", params);
    }
    public String findconconhealth(String ct_id) {
        JSONObject params = new JSONObject();
        params.put("ct_id", ct_id);
        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);
    }
}

+ 46 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/JSONUtil.java

@ -0,0 +1,46 @@
package com.yihu.mm.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
public class JSONUtil {
    /**
     * 将json转化为实体POJO
     * @param jsonStr
     * @param obj
     * @return
     */
    public static<T> Object JSONToObj(String jsonStr,Class<T> obj) {
        T t = null;
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            t = objectMapper.readValue(jsonStr,
                    obj);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return t;
    }
    /**
     * 将实体POJO转化为JSON
     * @param obj
     * @return
     * @throws JSONException
     * @throws IOException
     */
    public static<T> JSONObject objectToJson(T obj) throws JSONException, IOException {
        ObjectMapper mapper = new ObjectMapper();
        // Convert object to JSON string
        String jsonStr = "";
        try {
            jsonStr =  mapper.writeValueAsString(obj);
        } catch (IOException e) {
            throw e;
        }
        return new JSONObject(jsonStr);
    }
}

+ 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:

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

@ -35,15 +35,8 @@ public class YueRenController extends BaseController {
    @RequestMapping(value = "/phonekey", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getPhoneKey() {
        String postStr = remoteCall("/yueren/phonekey", new JSONObject());
        JSONObject jsonObject = new JSONObject(postStr);
        String status = jsonObject.get("status").toString();
        if ("200".equals(status)) {
            JSONObject recordset = jsonObject.getJSONObject("recordset");
            String key = recordset.getString("key");
            this.saveKey(key);
        }
        return postStr;
        String key =wlyyMedicineKeyService.getKey();
        return  write(200,"查询成功","key",key);
    }
    /**
@ -55,6 +48,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String insertSlip(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/insertslip", params);
        return postStr;
    }
@ -82,7 +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",key);
        String answer = params.get("answer").toString();
        params.put("answer","/attach/"+key+"/"+answer);
        String postStr = remoteCall("/yueren/dillphoneimgdata", params);
        return postStr;
    }
@ -98,6 +96,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String findTest(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/findtest", params);
        return postStr;
    }
@ -111,6 +110,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String giveproblem(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/giveproblem", params);
        return postStr;
    }
@ -124,6 +124,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String handleproblem(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/handleproblem", params);
        return postStr;
    }
@ -137,6 +138,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String centralizedproblem(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/centralizedproblem", params);
        return postStr;
    }
@ -150,6 +152,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String conclusionFactor(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/conclusionfactor", params);
        return postStr;
    }
@ -165,6 +168,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String insertConsultConclusionHealth(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/insertconconhealth", params);
        return postStr;
    }
@ -178,6 +182,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String insertConsultConclusion(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/findconconhealth", params);
        return postStr;
    }
@ -191,6 +196,7 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String findIntegral(@RequestBody String jsonString) {
        JSONObject params = new JSONObject(jsonString);
        params.put("key",wlyyMedicineKeyService.getKey());
        String postStr = remoteCall("/yueren/findintegral", params);
        return postStr;
    }

+ 7 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/medicine/entity/WlyyMedicineKey.java

@ -1,7 +1,7 @@
package com.yihu.wlyy.medicine.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
@ -13,20 +13,21 @@ import java.util.Date;
@Entity
@Table(name = "wlyy_medicine_key", schema = "", catalog = "medicine")
public class WlyyMedicineKey implements Serializable {
    private Long id;
    private String id;
    private String accessKey;
    private Long addTimestamp;
    private Long expiresIn;
    private Date creataTime;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    public String getId() {
        return id;
    }
    public void setId(Long id) {
    public void setId(String id) {
        this.id = id;
    }

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/medicine/repository/WlyyMedicineKeyDao.java

@ -2,10 +2,17 @@ package com.yihu.wlyy.medicine.repository;
import com.yihu.wlyy.medicine.entity.WlyyMedicineKey;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/8/14.
 */
public interface WlyyMedicineKeyDao extends PagingAndSortingRepository<WlyyMedicineKey, Long>, JpaSpecificationExecutor<WlyyMedicineKey> {
    @Query("select w from WlyyMedicineKey w order by w.addTimestamp desc")
    List<WlyyMedicineKey> findAll();
}

+ 4 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java

@ -39,6 +39,7 @@ public class FamilyMemberService extends BaseService {
    @Autowired
    FamilyContractService contractService;
    @Autowired
    private HosDoctorService hosDoctorService;
    Map<Integer, String> relations = new HashMap<>();
@ -126,7 +127,7 @@ public class FamilyMemberService extends BaseService {
        return list;
    }
    public Map getPatient(String patient){
    public Map getPatient(String patient) throws Exception {
        Patient p = patientDao.findByCode(patient);
        //查询签约信息
@ -144,6 +145,8 @@ public class FamilyMemberService extends BaseService {
        }
        map.put("doctor",doctor);
        map.put("doctorName",doctorName);
        Doctor _doctor = hosDoctorService.getDoctorByCode(doctor);
        map.put("doctorMobile",_doctor.getMobile());
        map.put("code", p.getCode());
        map.put("name", p.getName());
        map.put("sex", p.getSex());

+ 32 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/medicine/WlyyMedicineKeyService.java

@ -2,19 +2,25 @@ package com.yihu.wlyy.service.manager.medicine;
import com.yihu.wlyy.medicine.entity.WlyyMedicineKey;
import com.yihu.wlyy.medicine.repository.WlyyMedicineKeyDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.query.BasemedicineJpaService;
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.springside.modules.utils.Clock;
import javax.annotation.Resource;
import java.util.List;
/**
 * Created by Administrator on 2017/8/14.
 */
@Service
public class WlyyMedicineKeyService extends BasemedicineJpaService<WlyyMedicineKey, WlyyMedicineKeyDao> {
    @Value("${yueren.api}")
    private String api;
    @Autowired
    private WlyyMedicineKeyDao wlyyMedicineKeyDao;
@ -28,4 +34,28 @@ public class WlyyMedicineKeyService extends BasemedicineJpaService<WlyyMedicineK
        medicineKey.setCreataTime(clock.getCurrentDate());
        wlyyMedicineKeyDao.save(medicineKey);
    }
    public String getKey() {
        String key="";
        List<WlyyMedicineKey> wlyyMedicineKeys = wlyyMedicineKeyDao.findAll();
        if(wlyyMedicineKeys!=null && wlyyMedicineKeys.size()>0){
            for (WlyyMedicineKey wlyyMedicineKey : wlyyMedicineKeys) {
                if ((System.currentTimeMillis() - wlyyMedicineKey.getAddTimestamp()) < (wlyyMedicineKey.getExpiresIn() * 1000)) {
                    return wlyyMedicineKey.getAccessKey();
                } else {
                    wlyyMedicineKeyDao.delete(wlyyMedicineKey);
                }
            }
        }
        String postStr = HttpClientUtil.postBody(api + "/yueren/phonekey", new JSONObject());
        JSONObject jsonObject = new JSONObject(postStr);
        String status = jsonObject.get("status").toString();
        if ("200".equals(status)) {
            JSONObject recordset = jsonObject.getJSONObject("recordset");
            key = recordset.getString("key");
            this.saveKey(key);
        }
        return key;
    }
}

+ 4 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java

@ -1,9 +1,5 @@
package com.yihu.wlyy.util;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
@ -20,6 +16,10 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
public class HttpClientUtil {
	/**

+ 10 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java

@ -87,6 +87,8 @@ public class Prescription extends IdEntity {
    private String prescribeReason; //开方失败/成功原因
    private Date prescribeTime ;//开方失败、成功时间
    private Integer jwPayStatus;//处方结算状态,0为未结算,1为结算成功,默认为0
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {
        return code;
@ -641,4 +643,12 @@ public class Prescription extends IdEntity {
    public void setPrescribeTime(Date prescribeTime) {
        this.prescribeTime = prescribeTime;
    }
    public Integer getJwPayStatus() {
        return jwPayStatus;
    }
    public void setJwPayStatus(Integer jwPayStatus) {
        this.jwPayStatus = jwPayStatus;
    }
}

+ 0 - 70
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyCommonDict.java

@ -1,70 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyCommonDict entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "zy_common_dict")
public class ZyCommonDict extends IdEntity implements java.io.Serializable {
    /**
     * '计量单位字典、药品剂型字典、科室类别字典、注射地点字典、皮试类型字典、费别字典、频次字典、药品毒理分类字典、用药方法字典、性别字典的字典结构';
     */
    // Fields
    private String dictName;//字典名称
    private String code;//编码
    private String name;//名称
    // Constructors
    /**
     * default constructor
     */
    public ZyCommonDict() {
    }
    /**
     * full constructor
     */
    public ZyCommonDict(String dictName, String code, String name) {
        this.dictName = dictName;
        this.code = code;
        this.name = name;
    }
    @Column(name = "dict_name", length = 200)
    public String getDictName() {
        return this.dictName;
    }
    public void setDictName(String dictName) {
        this.dictName = dictName;
    }
    @Column(name = "code", length = 50)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name", length = 200)
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

+ 0 - 85
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptDict.java

@ -1,85 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDeptDict entity. @author MyEclipse Persistence Tools
 * 科室字典
 */
@Entity
@Table(name = "zy_iv_dept_dict")
public class ZyIvDeptDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String deptCode;//科室代码
	private String deptName;//科室名称
	private String deptClass;//科室类型  详见科室类型字典中定义
	private String upperDept;//上级科室
	// Constructors
	/** default constructor */
	public ZyIvDeptDict() {
	}
	/** full constructor */
	public ZyIvDeptDict(String orgCode, String deptCode, String deptName,
						String deptType, String upperDept) {
		this.orgCode = orgCode;
		this.deptCode = deptCode;
		this.deptName = deptName;
		this.upperDept = upperDept;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "dept_code", length = 50)
	public String getDeptCode() {
		return this.deptCode;
	}
	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}
	@Column(name = "dept_name", length = 200)
	public String getDeptName() {
		return this.deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Column(name = "dept_class", length = 50)
	public String getDeptClass() {
		return deptClass;
	}
	public void setDeptClass(String deptClass) {
		this.deptClass = deptClass;
	}
	@Column(name = "upper_dept", length = 50)
	public String getUpperDept() {
		return this.upperDept;
	}
	public void setUpperDept(String upperDept) {
		this.upperDept = upperDept;
	}
}

+ 0 - 65
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptStaffAllotDict.java

@ -1,65 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDeptStaffAllotDict entity. @author MyEclipse Persistence Tools
 * 科室员工配置字典
 */
@Entity
@Table(name = "zy_iv_dept_staff_allot_dict")
public class ZyIvDeptStaffAllotDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String deptCode;//科室编码
	private String staffCode;//员工编码
	// Constructors
	/** default constructor */
	public ZyIvDeptStaffAllotDict() {
	}
	/** full constructor */
	public ZyIvDeptStaffAllotDict(String orgCode, String deptCode,
			String staffCode) {
		this.orgCode = orgCode;
		this.deptCode = deptCode;
		this.staffCode = staffCode;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "dept_code", length = 50)
	public String getDeptCode() {
		return this.deptCode;
	}
	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}
	@Column(name = "staff_code", length = 50)
	public String getStaffCode() {
		return this.staffCode;
	}
	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}
}

+ 0 - 109
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseClassDict.java

@ -1,109 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDiagnoseClassDict entity. @author MyEclipse Persistence Tools
 * 诊断类别字典
 */
@Entity
@Table(name = "zy_iv_diagnose_class_dict")
public class ZyIvDiagnoseClassDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String classSubNo;//类别子序号
	private String classCode;//类别代码
	private String className;//类别名称
	private String upperClass;//上级类别
	private String validFlag;//有效标志  0 :无效;1:有效
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	// Constructors
	/** default constructor */
	public ZyIvDiagnoseClassDict() {
	}
	/** full constructor */
	public ZyIvDiagnoseClassDict(String classSubNo, String classCode,
			String className, String upperClass, String validFlag,
			String spellCode, String wbzxCode) {
		this.classSubNo = classSubNo;
		this.classCode = classCode;
		this.className = className;
		this.upperClass = upperClass;
		this.validFlag = validFlag;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "class_sub_no", length = 200)
	public String getClassSubNo() {
		return this.classSubNo;
	}
	public void setClassSubNo(String classSubNo) {
		this.classSubNo = classSubNo;
	}
	@Column(name = "class_code", length = 200)
	public String getClassCode() {
		return this.classCode;
	}
	public void setClassCode(String classCode) {
		this.classCode = classCode;
	}
	@Column(name = "class_name", length = 2000)
	public String getClassName() {
		return this.className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	@Column(name = "upper_class", length = 200)
	public String getUpperClass() {
		return this.upperClass;
	}
	public void setUpperClass(String upperClass) {
		this.upperClass = upperClass;
	}
	@Column(name = "valid_flag", length = 50)
	public String getValidFlag() {
		return this.validFlag;
	}
	public void setValidFlag(String validFlag) {
		this.validFlag = validFlag;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
}

+ 0 - 111
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseDict.java

@ -1,111 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDiagnoseDict entity. @author MyEclipse Persistence Tools
 * 诊断字典表
 */
@Entity
@Table(name = "zy_iv_diagnose_dict")
public class ZyIvDiagnoseDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String diagnoseCode;//诊断代码
	private String diagnoseName;//诊断名称
	private String diagnoseAlias;//诊断别名
	private String diagnoseClass;//诊断类别  详见诊断类别字典定义
	private String validFlag;//有效标志   0 :无效;1:有效
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	// Constructors
	/** default constructor */
	public ZyIvDiagnoseDict() {
	}
	/** full constructor */
	public ZyIvDiagnoseDict(String diagnoseCode, String diagnoseName,
			String diagnoseAlias, String diagnoseClass, String validFlag,
			String spellCode, String wbzxCode) {
		this.diagnoseCode = diagnoseCode;
		this.diagnoseName = diagnoseName;
		this.diagnoseAlias = diagnoseAlias;
		this.diagnoseClass = diagnoseClass;
		this.validFlag = validFlag;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "diagnose_code", length = 200)
	public String getDiagnoseCode() {
		return this.diagnoseCode;
	}
	public void setDiagnoseCode(String diagnoseCode) {
		this.diagnoseCode = diagnoseCode;
	}
	@Column(name = "diagnose_name", length = 2000)
	public String getDiagnoseName() {
		return this.diagnoseName;
	}
	public void setDiagnoseName(String diagnoseName) {
		this.diagnoseName = diagnoseName;
	}
	@Column(name = "diagnose_alias", length = 2000)
	public String getDiagnoseAlias() {
		return this.diagnoseAlias;
	}
	public void setDiagnoseAlias(String diagnoseAlias) {
		this.diagnoseAlias = diagnoseAlias;
	}
	@Column(name = "diagnose_class", length = 50)
	public String getDiagnoseClass() {
		return this.diagnoseClass;
	}
	public void setDiagnoseClass(String diagnoseClass) {
		this.diagnoseClass = diagnoseClass;
	}
	@Column(name = "valid_flag", length = 50)
	public String getValidFlag() {
		return this.validFlag;
	}
	public void setValidFlag(String validFlag) {
		this.validFlag = validFlag;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
}

+ 0 - 54
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java

@ -1,54 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvOrgPhysicAllotDict entity. @author MyEclipse Persistence Tools
 * 机构药品分发字典
 */
@Entity
@Table(name = "zy_iv_org_physic_allot_dict")
public class ZyIvOrgPhysicAllotDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String physicCode;//药品代码
	// Constructors
	/** default constructor */
	public ZyIvOrgPhysicAllotDict() {
	}
	/** full constructor */
	public ZyIvOrgPhysicAllotDict(String orgCode, String physicCode) {
		this.orgCode = orgCode;
		this.physicCode = physicCode;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "physic_code", length = 50)
	public String getPhysicCode() {
		return this.physicCode;
	}
	public void setPhysicCode(String physicCode) {
		this.physicCode = physicCode;
	}
}

+ 0 - 223
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvPhysicDict.java

@ -1,223 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvPhysicDict entity. @author MyEclipse Persistence Tools
 * 药品字典
 */
@Entity
@Table(name = "zy_iv_physic_dict")
public class ZyIvPhysicDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String physicCode;//药品代码
	private String physicName;//药品名称
	private String physicSpec;//药品规格
	private String subjectClass;//药品科目  科目类别字典中定义
	private String doseUnit;//剂量单位 计量单位字典中定义
	private String quantityUnit;//数量单位  计量单位字典中定义
	private String packUnit;//包装单位   计量单位字典中定义
	private Double minDose;//最小剂量
	private Double packSpec;
	private Double retailPrice;//零售价
	private String physicForm;//药品剂型  药品剂型字典中定义
	private String toxicologyType;//毒理分类  药品毒理分类字典中定义
	private String basicFlag;//基本药物标志  0:否;1:是
	private String validFlag;//有效标志 0:无效;1:有效
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	private Integer sequence;//排序号
	// Constructors
	/** default constructor */
	public ZyIvPhysicDict() {
	}
	/** full constructor */
	public ZyIvPhysicDict(String physicCode, String physicName,
						  String physicSpec, String subjectClass, String doseUnit,
						  String quantityUnit, String packUnit, Double minDose,
						  Double packSpec, Double retailPrice, String physicFrom,
						  String toxicologyType, String basicFlag, String validFlag,
						  String spellCode, String wbzxCode, Integer sequence) {
		this.physicCode = physicCode;
		this.physicName = physicName;
		this.physicSpec = physicSpec;
		this.subjectClass = subjectClass;
		this.doseUnit = doseUnit;
		this.quantityUnit = quantityUnit;
		this.packUnit = packUnit;
		this.minDose = minDose;
		this.packSpec = packSpec;
		this.retailPrice = retailPrice;
		this.toxicologyType = toxicologyType;
		this.basicFlag = basicFlag;
		this.validFlag = validFlag;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
		this.sequence = sequence;
	}
	@Column(name = "physic_code", length = 50)
	public String getPhysicCode() {
		return this.physicCode;
	}
	public void setPhysicCode(String physicCode) {
		this.physicCode = physicCode;
	}
	@Column(name = "physic_name", length = 2000)
	public String getPhysicName() {
		return this.physicName;
	}
	public void setPhysicName(String physicName) {
		this.physicName = physicName;
	}
	@Column(name = "physic_spec", length = 2000)
	public String getPhysicSpec() {
		return this.physicSpec;
	}
	public void setPhysicSpec(String physicSpec) {
		this.physicSpec = physicSpec;
	}
	@Column(name = "subject_class", length = 200)
	public String getSubjectClass() {
		return this.subjectClass;
	}
	public void setSubjectClass(String subjectClass) {
		this.subjectClass = subjectClass;
	}
	@Column(name = "dose_unit", length = 50)
	public String getDoseUnit() {
		return this.doseUnit;
	}
	public void setDoseUnit(String doseUnit) {
		this.doseUnit = doseUnit;
	}
	@Column(name = "quantity_unit", length = 50)
	public String getQuantityUnit() {
		return this.quantityUnit;
	}
	public void setQuantityUnit(String quantityUnit) {
		this.quantityUnit = quantityUnit;
	}
	@Column(name = "pack_unit", length = 250)
	public String getPackUnit() {
		return this.packUnit;
	}
	public void setPackUnit(String packUnit) {
		this.packUnit = packUnit;
	}
	@Column(name = "min_dose", precision = 20, scale = 6)
	public Double getMinDose() {
		return this.minDose;
	}
	public void setMinDose(Double minDose) {
		this.minDose = minDose;
	}
	@Column(name = "pack_spec", precision = 20, scale = 6)
	public Double getPackSpec() {
		return this.packSpec;
	}
	public void setPackSpec(Double packSpec) {
		this.packSpec = packSpec;
	}
	@Column(name = "retail_price", precision = 20, scale = 6)
	public Double getRetailPrice() {
		return this.retailPrice;
	}
	public void setRetailPrice(Double retailPrice) {
		this.retailPrice = retailPrice;
	}
	@Column(name = "physic_form", length = 50)
	public String getPhysicForm() {
		return physicForm;
	}
	public void setPhysicForm(String physicForm) {
		this.physicForm = physicForm;
	}
	@Column(name = "toxicology_type", length = 250)
	public String getToxicologyType() {
		return this.toxicologyType;
	}
	public void setToxicologyType(String toxicologyType) {
		this.toxicologyType = toxicologyType;
	}
	@Column(name = "basic_flag", length = 50)
	public String getBasicFlag() {
		return this.basicFlag;
	}
	public void setBasicFlag(String basicFlag) {
		this.basicFlag = basicFlag;
	}
	@Column(name = "valid_flag", length = 50)
	public String getValidFlag() {
		return this.validFlag;
	}
	public void setValidFlag(String validFlag) {
		this.validFlag = validFlag;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "sequence")
	public Integer getSequence() {
		return this.sequence;
	}
	public void setSequence(Integer sequence) {
		this.sequence = sequence;
	}
}

+ 0 - 146
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffDict.java

@ -1,146 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.Date;
/**
 * ZyIvStaffDict entity. @author MyEclipse Persistence Tools
 * 员工字典
 */
@Entity
@Table(name = "zy_iv_staff_dict")
public class ZyIvStaffDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String staffCode;//员工编码
	private String staffName;//员工姓名
	private String workCode;//工作牌号
	private Date birthday;//出生日期
	private String sex;//性别  详见基础字典中定义
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	private String identityNo;//证件号
	private String certificateNo;//从业资格证编号
	// Constructors
	/** default constructor */
	public ZyIvStaffDict() {
	}
	/** full constructor */
	public ZyIvStaffDict(String orgCode, String staffCode, String staffName,
			String workCode, Timestamp birthday, String sex, String spellCode,
			String wbzxCode, String identityNo, String certificateNo) {
		this.orgCode = orgCode;
		this.staffCode = staffCode;
		this.staffName = staffName;
		this.workCode = workCode;
		this.birthday = birthday;
		this.sex = sex;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
		this.identityNo = identityNo;
		this.certificateNo = certificateNo;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "staff_code", length = 50)
	public String getStaffCode() {
		return this.staffCode;
	}
	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}
	@Column(name = "staff_name", length = 50)
	public String getStaffName() {
		return this.staffName;
	}
	public void setStaffName(String staffName) {
		this.staffName = staffName;
	}
	@Column(name = "work_code", length = 50)
	public String getWorkCode() {
		return this.workCode;
	}
	public void setWorkCode(String workCode) {
		this.workCode = workCode;
	}
	@Column(name = "birthday", length = 0)
	public Date getBirthday() {
		return this.birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	@Column(name = "sex", length = 50)
	public String getSex() {
		return this.sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "identity_no", length = 200)
	public String getIdentityNo() {
		return this.identityNo;
	}
	public void setIdentityNo(String identityNo) {
		this.identityNo = identityNo;
	}
	@Column(name = "certificate_no", length = 200)
	public String getCertificateNo() {
		return this.certificateNo;
	}
	public void setCertificateNo(String certificateNo) {
		this.certificateNo = certificateNo;
	}
}

+ 0 - 88
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffRegTypeAllotDict.java

@ -1,88 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvStaffRegTypeAllotDict entity. @author MyEclipse Persistence Tools
 * 员工挂号类型配置字典
 */
@Entity
@Table(name = "zy_iv_staff_reg_type_allot_dict")
public class ZyIvStaffRegTypeAllotDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String staffCode;//员工编码
	private Integer registerType;//挂号类型编码
	private String registerTypeName;//挂号类型名称
	private Double registerFee;//挂号费用  挂号费+诊察费
	// Constructors
	/** default constructor */
	public ZyIvStaffRegTypeAllotDict() {
	}
	/** full constructor */
	public ZyIvStaffRegTypeAllotDict(String orgCode, String staffCode,
			Integer registerType, String registerTypeName, Double registerFee) {
		this.orgCode = orgCode;
		this.staffCode = staffCode;
		this.registerType = registerType;
		this.registerTypeName = registerTypeName;
		this.registerFee = registerFee;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "staff_code", length = 50)
	public String getStaffCode() {
		return this.staffCode;
	}
	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}
	@Column(name = "register_type")
	public Integer getRegisterType() {
		return this.registerType;
	}
	public void setRegisterType(Integer registerType) {
		this.registerType = registerType;
	}
	@Column(name = "register_type_name", length = 2000)
	public String getRegisterTypeName() {
		return this.registerTypeName;
	}
	public void setRegisterTypeName(String registerTypeName) {
		this.registerTypeName = registerTypeName;
	}
	@Column(name = "register_fee", precision = 20, scale = 6)
	public Double getRegisterFee() {
		return this.registerFee;
	}
	public void setRegisterFee(Double registerFee) {
		this.registerFee = registerFee;
	}
}

+ 0 - 88
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvSubjectClassDict.java

@ -1,88 +0,0 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvSubjectClassDict entity. @author MyEclipse Persistence Tools
 * 科目类别字典
 */
@Entity
@Table(name = "zy_iv_subject_class_dict")
public class ZyIvSubjectClassDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String classCode;//类别代码
	private String className;//类别名称
	private String upperClass;//上级类别
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	// Constructors
	/** default constructor */
	public ZyIvSubjectClassDict() {
	}
	/** full constructor */
	public ZyIvSubjectClassDict(String classCode, String className,
			String upperClass, String spellCode, String wbzxCode) {
		this.classCode = classCode;
		this.className = className;
		this.upperClass = upperClass;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "class_code", length = 200)
	public String getClassCode() {
		return this.classCode;
	}
	public void setClassCode(String classCode) {
		this.classCode = classCode;
	}
	@Column(name = "class_name", length = 2000)
	public String getClassName() {
		return this.className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	@Column(name = "upper_class", length = 200)
	public String getUpperClass() {
		return this.upperClass;
	}
	public void setUpperClass(String upperClass) {
		this.upperClass = upperClass;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
}

+ 1 - 1
patient-co/patient-co-wlyy/pom.xml

@ -427,7 +427,7 @@
                    <target>1.8</target>
                    <compilerArguments>
                        <verbose/>
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                        <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
                <version>3.1</version>

+ 240 - 221
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java

@ -7,7 +7,10 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.service.system.Icd10DictServcie;
import com.yihu.wlyy.service.third.jw.ZyDictService;
import com.yihu.wlyy.util.CommonUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -21,6 +24,7 @@ import java.util.List;
@Component
public class PresModeAdapter {
    private static Logger logger = LoggerFactory.getLogger(PresModeAdapter.class);
    @Autowired
    private Icd10DictServcie icd10DictServcie;
    @Autowired
@ -32,65 +36,71 @@ public class PresModeAdapter {
     * @return
     * @throws Exception
     */
    public JSONArray modeTopresInfo(String json) throws Exception{
        JSONObject oldJson = JSONObject.parseObject(json);
        String dataStr = oldJson.getString("data");
        JSONObject data = JSONObject.parseObject(dataStr);
        JSONArray returnData = data.getJSONArray("returnData");
        String code = data.getString("CODE");
        if(StringUtils.isNotBlank(code)&&"1".equals(code)){
            JSONArray rs = new JSONArray();
            Iterator iterator = returnData.iterator();
            while (iterator.hasNext()){
                JSONArray modeArray = (JSONArray) iterator.next();
                for(int i=0;i<modeArray.size();i++){
                    JSONObject mode = (JSONObject) modeArray.get(i);
                    JSONObject m = new JSONObject();
                    m.put("templateNo",mode.getInteger("TEMPLATE_NO"));
                    m.put("templateName",mode.getString("TEMPLATE_NAME"));
                    //m.put("templateExplain",mode.getInt("TEMPLATE_EXPLAIN"));
                    JSONArray infos = mode.getJSONArray("TEMPLATE_DETAIL");
                    Iterator infoIt = infos.iterator();
                    JSONArray is = new JSONArray();
                    while (infoIt.hasNext()){
                        JSONObject info = (JSONObject) infoIt.next();
                        PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                        prescriptionInfo.setRemark(info.getString("REMARK"));
                        prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
                        prescriptionInfo.setDirection(info.getString("USAGE_NAME"));//药品用法
                        prescriptionInfo.setDrugCode(info.getString("ITEM_CODE"));//药品code
                        prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                        prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                        prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                        prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                        prescriptionInfo.setPrice(info.getInteger("ITEM_PRICE"));//药品单价
                        prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                        prescriptionInfo.setJwSubCode("");//智业子处方号
                        prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
                        prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
                        prescriptionInfo.setCost(1);//金额
                        prescriptionInfo.setCharge(0);//自付
                        prescriptionInfo.setBindFlag("0");//成组标志, 0.非成组,1.成组
                        prescriptionInfo.setDayCount(info.getInteger("DAY_COUNT"));//用药天数
                        prescriptionInfo.setDrugUsage(info.getString("USAGE"));//用药方法编码
                        prescriptionInfo.setUsageName(info.getString("USAGE_NAME"));//用药方法名称
                        prescriptionInfo.setPhysicDose(info.getString("PHYSIC_DOSE"));//用药剂量
                        prescriptionInfo.setPhysicDoseUnit(info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                        prescriptionInfo.setPhysicDoseUnitName(info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                        prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
                        prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                        prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                        prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
                        prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                        prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                        prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                        is.add(prescriptionInfo);
    public JSONArray modeTopresInfo(String json){
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            String dataStr = oldJson.getString("data");
            JSONObject data = JSONObject.parseObject(dataStr);
            JSONArray returnData = data.getJSONArray("returnData");
            String code = data.getString("CODE");
            if(StringUtils.isNotBlank(code)&&"1".equals(code)){
                JSONArray rs = new JSONArray();
                Iterator iterator = returnData.iterator();
                while (iterator.hasNext()){
                    JSONArray modeArray = (JSONArray) iterator.next();
                    for(int i=0;i<modeArray.size();i++){
                        JSONObject mode = (JSONObject) modeArray.get(i);
                        JSONObject m = new JSONObject();
                        m.put("templateNo",mode.getInteger("TEMPLATE_NO"));
                        m.put("templateName",mode.getString("TEMPLATE_NAME"));
                        //m.put("templateExplain",mode.getInt("TEMPLATE_EXPLAIN"));
                        JSONArray infos = mode.getJSONArray("TEMPLATE_DETAIL");
                        Iterator infoIt = infos.iterator();
                        JSONArray is = new JSONArray();
                        while (infoIt.hasNext()){
                            JSONObject info = (JSONObject) infoIt.next();
                            PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                            prescriptionInfo.setRemark(info.getString("REMARK"));
                            prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
                            prescriptionInfo.setDirection(info.getString("USAGE_NAME"));//药品用法
                            prescriptionInfo.setDrugCode(info.getString("ITEM_CODE"));//药品code
                            prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                            prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                            prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                            prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                            prescriptionInfo.setPrice(info.getInteger("ITEM_PRICE"));//药品单价
                            prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                            prescriptionInfo.setJwSubCode("");//智业子处方号
                            prescriptionInfo.setSubjectClass(info.getString("SUBJECT_CLASS"));//"科目类别编码",
                            prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
                            prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
//                            prescriptionInfo.setCost(1);//金额
//                            prescriptionInfo.setCharge(0);//自付
                            prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));//成组标志, 0.非成组,1.成组
                            prescriptionInfo.setDayCount(info.getInteger("DAY_COUNT"));//用药天数
                            prescriptionInfo.setDrugUsage(info.getString("USAGE"));//用药方法编码
                            prescriptionInfo.setUsageName(info.getString("USAGE_NAME"));//用药方法名称
                            prescriptionInfo.setPhysicDose(info.getString("PHYSIC_DOSE"));//用药剂量
                            prescriptionInfo.setPhysicDoseUnit(info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                            prescriptionInfo.setPhysicDoseUnitName(info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                            prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
                            prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                            prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                            prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
                            prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                            prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                            prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                            is.add(prescriptionInfo);
                        }
                        m.put("prescriptionInfo",is);
                        rs.add(m);
                    }
                    m.put("prescriptionInfo",is);
                    rs.add(m);
                }
                return rs;
            }
            return rs;
        }catch (Exception e){
            logger.info("PresModeAdapter:modeTopresInfo:Json:"+json);
            throw e;
        }
        return null;
    }
@ -101,99 +111,104 @@ public class PresModeAdapter {
     * @return
     * @throws Exception
     */
    public JSONArray modeToPrescription(String json)throws Exception{
        JSONObject oldJson = JSONObject.parseObject(json);
        JSONObject data = oldJson.getJSONObject("data");
        JSONArray returnData = data.getJSONArray("returnData");
        String code = data.getString("CODE");
        if(StringUtils.isNotBlank(code)&&"1".equals(code)){
            JSONArray rs = new JSONArray();
            Iterator iterator = returnData.iterator();
            while (iterator.hasNext()){
                JSONArray modeArray = (JSONArray) iterator.next();
                for(int i=0;i<modeArray.size();i++){
                    JSONObject mode = (JSONObject) modeArray.get(i);
                    JSONObject p  = new JSONObject();
                    p.put("code",mode.getInteger("RECIPE_NO")+"");
                    p.put("createTime",mode.getString("APPLY_TIME"));
    public JSONArray modeToPrescription(String json){
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            JSONObject data = oldJson.getJSONObject("data");
            JSONArray returnData = data.getJSONArray("returnData");
            String code = data.getString("CODE");
            if(StringUtils.isNotBlank(code)&&"1".equals(code)){
                JSONArray rs = new JSONArray();
                Iterator iterator = returnData.iterator();
                while (iterator.hasNext()){
                    JSONArray modeArray = (JSONArray) iterator.next();
                    for(int i=0;i<modeArray.size();i++){
                        JSONObject mode = (JSONObject) modeArray.get(i);
                        JSONObject p  = new JSONObject();
                        p.put("code",mode.getInteger("RECIPE_NO")+"");
                        p.put("createTime",mode.getString("APPLY_TIME"));
                    Doctor doctor =  zyDictService.getDoctByJw(mode.getString("APPLY_OPERATOR"),mode.getString("HEALTH_ORG_CODE"));
                    // "APPLY_OPERATOR_NAME": 开单医生姓名","HEALTH_ORG_CODE": "开单机构编码",
                    if(doctor!=null){
                        p.put("doctor",doctor.getCode());
                        p.put("doctorName",doctor.getName());
                        p.put("hospitalName",doctor.getHospitalName());
                        p.put("hospital",doctor.getHospital());
                    }else{
                        p.put("doctor",mode.getString("APPLY_OPERATOR"));
                        p.put("doctorName",mode.getString("APPLY_OPERATOR_NAME"));
                        p.put("hospitalName",mode.getString("HEALTH_ORG_CODE"));
                        p.put("hospital",mode.getString("HEALTH_ORG_CODE"));
                    }
                        Doctor doctor =  zyDictService.getDoctByJw(mode.getString("APPLY_OPERATOR"),mode.getString("HEALTH_ORG_CODE"));
                        // "APPLY_OPERATOR_NAME": 开单医生姓名","HEALTH_ORG_CODE": "开单机构编码",
                        if(doctor!=null){
                            p.put("doctor",doctor.getCode());
                            p.put("doctorName",doctor.getName());
                            p.put("hospitalName",doctor.getHospitalName());
                            p.put("hospital",doctor.getHospital());
                        }else{
                            p.put("doctor",mode.getString("APPLY_OPERATOR"));
                            p.put("doctorName",mode.getString("APPLY_OPERATOR_NAME"));
                            p.put("hospitalName",mode.getString("HEALTH_ORG_CODE"));
                            p.put("hospital",mode.getString("HEALTH_ORG_CODE"));
                        }
                    PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();
                    String diagnoseCode = mode.getString("DIAGNOSE_CODE");
                    String diagnoseName = mode.getString("DIAGNOSE_NAME");
                        PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();
                        String diagnoseCode = mode.getString("DIAGNOSE_CODE");
                        String diagnoseName = mode.getString("DIAGNOSE_NAME");
//                    String diagnoseCode = "E10.100";
//                    String diagnoseName = "1型糖尿病性酮症";
                    diagnosis.setCode(diagnoseCode);//诊断代码
                    diagnosis.setName(diagnoseName);//诊断名称
                    String icd10 = icd10DictServcie.getHealthProblemsByIcd10Code(diagnoseCode);
                    if(!StringUtils.isEmpty(icd10)){
                        JSONObject icd = JSONObject.parseObject(icd10);
                        diagnosis.setHealthProblemName(icd.getString("value"));//诊断名称
                        diagnosis.setHealthProblem(icd.getString("key"));//诊断代码
                    }else{
                        diagnosis.setHealthProblemName(diagnoseName);//诊断名称
                        diagnosis.setHealthProblem(diagnoseCode);//诊断代码
                    }
                    JSONArray jsonArrayDt = new JSONArray();
                    jsonArrayDt.add(diagnosis);
                    p.put("prescriptionDt",jsonArrayDt);
                        diagnosis.setCode(diagnoseCode);//诊断代码
                        diagnosis.setName(diagnoseName);//诊断名称
                        String icd10 = icd10DictServcie.getHealthProblemsByIcd10Code(diagnoseCode);
                        if(!StringUtils.isEmpty(icd10)){
                            JSONObject icd = JSONObject.parseObject(icd10);
                            diagnosis.setHealthProblemName(icd.getString("value"));//诊断名称
                            diagnosis.setHealthProblem(icd.getString("key"));//诊断代码
                        }else{
                            diagnosis.setHealthProblemName(diagnoseName);//诊断名称
                            diagnosis.setHealthProblem(diagnoseCode);//诊断代码
                        }
                        JSONArray jsonArrayDt = new JSONArray();
                        jsonArrayDt.add(diagnosis);
                        p.put("prescriptionDt",jsonArrayDt);
                    JSONArray infos = mode.getJSONArray("RECIPE_DETAIL");
                    Iterator infoIt = infos.iterator();
                    List<PrescriptionInfo> prescriptionInfos = new ArrayList<>();
                    while (infoIt.hasNext()){
                        JSONObject info = (JSONObject) infoIt.next();
                        PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                        prescriptionInfo.setRemark(info.getString("REMARK"));
                        prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
                        prescriptionInfo.setDirection(info.getString("USAGE_NAME"));//药品用法
                        prescriptionInfo.setDrugCode(info.getString("ITEM_CODE"));//药品code
                        prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                        prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                        prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                        prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                        prescriptionInfo.setPrice(info.getInteger("ITEM_PRICE"));//药品单价
                        prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                        prescriptionInfo.setJwSubCode("");//智业子处方号
                        prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
                        prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
                        prescriptionInfo.setCost(1);//金额
                        prescriptionInfo.setCharge(0);//自付
                        prescriptionInfo.setBindFlag("0");//成组标志, 0.非成组,1.成组
                        prescriptionInfo.setDayCount(info.getInteger("DAY_COUNT"));//用药天数
                        prescriptionInfo.setDrugUsage(info.getString("USAGE"));//用药方法编码
                        prescriptionInfo.setUsageName(info.getString("USAGE_NAME"));//用药方法名称
                        prescriptionInfo.setPhysicDose(info.getString("PHYSIC_DOSE"));//用药剂量
                        prescriptionInfo.setPhysicDoseUnit(info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                        prescriptionInfo.setPhysicDoseUnitName(info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                        prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
                        prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                        prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                        prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
                        prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                        prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                        prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                        prescriptionInfos.add(prescriptionInfo);
                        JSONArray infos = mode.getJSONArray("RECIPE_DETAIL");
                        Iterator infoIt = infos.iterator();
                        List<PrescriptionInfo> prescriptionInfos = new ArrayList<>();
                        while (infoIt.hasNext()){
                            JSONObject info = (JSONObject) infoIt.next();
                            PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                            prescriptionInfo.setRemark(info.getString("REMARK"));
                            prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
                            prescriptionInfo.setDirection(info.getString("USAGE_NAME"));//药品用法
                            prescriptionInfo.setDrugCode(info.getString("ITEM_CODE"));//药品code
                            prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                            prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                            prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                            prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                            prescriptionInfo.setPrice(info.getInteger("ITEM_PRICE"));//药品单价
                            prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                            prescriptionInfo.setJwSubCode(info.getString("RECIPE_SUB_NO"));//智业子处方号
                            prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
                            prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
                            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("COST")));//金额
                            prescriptionInfo.setCharge(CommonUtil.doubleToInt(info.getDouble("CHARGE")));//自付
                            prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));//成组标志, 0.非成组,1.成组
                            prescriptionInfo.setDayCount(info.getInteger("DAY_COUNT"));//用药天数
                            prescriptionInfo.setDrugUsage(info.getString("USAGE"));//用药方法编码
                            prescriptionInfo.setUsageName(info.getString("USAGE_NAME"));//用药方法名称
                            prescriptionInfo.setPhysicDose(info.getString("PHYSIC_DOSE"));//用药剂量
                            prescriptionInfo.setPhysicDoseUnit(info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                            prescriptionInfo.setPhysicDoseUnitName(info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                            prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
                            prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                            prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                            prescriptionInfo.setPhysicInjectPlace(info.getString("PHYSIC_INJECT_PLACE"));//注射地点编码
                            prescriptionInfo.setPhysicInjectPlaceName(info.getString("PHYSIC_INJECT_PLACE_NAME"));//注射地点名称
                            prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                            prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                            prescriptionInfos.add(prescriptionInfo);
                        }
                        p.put("prescriptionInfo",prescriptionInfos);
                        rs.add(p);
                    }
                    p.put("prescriptionInfo",prescriptionInfos);
                    rs.add(p);
                }
                return rs;
            }
            return rs;
        }catch (Exception e){
            logger.info("PresModeAdapter:modeToPrescription:Json:"+json);
            throw e;
        }
        return null;
    }
@ -204,90 +219,94 @@ public class PresModeAdapter {
     * @return
     */
    public JSONObject modelToSinglePrescription(String json){
        JSONObject oldJson = JSONObject.parseObject(json);
        JSONObject data = oldJson.getJSONObject("data");
        JSONArray returnData = data.getJSONArray("returnData");
        String code = data.getString("CODE");
        if(StringUtils.isNotBlank(code)&&"1".equals(code)){
            JSONArray modeArray = returnData.getJSONArray(0);
            JSONObject mode = (JSONObject) modeArray.get(0);
            JSONObject p  = new JSONObject();
            p.put("code",mode.getInteger("RECIPE_NO")+"");
            p.put("createTime",mode.getString("APPLY_TIME"));
            Doctor doctor =  zyDictService.getDoctByJw(mode.getString("APPLY_OPERATOR"),mode.getString("HEALTH_ORG_CODE"));
            // "APPLY_OPERATOR_NAME": 开单医生姓名","HEALTH_ORG_CODE": "开单机构编码",
            if(doctor!=null){
                p.put("doctor",doctor.getCode());
                p.put("doctorName",doctor.getName());
                p.put("hospitalName",doctor.getHospitalName());
                p.put("hospital",doctor.getHospital());
            }else{
                p.put("doctor",mode.getString("APPLY_OPERATOR"));
                p.put("doctorName",mode.getString("APPLY_OPERATOR_NAME"));
                p.put("hospitalName",mode.getString("HEALTH_ORG_CODE"));
                p.put("hospital",mode.getString("HEALTH_ORG_CODE"));
            }
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            JSONObject data = oldJson.getJSONObject("data");
            JSONArray returnData = data.getJSONArray("returnData");
            String code = data.getString("CODE");
            if(StringUtils.isNotBlank(code)&&"1".equals(code)){
                JSONArray modeArray = returnData.getJSONArray(0);
                JSONObject mode = (JSONObject) modeArray.get(0);
                JSONObject p  = new JSONObject();
                p.put("code",mode.getInteger("RECIPE_NO")+"");
                p.put("createTime",mode.getString("APPLY_TIME"));
            JSONObject diagnosis = new JSONObject();
//                String diagnoseCode = mode.getString("DIAGNOSE_CODE");
//                String diagnoseName = mode.getString("DIAGNOSE_NAME");
            String diagnoseCode = "E10.100";
            String diagnoseName = "1型糖尿病性酮症";
            diagnosis.put("code",diagnoseCode);//诊断代码
            diagnosis.put("name",diagnoseName);//诊断名称
            String icd10 = icd10DictServcie.getHealthProblemsByIcd10Code(diagnoseCode);
            if(!StringUtils.isEmpty(icd10)){
                JSONObject icd = JSONObject.parseObject(icd10);
                diagnosis.put("healthProblemName",icd.getString("value"));//诊断名称
                diagnosis.put("healthProblem",icd.getString("key"));//诊断代码
            }else{
                diagnosis.put("healthProblemName",diagnoseName);//诊断名称
                diagnosis.put("healthProblem",diagnoseCode);//诊断代码
            }
            JSONArray jsonArrayDt = new JSONArray();
            jsonArrayDt.add(diagnosis);
            p.put("prescriptionDt",jsonArrayDt);
                Doctor doctor =  zyDictService.getDoctByJw(mode.getString("APPLY_OPERATOR"),mode.getString("HEALTH_ORG_CODE"));
                // "APPLY_OPERATOR_NAME": 开单医生姓名","HEALTH_ORG_CODE": "开单机构编码",
                if(doctor!=null){
                    p.put("doctor",doctor.getCode());
                    p.put("doctorName",doctor.getName());
                    p.put("hospitalName",doctor.getHospitalName());
                    p.put("hospital",doctor.getHospital());
                }else{
                    p.put("doctor",mode.getString("APPLY_OPERATOR"));
                    p.put("doctorName",mode.getString("APPLY_OPERATOR_NAME"));
                    p.put("hospitalName",mode.getString("HEALTH_ORG_CODE"));
                    p.put("hospital",mode.getString("HEALTH_ORG_CODE"));
                }
                JSONObject diagnosis = new JSONObject();
                String diagnoseCode = mode.getString("DIAGNOSE_CODE");
                String diagnoseName = mode.getString("DIAGNOSE_NAME");
//                String diagnoseCode = "E10.100";
//                String diagnoseName = "1型糖尿病性酮症";
                diagnosis.put("code",diagnoseCode);//诊断代码
                diagnosis.put("name",diagnoseName);//诊断名称
                String icd10 = icd10DictServcie.getHealthProblemsByIcd10Code(diagnoseCode);
                if(!StringUtils.isEmpty(icd10)){
                    JSONObject icd = JSONObject.parseObject(icd10);
                    diagnosis.put("healthProblemName",icd.getString("value"));//诊断名称
                    diagnosis.put("healthProblem",icd.getString("key"));//诊断代码
                }else{
                    diagnosis.put("healthProblemName",diagnoseName);//诊断名称
                    diagnosis.put("healthProblem",diagnoseCode);//诊断代码
                }
                JSONArray jsonArrayDt = new JSONArray();
                jsonArrayDt.add(diagnosis);
                p.put("prescriptionDt",jsonArrayDt);
            JSONArray infos = mode.getJSONArray("RECIPE_DETAIL");
            Iterator infoIt = infos.iterator();
            JSONArray prescriptionInfos = new JSONArray();
            while (infoIt.hasNext()){
                JSONObject info = (JSONObject) infoIt.next();
                JSONObject prescriptionInfo = new JSONObject();
                prescriptionInfo.put("Remark",info.getString("REMARK"));
                prescriptionInfo.put("BindFlag",info.getString("BIND_FLAG"));
                prescriptionInfo.put("direction",info.getString("USAGE_NAME"));//药品用法
                prescriptionInfo.put("drugCode",info.getString("ITEM_CODE"));//药品code
                prescriptionInfo.put("drugName",info.getString("ITEM_NAME"));//药品名称
                prescriptionInfo.put("drugRate",info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                prescriptionInfo.put("drugRateName",info.getString("FREQUENCY_NAME"));
                prescriptionInfo.put("drugFormat",info.getString("ITEM_SPEC"));//药品规格
                prescriptionInfo.put("price",info.getInteger("ITEM_PRICE"));//药品单价
                prescriptionInfo.put("num",info.getInteger("ITEM_QUANTITY"));//药品数目
                prescriptionInfo.put("jwSubCode","");//智业子处方号
                prescriptionInfo.put("drugNumUnit",info.getString("ITEM_UNIT"));//数量单位编码
                prescriptionInfo.put("drugNumUnitName",info.getString("ITEM_UNIT_NAME"));//数量单位名称
                prescriptionInfo.put("cost",1);//金额
                prescriptionInfo.put("charge",0);//自付
                prescriptionInfo.put("bindFlag","0");//成组标志, 0.非成组,1.成组
                prescriptionInfo.put("dayCount",info.getInteger("DAY_COUNT"));//用药天数
                prescriptionInfo.put("drugUsage",info.getString("USAGE"));//用药方法编码
                prescriptionInfo.put("usageName",info.getString("USAGE_NAME"));//用药方法名称
                prescriptionInfo.put("physicDose",info.getString("PHYSIC_DOSE"));//用药剂量
                prescriptionInfo.put("physicDoseUnit",info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                prescriptionInfo.put("physicDoseUnitName",info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                prescriptionInfo.put("physicAmount",info.getString("PHYSIC_AMOUNT"));//用药总量
                prescriptionInfo.put("physicAmountUnit",info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                prescriptionInfo.put("physicAmountUnitName",info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                prescriptionInfo.put("physicInjectPlace","");//注射地点编码
                prescriptionInfo.put("physicInjectPlaceName","");//注射地点名称
                prescriptionInfo.put("physicSkinTest",info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                prescriptionInfo.put("physicSkinTestName",info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                prescriptionInfos.add(prescriptionInfo);
                JSONArray infos = mode.getJSONArray("RECIPE_DETAIL");
                Iterator infoIt = infos.iterator();
                JSONArray prescriptionInfos = new JSONArray();
                while (infoIt.hasNext()){
                    JSONObject info = (JSONObject) infoIt.next();
                    JSONObject prescriptionInfo = new JSONObject();
                    prescriptionInfo.put("Remark",info.getString("REMARK"));
                    prescriptionInfo.put("BindFlag",info.getString("BIND_FLAG"));
                    prescriptionInfo.put("direction",info.getString("USAGE_NAME"));//药品用法
                    prescriptionInfo.put("drugCode",info.getString("ITEM_CODE"));//药品code
                    prescriptionInfo.put("drugName",info.getString("ITEM_NAME"));//药品名称
                    prescriptionInfo.put("drugRate",info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                    prescriptionInfo.put("drugRateName",info.getString("FREQUENCY_NAME"));
                    prescriptionInfo.put("drugFormat",info.getString("ITEM_SPEC"));//药品规格
                    prescriptionInfo.put("price",info.getInteger("ITEM_PRICE"));//药品单价
                    prescriptionInfo.put("num",info.getInteger("ITEM_QUANTITY"));//药品数目
                    prescriptionInfo.put("jwSubCode",info.getString("RECIPE_SUB_NO"));//智业子处方号
                    prescriptionInfo.put("drugNumUnit",info.getString("ITEM_UNIT"));//数量单位编码
                    prescriptionInfo.put("drugNumUnitName",info.getString("ITEM_UNIT_NAME"));//数量单位名称
                    prescriptionInfo.put("cost",info.getDouble("COST"));//金额
                    prescriptionInfo.put("charge",info.getDouble("CHARGE"));//自付
                    prescriptionInfo.put("bindFlag",info.getString("BIND_FLAG"));//成组标志, 0.非成组,1.成组
                    prescriptionInfo.put("dayCount",info.getInteger("DAY_COUNT"));//用药天数
                    prescriptionInfo.put("drugUsage",info.getString("USAGE"));//用药方法编码
                    prescriptionInfo.put("usageName",info.getString("USAGE_NAME"));//用药方法名称
                    prescriptionInfo.put("physicDose",info.getString("PHYSIC_DOSE"));//用药剂量
                    prescriptionInfo.put("physicDoseUnit",info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
                    prescriptionInfo.put("physicDoseUnitName",info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
                    prescriptionInfo.put("physicAmount",info.getString("PHYSIC_AMOUNT"));//用药总量
                    prescriptionInfo.put("physicAmountUnit",info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                    prescriptionInfo.put("physicAmountUnitName",info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                    prescriptionInfo.put("physicInjectPlace",info.getString("PHYSIC_INJECT_PLACE"));//注射地点编码
                    prescriptionInfo.put("physicInjectPlaceName",info.getString("PHYSIC_INJECT_PLACE_NAME"));//注射地点名称
                    prescriptionInfo.put("physicSkinTest",info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                    prescriptionInfo.put("physicSkinTestName",info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                    prescriptionInfos.add(prescriptionInfo);
                }
                p.put("prescriptionInfo",prescriptionInfos);
                return p;
            }
            p.put("prescriptionInfo",prescriptionInfos);
            return p;
        }catch (Exception e){
            logger.info("PresModeAdapter:modelToSinglePrescription:Json:"+json);
            throw e;
        }
        return null;
    }

+ 0 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java

@ -1,7 +1,5 @@
package com.yihu.wlyy.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.interceptors.DoctorInterceptor;
import com.yihu.wlyy.interceptors.PatientInterceptor;
import com.yihu.wlyy.interceptors.UserInterceptor;
@ -10,13 +8,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.List;
/**
 * Created by chenweida on 2017/4/6.
 */

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1541,4 +1541,16 @@ public class DoctorInfoService extends BaseService {
        }
        return false;
    }
    @Transactional
    public void cancelAuthentication(String doctorCode) throws Exception{
        Doctor doctor = doctorDao.findByCode(doctorCode);
        doctor.setCheckPassword("");
        doctor.setIscertified(0);
        doctor.setCertifiedOvertime(null);
        doctorDao.save(doctor);
    }
}

+ 13 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -124,14 +124,14 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        //取药类型:1 自取 2快递配送 3健管师配送
        Integer type = prescription.getDispensaryType();
        PrescriptionDispensaryCode prescriptionDispensaryCode = savePatientQRCode(token,prescriptionCode);
        PrescriptionDispensaryCode p1 = savePatientQRCode(token,prescriptionCode);
        if(type==3){
            if(prescriptionDispensaryCode!=null){
            if(p1!=null){
                prescriptionDispensaryCode = saveQRCode(prescriptionDispensaryCode.getCode(),token,prescriptionCode,2);
                if(prescriptionDispensaryCode!=null){
                    prescriptionDispensaryCode = saveQRCode(prescriptionDispensaryCode.getCode(),token,prescriptionCode,3);
                    if(prescriptionDispensaryCode==null){
                PrescriptionDispensaryCode p2 = saveQRCode(p1.getCode(),token,prescriptionCode,2);
                if(p2!=null){
                    PrescriptionDispensaryCode p3 = saveQRCode(p1.getCode(),token,prescriptionCode,3);
                    if(p3==null){
                        return false;
                    }
                }else{
@ -230,8 +230,13 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    public Map<String, Object> getQrcode(String prescriptionCode ,String patientCode ,Integer type){
        String sql = "select  p2.is_use as isUse,p2.code as dispensaryCode,p2.img_url,p3.hospital_name as hospitalName  from wlyy_prescription_dispensary_code p2 " +
                " left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code " +
                " where p2.prescription_code=? and p1.patient=? and p2.type=?  and p2.is_Use=0 ";
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql,prescriptionCode,patientCode,type);
                " where p2.prescription_code=?  and p2.type=?  and p2.is_Use=0 ";
        if(type==2||type==3){
            sql +=" and p3.expressage_code=? ";
        }else{
            sql +=" and p1.patient=? ";
        }
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql,prescriptionCode,type,patientCode);
        if(result.size()>0){
            return result.get(0);
        }

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -695,7 +695,7 @@ public class PrescriptionInfoService extends BaseService {
            }
        }
        if(StringUtils.isNotBlank(teamCode)){
            pre_sql.append(" AND p.admin_team_id = ? ");
            pre_sql.append(" AND pr.admin_team_id = ? ");
            param.add(teamCode);
        }
        if(StringUtils.isNotBlank(nameKey)){
@ -1051,7 +1051,7 @@ public class PrescriptionInfoService extends BaseService {
     * @return 0 审核中,1为处理完成
     */
    public String presCheckState(String code){
        StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND pr.status >= "+PrescriptionLog.PrescriptionLogStatus.revieweding+" AND pr.status < "+PrescriptionLog.PrescriptionLogStatus.wait_pay);
        StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND pr.status >= "+PrescriptionLog.PrescriptionLogStatus.revieweding.getValue()+" AND pr.status < "+PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
        List<Map<String,Object>> mp = jdbcTemplate.queryForList(sql.toString(),code);
        if(mp!=null&&mp.size()>0){
            return "0";
@ -1061,7 +1061,7 @@ public class PrescriptionInfoService extends BaseService {
    }
    public String presCheckStateObj(String code){
        StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND pr.status >= "+PrescriptionLog.PrescriptionLogStatus.revieweding+" AND pr.status < "+PrescriptionLog.PrescriptionLogStatus.wait_pay);
        StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND pr.status >= "+PrescriptionLog.PrescriptionLogStatus.revieweding.getValue()+" AND pr.status < "+PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
        List<Map<String,Object>> mp = jdbcTemplate.queryForList(sql.toString(),code);
        if(mp!=null&&mp.size()>0){
            return (String)((mp.get(0)).get("code"));
@ -1130,7 +1130,7 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getUsageDict(){
        StringBuffer sql = new StringBuffer("SELECT t.code,t.`name` FROM zy_common_dict t WHERE t.dict_name='IV_RECIPE_USAGE_DICT'");
        StringBuffer sql = new StringBuffer("SELECT t.code,t.`name` FROM zy_common_dict t WHERE t.dict_name='IV_RECIPE_USAGE_DICT' ");
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString());
        return new JSONArray(rs);
    }

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -172,7 +172,7 @@ public class PrescriptionService extends BaseService {
                    jsonObject.put("bcsfcs",1);//本次收费次数
                    jsonObject.put("yszjhm",zyCfinfoObj.getString("VISIT_IDENTITY_CARD_NO"));//医生证件号码
                    jsonObject.put("ysxm00",prescription.getDoctorName());//医生姓名
                    jsonObject.put("mzlb00",101);//门诊类别---普通门诊默认为101
                    jsonObject.put("mzlb00",zyCfinfoObj.getString("INSUR_DISP_REGISTER_TYPE"));//门诊类别---普通门诊默认为101
                    jsonObject.put("sfydgh","N");//是否药店挂号,默认为N,不是药店挂号
                    jsonObject.put("bcghcs",1);//本次挂号次数
                    jsonObject.put("ghksmc",prescription.getDeptName());//挂号科室名称
@ -221,7 +221,7 @@ public class PrescriptionService extends BaseService {
                        j2.put("sptxbm","");//商品条形编码
                        j2.put("yppl00",zySettleDetailObj.getString("FREQUENCY"));//药品频率
                        j2.put("ypyl00",zySettleDetailObj.getString("PHYSIC_DOSE"));//药品用量
                        j2.put("cfhao0",zySettleDetailObj.getString("VISIT_NO"));//处方号
                        j2.put("cfhao0",zySettleDetailObj.getString("RECIPE_NO"));//处方号
                        j2.put("jx0000",zySettleDetailObj.getString("PHYSIC_FORM"));//剂型
                        j2.put("dcyydw",zySettleDetailObj.getString("PHYSIC_DOSE_UNIT"));//单次用药单位
                        j2.put("qyzl00",zySettleDetailObj.getString("PHYSIC_AMOUNT"));//取药总量

+ 14 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.service.pc.prescription;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.*;
@ -11,11 +13,11 @@ import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.RoleService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.mapper.JsonMapper;
import java.beans.Transient;
import java.util.Date;
@ -79,8 +81,11 @@ public class PrescriptionExpressagePCService extends BaseService {
                        if(status==50){
                            jsonObject.put("status",-5);//订单正在配药中,暂时无法出药
                        }else if(status==60){
                            jsonObject.put("flag",1);
                            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
//                            jsonObject = new JSONObject(result);
//                            jsonObject = JSONObject.fromObject(result);
                            jsonObject.put("prescriptionInfoList",list);
                            jsonObject.put("flag",1);
                            jsonObject.put("prescriptionInfoList",list);
                            jsonObject.put("idcard",result.get("idcard"));
                            jsonObject.put("orderCode",result.get("orderCode"));
@ -90,9 +95,11 @@ public class PrescriptionExpressagePCService extends BaseService {
                            jsonObject.put("dispensaryType",result.get("dispensaryType"));
                            jsonObject.put("expressageName",result.get("expressageName"));
                            jsonObject.put("expressageMobile",result.get("expressageMobile"));
//                            return jsonObject;
                        }else{
                            jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
//                            jsonObject = new JSONObject(result);
                            jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                            jsonObject.put("prescriptionInfoList",list);
                            jsonObject.put("idcard",result.get("idcard"));
                            jsonObject.put("orderCode",result.get("orderCode"));
@ -103,6 +110,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                            jsonObject.put("expressageName",result.get("expressageName"));
                            jsonObject.put("expressageMobile",result.get("expressageMobile"));
                        }
                        break;
                    }
                    //健管师取药码
                    case 2:{
@ -113,6 +121,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                            if(status==50){
                                jsonObject.put("flag",-5);//订单正在配药中,暂时无法出药
                            }else if(status==60){
//                                jsonObject = new JSONObject(result);
                                jsonObject.put("flag",1);
                                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                                jsonObject.put("prescriptionInfoList",list);
@ -125,6 +134,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                                jsonObject.put("expressageName",result.get("expressageName"));
                                jsonObject.put("expressageMobile",result.get("expressageMobile"));
                            }else{
//                                jsonObject = new JSONObject(result);
                                jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                                jsonObject.put("prescriptionInfoList",list);
@ -140,6 +150,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                        }else{
                            jsonObject.put("flag",-4);//出药机构与您所在机构不一致,无法出药,请重新确认
                        }
                        break;
                    }
                    default:{
                        PrescriptionLog prescriptionLog = new PrescriptionLog();

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -111,7 +111,7 @@ public class OnePayService {
    /**
     * 查询绑卡信息(本人)
     */
    private BindCard ownerCard(String openid) throws Exception {
    public BindCard ownerCard(String openid) throws Exception {
        BindCard re = null;
        List<BindCard> cardList = bindCardList(openid);
        //更新患者信息

+ 15 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -2012,5 +2012,20 @@ public class DoctorController extends BaseController {
                return error(-1, e.getMessage());
            }
    }
    @ApiOperation("取消认证")
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/cancelAuthentication", method = RequestMethod.GET)
    public String cancelAuthentication(){
        try {
            doctorInfoService.cancelAuthentication(getRepUID());
            return write(200, "取消认证成功!");
        }catch (Exception e) {
            error(e);
            return error(-1, "取消认证失败!");
        }
    }
}

+ 208 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/express/DoctorSFExpressController.java

@ -0,0 +1,208 @@
package com.yihu.wlyy.web.doctor.express;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.dict.DmExpressagePriceEntity;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressageLog;
import com.yihu.wlyy.entity.patient.prescription.VO.PrescriptionExpressLogVO;
import com.yihu.wlyy.service.app.express.SFExpressService;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageLogService;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 医生端顺丰速运相关接口
 * Created by huangwenjie on 2017/8/16.
 */
@RestController
@RequestMapping(value = "/doctor/sfexpress")
@Api(description = "医生端顺丰速运相关接口")
public class DoctorSFExpressController extends BaseController {
    @Autowired
    private SFExpressService sfexpressService;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private PrescriptionExpressageLogService prescriptionExpressageLogService;
    @RequestMapping(value = "/sforderfilterservice", method = RequestMethod.GET)
    @ApiOperation("查询派送地址是否属于顺丰的派送范围")
    public String SFOrderFilterService(
            @ApiParam(name = "d_address", value = "派送地址", defaultValue = "福建省厦门市思明区软件园二期望海路55号")
            @RequestParam(value = "d_address", required = true) String d_address){
        try {
            boolean result = sfexpressService.getSFOrderFilterService(d_address);
            if(result){
                return write(200, "请求成功,地址可派送!");
            }else{
                return write(-1, "请求失败,地址不可派送!");
            }
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "请求失败,地址不可派送!");
        }
    }
    @RequestMapping(value="/sforderservice",method = RequestMethod.POST)
    @ApiOperation("向顺丰快递下订单")
    @ObserverRequired
    public String SFOrderService(
            @ApiParam(name="prescriptionCode", value="处方编号") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        try {
            PrescriptionExpressage sfexpress_obj = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            if(sfexpress_obj == null){
                return write(-1, "顺丰快递下单失败,未找到该处方的派送地址!");
            }else{
                //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回成功
                if(StringUtils.isNotBlank(sfexpress_obj.getMailno())){
                    return write(200, "顺丰快递下单成功!");
                }else{
                    //如果该处方的快递单号未生成,则继续下单
                    //由于下单前已经判断过是否派送,这里不再重复判断----huangwenjie-2017.08.04
                    //先判断地址是否可派送boolean delivery = sfexpressService.getSFOrderFilterService(sfexpress_obj.getProvinceName()+sfexpress_obj.getCityName()+sfexpress_obj.getTownName()+sfexpress_obj.getAddress());
                    //根据业务订单号判断是否已经下单成功
                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj);
                    //如果该业务订单号未下单成功过,则重新下单
                    if(go_on){
                        //请求顺丰接口下单,成功下单后,返回快递单号
                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                        //保存快递单号和增加处方物流记录为配送
                        prescriptionExpressageService.updatePrescriptionExpressage(sfexpress_obj);
                    }
                    return write(200, "顺丰快递下单成功!");
                }
            }
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value="/sfrouteservice",method = RequestMethod.POST)
    @ApiOperation("通过处方编码查询顺丰物流派送记录")
    @ObserverRequired
    public String SFRouteService(
            @ApiParam(name="prescriptionCode", value="处方编号") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        try {
            Prescription prescription = prescriptionService.findByCode(prescriptionCode);
            List<PrescriptionExpressageLog> sfexpresslogList = prescriptionExpressageLogService.findByPrescriptionCode(prescriptionCode);
            PrescriptionExpressage sfexpress_obj = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            //先判断该处方是否已完成配送,如果配送完成,则直接取本地的物流记录
            if(100 != prescription.getStatus()){
                //如果配送未完成,则调用顺丰接口获取物流路由日志,与本地匹配,进行增量修改
                sfexpresslogList = sfexpressService.getRoutInfos(prescription,sfexpress_obj,sfexpresslogList);
            }
            return write(200, "查询成功","data",sfexpresslogList);
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败,"+e.getMessage());
        }
    }
    @RequestMapping(value = "/getsfexpressprice", method = RequestMethod.GET)
    @ApiOperation("根据收寄地址获取快递费用")
    public String SFExpressPrice(
//            @ApiParam(name = "j_city", value = "寄方地址(城市),默认为厦门", defaultValue = "厦门")
//            @RequestParam(value = "j_city", required = false) String j_city,
            @ApiParam(name = "d_province", value = "收方地址(省份)")
            @RequestParam(value = "d_province", required = false) String d_province,
            @ApiParam(name = "d_city", value = "收方地址(城市)")
            @RequestParam(value = "d_city", required = false) String d_city){
        try {
            DmExpressagePriceEntity expreprice = sfexpressService.getSFExpressPrice(d_province,d_city);
            return write(200, "查询成功","data",expreprice);
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败,"+e.getMessage());
        }
    }
    @RequestMapping(value="/sfordersearchservice",method = RequestMethod.GET)
    @ApiOperation("通过处方编码查询顺丰快递是否下单成功")
    public String SFOrderSearchService(
            @ApiParam(name="prescriptionCode", value="处方编号") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        PrescriptionExpressage sfexpress_obj = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
        try {
            boolean go_on = sfexpressService.sfOrderSearchServiceJustSearch(sfexpress_obj);
            return write(200, "查询成功","data",go_on);
        }catch (Exception e) {
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败," + e.getMessage());
        }
    }
    @RequestMapping(value="/sfgetorderinfoservice",method = RequestMethod.GET)
    @ApiOperation("通过处方编码查询顺丰快递单信息(不包含物流记录)")
    public String SFGetOrderInfo(
            @ApiParam(name="prescriptionCode", value="处方编号") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        try {
            PrescriptionExpressage sfexpress_obj = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            Prescription prescription = prescriptionService.findByCode(prescriptionCode);
            PrescriptionExpressLogVO vo = new PrescriptionExpressLogVO();
            vo.setExpressMailNo(sfexpress_obj.getMailno());
            vo.setExpressName("顺丰速递");
            if(100 == prescription.getStatus()){
                vo.setExpressStatus("已收件");
            }else{
                if(StringUtils.isBlank(sfexpress_obj.getMailno())){
                    vo.setExpressStatus("待发货");
                }else{
                    vo.setExpressStatus("运输中");
                }
            }
            vo.setExpressPhone("95338");
            return write(200, "查询成功","data",vo);
        }catch (Exception e) {
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败," + e.getMessage());
        }
    }
}

+ 5 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java

@ -1,11 +1,11 @@
package com.yihu.wlyy.web.doctor.prescriptionPC;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.pc.prescription.PrescriptionExpressagePCService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -27,8 +27,9 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String getMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try{
            JSONObject jsonObject = prescriptionExpressagePCService.getMedicine(code,"hxmD201703150111");
            return write(200, "获取信息成功!", "data", jsonObject);
            JSONObject jSONObject = prescriptionExpressagePCService.getMedicine(code,getRepUID());
//            jSONObject.toString().replace("\\","");
            return write(200, "获取信息成功!", "data", jSONObject);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
@ -40,7 +41,7 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String fetchingMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try {
            prescriptionExpressagePCService.fetchingMedicine(code, "hxmD201703150111");
            prescriptionExpressagePCService.fetchingMedicine(code, getRepUID());
            return write(200, "更改成功!");
        }catch (Exception e) {
            error(e);

+ 2 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/express/SFExpressApiController.java

@ -9,11 +9,7 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.net.URLDecoder;
@ -21,7 +17,7 @@ import java.net.URLDecoder;
 * 提供给顺丰快递调用的相关接口
 * @author huangwenjie 2017.08.03
 */
@Controller
@RestController
@RequestMapping(value = "/express/sf")
@Api(description = "顺丰速运相关接口")
public class SFExpressApiController extends BaseController {
@ -33,7 +29,6 @@ public class SFExpressApiController extends BaseController {
    private String successxml = "<Response service='RoutePushService'><Head>OK</Head></Response>";
    @RequestMapping(value="/routepushservice",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("接受顺丰推送过来的路由信息")
    @ObserverRequired
    public String SFRoutePushService (

+ 4 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/express/SFExpressController.java

@ -17,22 +17,18 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 顺丰速运相关接口
 * 患者端顺丰速运相关接口
 * Created by huangwenjie on 2017/8/1.
 */
@Controller
@RestController
@RequestMapping(value = "/patient/sfexpress")
@Api(description = "顺丰速运相关接口")
@Api(description = "患者端顺丰速运相关接口")
public class SFExpressController extends BaseController {
    @Autowired
@ -48,7 +44,6 @@ public class SFExpressController extends BaseController {
    private PrescriptionExpressageLogService prescriptionExpressageLogService;
    @RequestMapping(value = "/sforderfilterservice", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("查询派送地址是否属于顺丰的派送范围")
    public String SFOrderFilterService(
            @ApiParam(name = "d_address", value = "派送地址", defaultValue = "福建省厦门市思明区软件园二期望海路55号")
@ -72,7 +67,6 @@ public class SFExpressController extends BaseController {
    }
    @RequestMapping(value="/sforderservice",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("向顺丰快递下订单")
    @ObserverRequired
    public String SFOrderService(
@ -115,7 +109,6 @@ public class SFExpressController extends BaseController {
    }
    @RequestMapping(value="/sfrouteservice",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("通过处方编码查询顺丰物流派送记录")
    @ObserverRequired
    public String SFRouteService(
@ -143,7 +136,6 @@ public class SFExpressController extends BaseController {
    }
    @RequestMapping(value = "/getsfexpressprice", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("根据收寄地址获取快递费用")
    public String SFExpressPrice(
//            @ApiParam(name = "j_city", value = "寄方地址(城市),默认为厦门", defaultValue = "厦门")
@ -167,7 +159,6 @@ public class SFExpressController extends BaseController {
    }
    @RequestMapping(value="/sfordersearchservice",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("通过处方编码查询顺丰快递是否下单成功")
    public String SFOrderSearchService(
            @ApiParam(name="prescriptionCode", value="处方编号") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
@ -184,7 +175,6 @@ public class SFExpressController extends BaseController {
    }
    @RequestMapping(value="/sfgetorderinfoservice",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("通过处方编码查询顺丰快递单信息(不包含物流记录)")
    public String SFGetOrderInfo(
            @ApiParam(name="prescriptionCode", value="处方编号") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){