Selaa lähdekoodia

Merge remote-tracking branch 'origin/dev' into dev

wangxingwang 7 vuotta sitten
vanhempi
commit
ba694d4ba3
27 muutettua tiedostoa jossa 655 lisäystä ja 420 poistoa
  1. 13 9
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  2. 6 9
      common/common-entity/src/main/java/com/yihu/wlyy/entity/zydict/ZyIvDeptDict.java
  3. 6 7
      common/common-entity/src/main/java/com/yihu/wlyy/entity/zydict/ZyIvPhysicDict.java
  4. 52 11
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  5. 57 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/PatientExam.java
  6. 19 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/PatientExamDao.java
  7. 84 5
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/PatientDao.java
  8. 36 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientExamService.java
  9. 3 1
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientService.java
  10. 0 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  11. 9 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  12. 72 59
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ZyDictJob.java
  13. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application.yml
  14. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  15. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/DmExpressagePriceDao.java
  16. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java
  17. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java
  18. 10 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  19. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  20. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  21. 0 288
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PCPrescriptionExpressageService.java
  22. 237 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java
  23. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  24. 4 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  25. 25 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java
  26. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  27. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

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

@ -614,15 +614,17 @@ public class Prescription extends IdEntity {
    @Transient
    public String getDispensaryTypeName() {
        switch (dispensaryType) {
            case 1: {
                return "自取";
            }
            case 2: {
                return "快递配送";
            }
            case 3: {
                return "健管师配送";
        if(dispensaryType!=null){
            switch (this.dispensaryType) {
                case 1: {
                    return "自取";
                }
                case 2: {
                    return "快递配送";
                }
                case 3: {
                    return "健管师配送";
                }
            }
        }
        return "";
@ -647,4 +649,6 @@ public class Prescription extends IdEntity {
    public void setDispensaryTypeName(String dispensaryTypeName) {
        this.dispensaryTypeName = dispensaryTypeName;
    }
}

+ 6 - 9
common/common-entity/src/main/java/com/yihu/wlyy/entity/zydict/ZyIvDeptDict.java

@ -22,7 +22,7 @@ public class ZyIvDeptDict extends IdEntity implements java.io.Serializable {
	private String orgCode;//机构编码
	private String deptCode;//科室代码
	private String deptName;//科室名称
	private String deptType;//科室类型  详见科室类型字典中定义
	private String deptClass;//科室类型  详见科室类型字典中定义
	private String upperDept;//上级科室
	// Constructors
@ -37,7 +37,6 @@ public class ZyIvDeptDict extends IdEntity implements java.io.Serializable {
		this.orgCode = orgCode;
		this.deptCode = deptCode;
		this.deptName = deptName;
		this.deptType = deptType;
		this.upperDept = upperDept;
	}
@ -68,14 +67,12 @@ public class ZyIvDeptDict extends IdEntity implements java.io.Serializable {
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Column(name = "dept_type", length = 50)
	public String getDeptType() {
		return this.deptType;
	@Column(name = "dept_class", length = 50)
	public String getDeptClass() {
		return deptClass;
	}
	public void setDeptType(String deptType) {
		this.deptType = deptType;
	public void setDeptClass(String deptClass) {
		this.deptClass = deptClass;
	}
	@Column(name = "upper_dept", length = 50)

+ 6 - 7
common/common-entity/src/main/java/com/yihu/wlyy/entity/zydict/ZyIvPhysicDict.java

@ -29,7 +29,7 @@ public class ZyIvPhysicDict extends IdEntity implements java.io.Serializable {
	private Double minDose;//最小剂量
	private Double packSpec;
	private Double retailPrice;//零售价
	private String physicFrom;//药品剂型  药品剂型字典中定义
	private String physicForm;//药品剂型  药品剂型字典中定义
	private String toxicologyType;//毒理分类  药品毒理分类字典中定义
	private String basicFlag;//基本药物标志  0:否;1:是
	private String validFlag;//有效标志 0:无效;1:有效
@ -60,7 +60,6 @@ public class ZyIvPhysicDict extends IdEntity implements java.io.Serializable {
		this.minDose = minDose;
		this.packSpec = packSpec;
		this.retailPrice = retailPrice;
		this.physicFrom = physicFrom;
		this.toxicologyType = toxicologyType;
		this.basicFlag = basicFlag;
		this.validFlag = validFlag;
@ -160,13 +159,13 @@ public class ZyIvPhysicDict extends IdEntity implements java.io.Serializable {
		this.retailPrice = retailPrice;
	}
	@Column(name = "physic_from", length = 50)
	public String getPhysicFrom() {
		return this.physicFrom;
	@Column(name = "physic_form", length = 50)
	public String getPhysicForm() {
		return physicForm;
	}
	public void setPhysicFrom(String physicFrom) {
		this.physicFrom = physicFrom;
	public void setPhysicForm(String physicForm) {
		this.physicForm = physicForm;
	}
	@Column(name = "toxicology_type", length = 250)

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

@ -1,7 +1,8 @@
package com.yihu.mm.controller.medicine;
import com.yihu.mm.controller.BaseController;
import com.yihu.mm.entity.Patient;
import com.yihu.mm.entity.PatientExam;
import com.yihu.mm.service.PatientExamService;
import com.yihu.mm.service.PatientService;
import com.yihu.mm.service.PhysicalExaminationService;
import com.yihu.mm.util.HttpClientUtil;
@ -35,6 +36,9 @@ public class PhysicalExaminationController extends BaseController {
    @Autowired
    private PhysicalExaminationService physicalExaminationService;
    @Autowired
    private PatientExamService patientExamService;
    @ApiOperation(value = "获取试卷列表")
    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
@ -45,7 +49,16 @@ public class PhysicalExaminationController extends BaseController {
        HttpSession session = req.getSession();
        String key = (String) session.getAttribute("key");
        if(StringUtils.isBlank(key)){
            key = HttpClientUtil.postBody(yuerenApi + "/phonekey", new JSONObject());
            //通过接口查询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);
        }
@ -57,20 +70,44 @@ public class PhysicalExaminationController extends BaseController {
    @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);
        //Patient patient = patientService.findByCode(patientCode);
        //return physicalExaminationService.insertslip(key,patient);
        return null;
    }
    @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 = false, name = "tp_id") String tp_id,
                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = false, name = "pb_id") String pb_id,
                               @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "ct_id") String ct_id,
    public String findQuestion(@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 = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
                               HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        return physicalExaminationService.findQuestion(key,tp_id,pb_id,ct_id);
        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;
    }
    @ApiOperation(value = "提交试卷答案")
@ -79,11 +116,15 @@ public class PhysicalExaminationController extends BaseController {
    public String handleExam(@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,
                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
                             @ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
                            HttpServletRequest req){
        String key = (String) req.getSession().getAttribute("key");
        return physicalExaminationService.handleExam(key,tp_id,pb_id,dc_answer,ct_id);
        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);
        return result;
    }
    @ApiOperation(value = "四诊资料采集")

+ 57 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/PatientExam.java

@ -0,0 +1,57 @@
package com.yihu.mm.entity;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "patient_exam")
public class PatientExam extends IdEntity implements Serializable {
    @Column(name="patient")
    private String patient;
    @Column(name="tp_id")
    private String tpId;
    @Column(name="ct_id")
    private String ctId;
    @Column(name="is_complete")
    private Integer isComplete;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getTpId() {
        return tpId;
    }
    public void setTpId(String tpId) {
        this.tpId = tpId;
    }
    public String getCtId() {
        return ctId;
    }
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
    public Integer getIsComplete() {
        return isComplete;
    }
    public void setIsComplete(Integer isComplete) {
        this.isComplete = isComplete;
    }
}

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

@ -0,0 +1,19 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.repository;
import com.yihu.mm.entity.PatientExam;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface PatientExamDao extends PagingAndSortingRepository<PatientExam, Long>,JpaSpecificationExecutor<PatientExam> {
	// 查询患者code和试卷编号查询
	@Query("select p from PatientExam p where p.code=?1 and p.tpId=?2")
	PatientExam findByPatientAndTpId(String code, String tpId);
}

+ 84 - 5
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/wlyy/patient/PatientDao.java

@ -1,10 +1,89 @@
package com.yihu.mm.repository.wlyy.patient;
import com.yihu.wlyy.entity.patient.Patient;
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
import com.yihu.mm.entity.Patient;
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;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
import java.util.List;
public interface PatientDao extends PagingAndSortingRepository<Patient, Long>,JpaSpecificationExecutor<Patient> {
    // 查询患者姓名
    @Query("select p.name from Patient p where p.code=?1")
    String findNameByCode(String code);
    // 根据姓名查询
    @Query("select p.code from Patient p where p.name=?1")
    String[] findByName(String name);
    // 根據患者標識查詢患者信息
    @Query("select p from Patient p where p.code=?1")
    Patient findByCode(String code);
    // 根據患者標識查詢患者信息
    @Query("select p from Patient p where p.code=?1 and p.idcard =?2")
    Patient findByCodeAndIdcard(String code, String idcard);
    // 根據身份證號查詢患者信息
    @Query("select p from Patient p where p.idcard=?1")
    Patient findByIdcard(String idcard);
    @Query("select p from Patient p where p.ssc=?1")
    Patient findBySsc(String ssc);
    // 根據手机号查詢患者信息
    @Query("select p from Patient p where p.mobile=?1")
    Patient findByMobile(String mobile);
    // 根據病情等级获取患者信息
    @Query("select p from Patient p where p.diseaseCondition=?1")
    Iterable<Patient> findInfoByLevel(int level);
    @Query("select p from Patient p where p.openid=?1")
    Patient findByOpenid(String openid);
    @Query("select count(1) from Patient p where p.openid=?1")
    int countByOpenid(String openid);
    //清空openid
    @Modifying
    @Query("update Patient p set p.openid = null where p.code <> ?1 and p.openid = ?2")
    int clearOpenid(String patient, String openid);
    @Modifying
    @Query(value = "update Patient p set p.status=?1 where p.id=?2 ")
    int updateStatus(Integer status, Long id);
    @Modifying
    @Query(value = "update Patient p set p.password=?1,p.salt=?2 where p.id=?3 ")
    int initPassword(String password, String salt, Long id);
    @Query(value = "select count(1) from Patient p where p.mobile = ?1")
    int isMobileExist(String mobile);
    @Query(value = "select count(1) from Patient p where p.idcard = ?1")
    int isIdCardExist(String idcard);
    @Query(value = "select count(1) from Patient p where p.ssc = ?1")
    int isSscExist(String ssc);
    @Query("select p from Patient p where p.city = ?1 and p.mobile is not null and p.mobile!='' ")
    List<Patient> findByCity(String city);
    @Query("select p from Patient p where p.city = ?1 and p.mobile is not null and p.mobile!=''  and p.town in ?2 ")
    List<Patient> findByCityAndTowns(String city, String towns[]);
    @Query(value = "SELECT DISTINCT p.* from wlyy_patient p LEFT JOIN wlyy_sign_family f on p.code = f.patient WHERE p.city = ?1 and p.mobile is not null and p.mobile!=''  and f.hospital in ?2 ",nativeQuery = true)
    List<Patient> findByCityAndHospital(String city, String hospital[]);
    @Query("select p from Patient p where p.idcard=?1 and p.ssc=?2")
    Patient findByIdcardAndSsc(String idcard, String ssc);
}

+ 36 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientExamService.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.PatientExam;
import com.yihu.mm.repository.PatientExamDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
/**
 * 患者基本信息类.
 *
 * @author George
 */
@Service
public class PatientExamService{
    @Autowired
    private PatientExamDao patientExamDao;
    public PatientExam findByPatientAndTpId(String patientCode,String tpId){
        return patientExamDao.findByPatientAndTpId(patientCode,tpId);
    }
    @Transient
    public void save(PatientExam patientExam){
         patientExamDao.save(patientExam);
    }
}

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

@ -6,8 +6,9 @@
package com.yihu.mm.service;
import com.yihu.mm.dao.PatientDao;
import com.yihu.mm.entity.Patient;
import com.yihu.mm.repository.wlyy.patient.PatientDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -18,6 +19,7 @@ import org.springframework.stereotype.Service;
@Service
public class PatientService {
    @Autowired
    private PatientDao patientDao;
    public Patient findByCode(String code) {

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

@ -17,13 +17,11 @@ public class PhysicalExaminationService {
    public String findExames(String key,String type, String examCode) {
        //先获取key值
        JSONObject params = new JSONObject();
        params.put("key",key);
        params.put("tp_type", type);
        params.put("sh_id", examCode);
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
    }
    public String insertslip(String key,Patient patient) {

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

@ -1,10 +1,12 @@
package com.yihu.wlyy.service.manager.family;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.SignFamily;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.PatientFamilyMemberDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.manager.hos.HosDoctorService;
import com.yihu.wlyy.service.manager.sign.FamilyContractService;
import com.yihu.wlyy.util.CommonUtil;
import org.apache.commons.lang3.StringUtils;
@ -37,6 +39,8 @@ public class FamilyMemberService extends BaseService {
    @Autowired
    FamilyContractService contractService;
    private HosDoctorService hosDoctorService;
    Map<Integer, String> relations = new HashMap<>();
@ -59,7 +63,7 @@ public class FamilyMemberService extends BaseService {
     * @param patient
     * @return
     */
    public List<Map<String,Object>> getAllFamilyMembers(String patient){
    public List<Map<String,Object>> getAllFamilyMembers(String patient) throws Exception {
        List<Map<String,Object>> list = new ArrayList<>();
        list.add(getPatient(patient));
@ -89,8 +93,11 @@ public class FamilyMemberService extends BaseService {
                        jtSign = true;
                    }
                    map1.put("statusName","已签约");
                    map1.put("doctor",sign.getDoctor());
                    String doctorCode = sign.getDoctor();
                    map1.put("doctor",doctorCode);
                    map1.put("doctorName",sign.getDoctorName());
                    Doctor doctor = hosDoctorService.getDoctorByCode(doctorCode);
                    map1.put("doctorMobile",doctor.getMobile());
                }
                Integer family_relation = Integer.valueOf(map.get("family_relation").toString());
                map1.put("code", map.get("code"));

+ 72 - 59
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ZyDictJob.java

@ -68,7 +68,7 @@ public class ZyDictJob implements Job {
            //同步 zy_iv_physic_dict
            synchronizeZy_iv_physic_dict();
            //同步 zy_iv_staff_dict
            synchronizeZ_iv_staff_dict();
            synchronizeZ_iv_staff_dict();  //birthday    Date(529084800000+0800) 无法解析
            //同步 zy_iv_staff_reg_type_allot_dict
            synchronizeZy_iv_staff_reg_type_allot_dict();
            //同步 zy_iv_subject_class_dict
@ -83,8 +83,8 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_DIAGNOSE_DICT;
        List<ZyIvDiagnoseDict> zyIvDiagnoseDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvDiagnoseDicts, ZyIvDiagnoseDict.class, dictName);
        if (zyIvDiagnoseDicts.size() > 0) {
        zyIvDiagnoseDicts = commonGetOneDict(ZyIvDiagnoseDict.class, dictName);
        if (zyIvDiagnoseDicts != null && zyIvDiagnoseDicts.size() > 0) {
            //清空表
            zyIvDiagnoseDictDao.deleteAll();
            //新增数据
@ -101,7 +101,7 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_SUBJECT_CLASS_DICT;
        List<ZyIvSubjectClassDict> zyIvSubjectClassDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvSubjectClassDicts, ZyIvSubjectClassDict.class, dictName);
        zyIvSubjectClassDicts = commonGetOneDict(ZyIvSubjectClassDict.class, dictName);
        if (zyIvSubjectClassDicts.size() > 0) {
            //清空表
            zyIvSubjectClassDictDao.deleteAll();
@ -118,13 +118,15 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_STAFF_REG_TYPE_ALLOT_DICT;
        List<ZyIvStaffRegTypeAllotDict> zyIvStaffRegTypeAllotDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvStaffRegTypeAllotDicts, ZyIvStaffRegTypeAllotDict.class, dictName);
        //清空表
        zyIvStaffRegTypeAllotDictDao.deleteAll();
        //新增数据
        logger.info("save table zy_iv_staff_reg_type_allot_dict  ,size:" + zyIvStaffRegTypeAllotDicts.size());
        zyIvStaffRegTypeAllotDictDao.save(zyIvStaffRegTypeAllotDicts);
        logger.info("synchronized zy_iv_staff_reg_type_allot_dict end");
        zyIvStaffRegTypeAllotDicts = commonGetOneDict(ZyIvStaffRegTypeAllotDict.class, dictName);
        if (zyIvStaffRegTypeAllotDicts != null && zyIvStaffRegTypeAllotDicts.size() > 0) {
            //清空表
            zyIvStaffRegTypeAllotDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_staff_reg_type_allot_dict  ,size:" + zyIvStaffRegTypeAllotDicts.size());
            zyIvStaffRegTypeAllotDictDao.save(zyIvStaffRegTypeAllotDicts);
            logger.info("synchronized zy_iv_staff_reg_type_allot_dict end");
        }
    }
    @Transactional
@ -133,13 +135,15 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_STAFF_DICT;
        List<ZyIvStaffDict> zyIvStaffDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvStaffDicts, ZyIvDeptDict.class, dictName);
        zyIvStaffDicts = commonGetOneDict(ZyIvStaffDict.class, dictName);
        //清空表
        zyIvStaffDictDao.deleteAll();
        //新增数据
        logger.info("save table zy_iv_staff_dict  ,size:" + zyIvStaffDicts.size());
        zyIvStaffDictDao.save(zyIvStaffDicts);
        logger.info("synchronized zy_iv_staff_dict end");
        if (zyIvStaffDicts != null && zyIvStaffDicts.size() > 0) {
            zyIvStaffDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_staff_dict  ,size:" + zyIvStaffDicts.size());
            zyIvStaffDictDao.save(zyIvStaffDicts);
            logger.info("synchronized zy_iv_staff_dict end");
        }
    }
    @Transactional
@ -148,13 +152,15 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_PHYSIC_DICT;
        List<ZyIvPhysicDict> zyIvPhysicDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvPhysicDicts, ZyIvPhysicDict.class, dictName);
        //清空表
        zyIvPhysicDictDao.deleteAll();
        //新增数据
        logger.info("save table zy_iv_physic_dict  ,size:" + zyIvPhysicDicts.size());
        zyIvPhysicDictDao.save(zyIvPhysicDicts);
        logger.info("synchronized zy_iv_physic_dict end");
        zyIvPhysicDicts = commonGetOneDict(ZyIvPhysicDict.class, dictName);
        if (zyIvPhysicDicts != null && zyIvPhysicDicts.size() > 0) {
            //清空表
            zyIvPhysicDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_physic_dict  ,size:" + zyIvPhysicDicts.size());
            zyIvPhysicDictDao.save(zyIvPhysicDicts);
            logger.info("synchronized zy_iv_physic_dict end");
        }
    }
    @Transactional
@ -163,8 +169,8 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_ORG_PHYSIC_ALLOT_DICT;
        List<ZyIvOrgPhysicAllotDict> zyIvOrgPhysicAllotDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvOrgPhysicAllotDicts, ZyIvOrgPhysicAllotDict.class, dictName);
        if (zyIvOrgPhysicAllotDicts.size() > 0) {
        zyIvOrgPhysicAllotDicts = commonGetOneDict(ZyIvOrgPhysicAllotDict.class, dictName);
        if (zyIvOrgPhysicAllotDicts != null && zyIvOrgPhysicAllotDicts.size() > 0) {
            //清空表
            zyIvOrgPhysicAllotDictDao.deleteAll();
            //新增数据
@ -180,8 +186,8 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_DIAGNOSE_CLASS_DICT;
        List<ZyIvDiagnoseClassDict> zIvDiagnoseClassDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zIvDiagnoseClassDicts, ZyIvDiagnoseClassDict.class, dictName);
        if (zIvDiagnoseClassDicts.size() > 0) {
        zIvDiagnoseClassDicts = commonGetOneDict(ZyIvDiagnoseClassDict.class, dictName);
        if (zIvDiagnoseClassDicts != null && zIvDiagnoseClassDicts.size() > 0) {
            //清空表
            zyIvDiagnoseClassDictDao.deleteAll();
            //新增数据
@ -198,9 +204,9 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_DEPT_STAFF_ALLOT_DICT;
        List<ZyIvDeptStaffAllotDict> syIvDeptStaffAllotDictz = new ArrayList<>();
        //得到list
        commonGetOneDict(syIvDeptStaffAllotDictz, ZyIvDeptStaffAllotDict.class, dictName);
        syIvDeptStaffAllotDictz = commonGetOneDict(ZyIvDeptStaffAllotDict.class, dictName);
        if (syIvDeptStaffAllotDictz.size() > 0) {
        if (syIvDeptStaffAllotDictz != null && syIvDeptStaffAllotDictz.size() > 0) {
            //清空表
            zyIvDeptStaffAllotDictDao.deleteAll();
            //新增数据
@ -232,14 +238,14 @@ public class ZyDictJob implements Job {
                if (returnJson.containsKey("data")) {
                    String dataString = returnJson.getString("data");
                    JSONArray dataJSONArray = JSONObject.fromObject(dataString).getJSONArray("returnData");
                    logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                    if (dataJSONArray.size() == 0) {
                        logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                        continue;
                    }
                    //下划线转驼峰
                    JSONArray newJA = new JSONArray();
                    JSONArray jsonArrayTemp = dataJSONArray.getJSONArray(0);
                    logger.info("zy dict data size " + jsonArrayTemp.size() + ",dictname:" + dictName);
                    for (int i = 0; i < jsonArrayTemp.size(); i++) {
                        JSONObject jo = jsonArrayTemp.getJSONObject(i);
                        JSONObject newJO = new JSONObject();
@ -285,8 +291,8 @@ public class ZyDictJob implements Job {
        String dictName = this.IV_DEPT_DICT;
        List<ZyIvDeptDict> zyIvDeptDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvDeptDicts, ZyIvDeptDict.class, dictName);
        if (zyIvDeptDicts.size() > 0) {
        zyIvDeptDicts = commonGetOneDict(ZyIvDeptDict.class, dictName);
        if (zyIvDeptDicts != null && zyIvDeptDicts.size() > 0) {
            //清空表
            zyIvDeptDictDao.deleteAll();
            //新增数据
@ -299,11 +305,10 @@ public class ZyDictJob implements Job {
    /**
     * 得到单个字典
     *
     * @param tList
     * @param clazz    class
     * @param dictName 字典名称
     */
    private void commonGetOneDict(List tList, Class clazz, String dictName) {
    private List commonGetOneDict(Class clazz, String dictName) {
        String json = null;
        try {
            //调用智业的接口得到字典
@ -313,15 +318,22 @@ public class ZyDictJob implements Job {
                throw new Exception("zy dict error status not 200");
            }
            if (returnJson.containsKey("data")) {
                JSONArray dataJSONArray = JSONObject.fromObject(returnJson.getString("data")).getJSONArray("returnData");
                String dataJSONStr = returnJson.getString("data");
                JSONObject joTemp = JSONObject.fromObject(dataJSONStr);
                JSONArray dataJSONArray = joTemp.getJSONArray("returnData");
                if (dataJSONArray.size() == 0) {
                    logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                    return null;
                } else {
                    dataJSONArray = dataJSONArray.getJSONArray(0);
                }
                logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                //下划线转驼峰
                JSONArray newJA = new JSONArray();
                for (int i = 0; i < dataJSONArray.getJSONArray(0).size(); i++) {
                    JSONObject jo = dataJSONArray.getJSONArray(0).getJSONObject(i);
                for (int i = 0; i < dataJSONArray.size(); i++) {
                    JSONObject jo = dataJSONArray.getJSONObject(i);
                    JSONObject newJO = new JSONObject();
                    jo.keySet().stream().forEach(key -> {
                        Object value = jo.get(key);
@ -330,7 +342,7 @@ public class ZyDictJob implements Job {
                    });
                    newJA.add(newJO);
                }
                tList.addAll(Arrays.asList(JSONArray.toArray(newJA, clazz)));
                return (List) JSONArray.toCollection(newJA, clazz);
            } else {
                throw new Exception("zy dict error no contain data");
            }
@ -339,30 +351,31 @@ public class ZyDictJob implements Job {
            logger.error("returnJson:" + json);
            logger.error(e.getMessage());
        }
        return null;
    }
    /**
     * 智业的字典
     */
    public static final String IV_MEASURE_UNIT_DICT = "IV_MEASURE_UNIT_DICT";//("计量单位字典", "IV_MEASURE_UNIT_DICT"),
    public static final String IV_PHYSIC_FORM_DICT = " IV_PHYSIC_FORM_DICT";//("药品剂型字典", "IV_PHYSIC_FORM_DICT"),
    public static final String IV_PHYSIC_INJECT_PLACE_DICT = " IV_PHYSIC_INJECT_PLACE_DICT(";//"计量单位字典", "IV_PHYSIC_INJECT_PLACE_DICT"),
    public static final String IV_PHYSIC_SKIN_TEST_DICT = " IV_PHYSIC_SKIN_TEST_DICT";//("皮试类型字典", "IV_PHYSIC_SKIN_TEST_DICT"),
    public static final String IV_RATE_TYPE_DICT = " IV_RATE_TYPE_DICT";//("费别字典", "IV_RATE_TYPE_DICT"),
    public static final String IV_RECIPE_FREQUENCY_DICT = " IV_RECIPE_FREQUENCY_DICT";//("频次字典", "IV_RECIPE_FREQUENCY_DICT"),
    public static final String IV_RECIPE_USAGE_DICT = " IV_RECIPE_USAGE_DICT";//("用药方法字典", "IV_RECIPE_USAGE_DICT"),
    public static final String IV_SEX_DICT = " IV_SEX_DICT";//("性别字典", "IV_SEX_DICT"),
    public static final String IV_PHYSIC_DICT = " IV_PHYSIC_DICT";//("药品字典", "IV_PHYSIC_DICT"),
    public static final String IV_ORG_PHYSIC_ALLOT_DICT = " IV_ORG_PHYSIC_ALLOT_DICT";//("机构药品分发字典", "IV_ORG_PHYSIC_ALLOT_DICT "),
    public static final String IV_SUBJECT_CLASS_DICT = " IV_SUBJECT_CLASS_DICT";//("科目类别字典", "IV_SUBJECT_CLASS_DICT"),
    public static final String IV_PHYSIC_TOXICOLOGY_TYPE_DICT = " IV_PHYSIC_TOXICOLOGY_TYPE_DICT";//("药品毒理分类字典", "IV_PHYSIC_TOXICOLOGY_TYPE_DICT"),
    public static final String IV_DEPT_DICT = " IV_DEPT_DICT";//("科室字典", "IV_DEPT_DICT"),
    public static final String IV_DEPT_TYPE_DICT = " IV_DEPT_TYPE_DICT";//("科室类型字典", "IV_DEPT_TYPE_DICT"),
    public static final String IV_DIAGNOSE_DICT = " IV_DIAGNOSE_DICT";//("诊断字典", "IV_DIAGNOSE_DICT"),
    public static final String IV_DIAGNOSE_CLASS_DICT = " IV_DIAGNOSE_CLASS_DICT";//("诊断类别字典", "IV_DIAGNOSE_CLASS_DICT"),
    public static final String IV_STAFF_DICT = " IV_STAFF_DICT";//("员工字典", "IV_STAFF_DICT"),
    public static final String IV_STAFF_REG_TYPE_ALLOT_DICT = " IV_STAFF_REG_TYPE_ALLOT_DICT";//("员工挂号类型配置字典", "IV_STAFF_REG_TYPE_ALLOT_DICT"),
    public static final String IV_DEPT_STAFF_ALLOT_DICT = " IV_DEPT_STAFF_ALLOT_DICT";//("科室员工配置字典", "IV_DEPT_STAFF_ALLOT_DICT");
    public static final String IV_PHYSIC_FORM_DICT = "IV_PHYSIC_FORM_DICT";//("药品剂型字典", "IV_PHYSIC_FORM_DICT"),
    public static final String IV_PHYSIC_INJECT_PLACE_DICT = "IV_PHYSIC_INJECT_PLACE_DICT";//"计量单位字典", "IV_PHYSIC_INJECT_PLACE_DICT"),
    public static final String IV_PHYSIC_SKIN_TEST_DICT = "IV_PHYSIC_SKIN_TEST_DICT";//("皮试类型字典", "IV_PHYSIC_SKIN_TEST_DICT"),
    public static final String IV_RATE_TYPE_DICT = "IV_RATE_TYPE_DICT";//("费别字典", "IV_RATE_TYPE_DICT"),
    public static final String IV_RECIPE_FREQUENCY_DICT = "IV_RECIPE_FREQUENCY_DICT";//("频次字典", "IV_RECIPE_FREQUENCY_DICT"),
    public static final String IV_RECIPE_USAGE_DICT = "IV_RECIPE_USAGE_DICT";//("用药方法字典", "IV_RECIPE_USAGE_DICT"),
    public static final String IV_SEX_DICT = "IV_SEX_DICT";//("性别字典", "IV_SEX_DICT"),
    public static final String IV_PHYSIC_DICT = "IV_PHYSIC_DICT";//("药品字典", "IV_PHYSIC_DICT"),
    public static final String IV_ORG_PHYSIC_ALLOT_DICT = "IV_ORG_PHYSIC_ALLOT_DICT";//("机构药品分发字典", "IV_ORG_PHYSIC_ALLOT_DICT "),
    public static final String IV_SUBJECT_CLASS_DICT = "IV_SUBJECT_CLASS_DICT";//("科目类别字典", "IV_SUBJECT_CLASS_DICT"),
    public static final String IV_PHYSIC_TOXICOLOGY_TYPE_DICT = "IV_PHYSIC_TOXICOLOGY_TYPE_DICT";//("药品毒理分类字典", "IV_PHYSIC_TOXICOLOGY_TYPE_DICT"),
    public static final String IV_DEPT_DICT = "IV_DEPT_DICT";//("科室字典", "IV_DEPT_DICT"),
    public static final String IV_DEPT_TYPE_DICT = "IV_DEPT_TYPE_DICT";//("科室类型字典", "IV_DEPT_TYPE_DICT"),
    public static final String IV_DIAGNOSE_DICT = "IV_DIAGNOSE_DICT";//("诊断字典", "IV_DIAGNOSE_DICT"),
    public static final String IV_DIAGNOSE_CLASS_DICT = "IV_DIAGNOSE_CLASS_DICT";//("诊断类别字典", "IV_DIAGNOSE_CLASS_DICT"),
    public static final String IV_STAFF_DICT = "IV_STAFF_DICT";//("员工字典", "IV_STAFF_DICT"),
    public static final String IV_STAFF_REG_TYPE_ALLOT_DICT = "IV_STAFF_REG_TYPE_ALLOT_DICT";//("员工挂号类型配置字典", "IV_STAFF_REG_TYPE_ALLOT_DICT"),
    public static final String IV_DEPT_STAFF_ALLOT_DICT = "IV_DEPT_STAFF_ALLOT_DICT";//("科室员工配置字典", "IV_DEPT_STAFF_ALLOT_DICT");
    /**
     * 字典表的枚举类

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/resources/application.yml

@ -59,7 +59,7 @@ redis:
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: true
  show_sql: false
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -29,7 +29,8 @@ public class SwaggerConfig {
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(PathSelectors.regex("/doctor/.*"))
                .paths(or(regex("/doctor/.*"),
                        regex("/PC/.*")))
                .build()
                .apiInfo(publicApiInfo());
    }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/DmExpressagePriceDao.java

@ -13,7 +13,9 @@ public interface DmExpressagePriceDao extends
        PagingAndSortingRepository<DmExpressagePriceEntity, Long>,
        JpaSpecificationExecutor<DmExpressagePriceEntity> {
//    @Query(value = "select * from dm_expressage_price where code=? and end_address_name like ?",nativeQuery = true)
    @Query("from DmExpressagePriceEntity where code = ?1 and endAddressName LIKE ?2 ")
    DmExpressagePriceEntity getExprePriceEntityByCodeAndEndAdressName(String code,String end_address_name);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java

@ -159,6 +159,6 @@ public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, Jpa
    @Query("update Doctor set checkPassword = ?2 ,checkSalt = ?3  where code = ?1")
    int updateCheckPassword(String code, String checkPassword, String checkSalt);
    @Query("select count(1) from Doctor where code=?1 and certificateNum=?2 ")
    @Query("select count(1) from Doctor where code=?1 and idcard=?2 ")
    Integer checkCertificate(String doctorCode,String certificateNum);
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java

@ -497,9 +497,10 @@ public class SFExpressService extends BaseService {
            if("福建省".equals(d_province)){
                end_address_name = "省内";
            }else{
                end_address_name = d_city;
                end_address_name = d_province;
            }
        }
        end_address_name = "%"+end_address_name.replaceAll("省","").replaceAll("市","")+"%";
        DmExpressagePriceEntity sfprice =  dmExpressagePriceDao.getExprePriceEntityByCodeAndEndAdressName("shunfeng",end_address_name);
        return sfprice;
    }

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

@ -254,7 +254,8 @@ public class PatientPrescriptionPayService extends BaseService {
     * @param
     * @return
     */
    public void recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
    public Map recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
        Map resultMap = new HashMap();
        Prescription prescription = null;
        int flag = 0;
        Boolean isSuccess = false;
@ -415,6 +416,8 @@ public class PatientPrescriptionPayService extends BaseService {
            prescription = prescriptionDao.findByCode(prescriptionCode);
            PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
            if ("0".equals(tradeStatus)) {
                //支付成功返回续方code给前端
                resultMap.put("prescriptionCode",prescriptionCode);
                prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
                prescription.setStatus(30);//续费状态 30支付成功 21支付失败
                expressage.setDel(1);//快递信息状态 1可用 0删除
@ -456,6 +459,7 @@ public class PatientPrescriptionPayService extends BaseService {
        logService.saveHttpLog(isSuccess, config.getReturnUrl(), "长处方支付页面跳转", "POST", null, "", responses, error, logService.onepayType);
        //记录支付log日志到数据库
        payLogService.addLog(prescription, 2, flag, 1);
        return resultMap;
    }
    /**
@ -645,7 +649,8 @@ public class PatientPrescriptionPayService extends BaseService {
     * 长处方支付,成功则返回支付路径
     */
    @Transactional
    public String charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl) throws Exception {
    public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl) throws Exception {
        Map resultMap = new HashMap();
        //获取机构映射
        HospitalMapping hos = mappingDao.findByCode(orgCode);
        if (hos == null) {
@ -957,8 +962,9 @@ public class PatientPrescriptionPayService extends BaseService {
        if (!isSuccess) {
            throw new Exception(error);
        }
        return result;
        resultMap.put("outChargeNo", uuid);
        resultMap.put("payUrl", result);
        return resultMap;
    }

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

@ -203,8 +203,11 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        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 ";
        Map<String, Object> result = jdbcTemplate.queryForMap(sql,prescriptionCode,patientCode,type);
        return result;
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql,prescriptionCode,patientCode,type);
        if(result.size()>0){
            return result.get(0);
        }
        return null;
    }
    @Transactional

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

@ -1080,12 +1080,12 @@ public class PrescriptionInfoService extends BaseService {
               " t.register_fee AS registerFee," +
               " t.register_type AS registerType," +
               " t.register_type_name AS registerTypeName " +
               " FROM" +
               " FROM " +
               " zy_iv_staff_reg_type_allot_dict t" +
               " WHERE" +
               " t.org_code =? " +
               " AND t.staff_code =?");
       List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString(),new Object[]{jwHospital,jwDoctorCode});
               " t.org_code = '"+jwHospital+"'" +
               " AND t.staff_code = '"+jwDoctorCode+"'");
       List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString());
       return new JSONArray(rs);
   }

+ 0 - 288
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PCPrescriptionExpressageService.java

@ -1,288 +0,0 @@
package com.yihu.wlyy.service.pc.prescription;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.BaseService;
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 java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * Created by liuwenbin on 2017/8/12.
 * PC端长处方取药/领药业务层
 */
@Service
public class PCPrescriptionExpressageService extends BaseService {
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private RoleService roleService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    public Integer getMedicine(String code,String userCode){
        JSONObject jsonObject = new JSONObject();
        //获取根据wlyy_prescription_dispensary_code的code处方编码
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(code);
        Integer returnStatus = -1;
        if (prescriptionDispensaryCode == null) {
            //保存验证二维码的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("编码不存在");
            prescriptionLogDao.save(prescriptionLog);
            returnStatus = -1;
            return returnStatus;
        }
        if (prescriptionDispensaryCode.getIsUse() == 1) {
            //判断编码是否使用过
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("编码重复扫描");
            prescriptionLogDao.save(prescriptionLog);
            returnStatus = -2;
            return returnStatus;
        }
        // 判断出药机构是否与健管师所属机构一致,不一致弹窗提示:“出药机构与您所在机构不一致,无法出药,请重新确认”。一致则进入下一步。
        //获取医生角色和区域权限
//        List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(userCode);
//        if("10".equals(doctor.getLevel())&&roleMap.size()==0){
//            errorMessage="该用户没有管理员权限";
//            loginLog.setErrorMessage(errorMessage);
//            loginLogService.saveLog(loginLog);
//            return error(-1, errorMessage);
//        }
        switch (prescriptionDispensaryCode.getType()) {
            case 1: {
                //判断是1 居民取药码
//                returnStatus = dispensaryCode_1(userCode, prescriptionDispensaryCode);
                break;
            }
            case 2: {
                //判断是2 配送员(健管师)取药码
//                returnStatus = dispensaryCode_2(userCode, prescriptionDispensaryCode);
                break;
            }
            case 3: {
                //判断是3 配送员(健管师)配送码
//                returnStatus = dispensaryCode_3(userCode, prescriptionDispensaryCode);
                break;
            }
            default: {
                PrescriptionLog prescriptionLog = new PrescriptionLog();
                prescriptionLog.setCode(UUID.randomUUID().toString());
                prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                prescriptionLog.setCreateTime(new Date());
                prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
                prescriptionLog.setFlag(1);
                prescriptionLog.setUserCode(userCode);
                prescriptionLog.setUserType(2);
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                prescriptionLog.setRemark("编码类型错误");
                prescriptionLogDao.save(prescriptionLog);
                returnStatus = -3;
                return returnStatus;
            }
        }
        return 0;
    }
    //健管师取药码
    public JSONObject dispensaryCode_2(String userCode,PrescriptionDispensaryCode prescriptionDispensaryCode){
//        Integer returnStatus = -3;
        JSONObject jsonObject = new JSONObject();
        Doctor doctor = doctorService.findDoctorByCode(userCode);
        String sql = "select a.type,c.status,b.hospital_code as hospitalCode from wlyy_prescription_dispensary_code a \n" +
                "left join wlyy_prescription_expressage b on a.prescription_code = b.prescription_code \n" +
                "left join wlyy_prescription c on a.prescription_code = c.code \n" +
                "where a.prescription_code=?";
        Map<String, Object> result = jdbcTemplate.queryForMap(sql,prescriptionDispensaryCode.getPrescriptionCode());
        if(result.size()>0){
            int status = (Integer)result.get("status");
            if((Integer)result.get("type")==1){//居民取药码
                if(status>=30){
                    if(status==30){
                        jsonObject.put("status",-5);//订单正在配药中,暂时无法出药
                    }else if(status==40){
                        jsonObject.put("status",1);//取药成功
                    }else{
                        jsonObject.put("status",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                    }
                }
            }else if((Integer)result.get("type")==2){//健管师取药码
                if(result.get("hospitalCode").toString().equals(doctor.getHospital())){
                    //20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败 42分配健管师 45配送中   49配送到服务站  100配送到患者手中/已完成
                    if(status==30){
                        jsonObject.put("status",-5);//订单正在配药中,暂时无法出药
                    }else if(status>=45){
                        jsonObject.put("status",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                    }else if(status==40){
                        jsonObject.put("status",1);
                    }
                }else{
                    jsonObject.put("status",-4);//出药机构与您所在机构不一致,无法出药,请重新确认
//            return jsonObject;
                }
            }else{
                jsonObject.put("status",-7); //取药码错误
                //保存验证二维码的日志
                PrescriptionLog prescriptionLog = new PrescriptionLog();
                prescriptionLog.setCode(UUID.randomUUID().toString());
                prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                prescriptionLog.setCreateTime(new Date());
                prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
                prescriptionLog.setFlag(1);
                prescriptionLog.setUserCode(userCode);
                prescriptionLog.setUserType(2);
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                prescriptionLog.setRemark("PC端取药码输入错误!");
                prescriptionLogDao.save(prescriptionLog);
            }
        }else{
            jsonObject.put("status",-7); //取药码错误
            //保存验证二维码的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("编码不存在");
            prescriptionLogDao.save(prescriptionLog);
        }
        jsonObject.put("result",result);
        return jsonObject;
    }
    public JSONObject getMedicine2(String code,String userCode){
        JSONObject jsonObject = new JSONObject();
        Doctor doctor = doctorService.findDoctorByCode(userCode);
        String sql = "select a.type,a.prescription_code as prescriptionCode c.status,b.hospital_code as hospitalCode, \n" +
                "b.code as expressageCode, b.hospital_name as hospitalName,c.dispensary_type as dispensaryType, \n" +
                "b.expressage_name as expressageName, b.expressage_code as expressageCode,b.expressage_mobile as expressageMobile \n" +
                "from wlyy_prescription_dispensary_code a \n" +
                "left join wlyy_prescription_expressage b on a.prescription_code = b.prescription_code \n" +
                "left join wlyy_prescription c on a.prescription_code = c.code \n" +
                "where a.is_use=0 and a.cod=? and c.status>=30";
        Map<String, Object> result = jdbcTemplate.queryForMap(sql,code);
        if(result.size()>0){
            int type = result.get("type")!=null?(Integer) result.get("type"):0;
            int status = result.get("status")!=null?(Integer) result.get("status"):-100;
            switch (type){
                //居民取药码
                case 1:{
                    if(status==30){
                        jsonObject.put("status",-5);//订单正在配药中,暂时无法出药
                    }else if(status==40){
                        jsonObject.put("status",1);
                    }else{
                        jsonObject.put("status",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                    }
                }
                //健管师取药码
                case 2:{
                    //判断出药机构是否与健管师所属机构一致,不一致弹窗提示:“出药机构与您所在机构不一致,无法出药,请重新确认”。一致则进入下一步。
                    if(doctor.getHospital().equals(result.get("hospitalCode").toString())){
                        //20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败 42分配健管师 45配送中   49配送到服务站  100配送到患者手中/已完成
                        if(status==30){
                            jsonObject.put("status",-5);//订单正在配药中,暂时无法出药
                        }else if(status>=45){
                            jsonObject.put("status",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                        }else if(status==40){
                            jsonObject.put("status",1);
                        }
                    }else{
                        jsonObject.put("status",-4);//出药机构与您所在机构不一致,无法出药,请重新确认
                    }
                }
                default:{
                    PrescriptionLog prescriptionLog = new PrescriptionLog();
                    prescriptionLog.setCode(UUID.randomUUID().toString());
                    prescriptionLog.setPrescriptionCode(result.get("prescriptionCode").toString());
                    prescriptionLog.setCreateTime(new Date());
                    prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
                    prescriptionLog.setFlag(1);
                    prescriptionLog.setUserCode(userCode);
                    prescriptionLog.setUserType(2);
                    prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                    prescriptionLog.setRemark("编码类型错误");
                    prescriptionLogDao.save(prescriptionLog);
                }
            }
        }else{
            //保存验证二维码的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
//            prescriptionLog.setPrescriptionCode(result.get("").toString());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("PC端取药码输入错误!");
        }
//        prescriptionInfoService.
        jsonObject.put("expressageCode",result.get("expressageCode"));
        jsonObject.put("hospitalCode",result.get("hospitalCode"));
        jsonObject.put("hospitalName",result.get("hospitalName"));
        jsonObject.put("status",result.get("status"));
        jsonObject.put("dispensaryType",result.get("dispensaryType"));
        jsonObject.put("expressageName",result.get("expressageName"));
        jsonObject.put("expressageMobile",result.get("expressageMobile"));
        return jsonObject;
    }
}

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

@ -0,0 +1,237 @@
package com.yihu.wlyy.service.pc.prescription;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
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 java.beans.Transient;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * Created by liuwenbin on 2017/8/12.
 * PC端长处方取药/领药业务层
 */
@Service
public class PrescriptionExpressagePCService extends BaseService {
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private RoleService roleService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DoctorDao doctorDao;
    @Transactional
    public JSONObject getMedicine(String code,String userCode) throws Exception{
        JSONObject jsonObject = new JSONObject();
        Doctor doctor = doctorService.findDoctorByCode(userCode);
        String sql = "select a.type,a.prescription_code as prescriptionCode ,c.status,b.hospital_code as hospitalCode, \n" +
                "b.code as orderCode, b.hospital_name as hospitalName,c.dispensary_type as dispensaryType, \n" +
                "b.expressage_name as expressageName, b.expressage_code as expressageCode,b.expressage_mobile as expressageMobile,d.idcard \n" +
                "from wlyy_prescription_dispensary_code a \n" +
                "left join wlyy_prescription_expressage b on a.prescription_code = b.prescription_code \n" +
                "left join wlyy_prescription c on a.prescription_code = c.code \n" +
                "left join wlyy_doctor d on b.code=b.expressage_code \n"+
                "where a.is_use=0 and a.code=? and c.status>=50";
           List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql,code);
            if(resultList.size()>0){
                Map<String, Object> result = resultList.get(0);
                int type = result.get("type")!=null?(Integer) result.get("type"):0;
                int status = result.get("status")!=null?(Integer) result.get("status"):-100;
                switch (type){
                    //居民取药码
                    case 1:{
                        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.put("prescriptionInfoList",list);
                            jsonObject.put("idcard",result.get("idcard"));
                            jsonObject.put("orderCode",result.get("orderCode"));
                            jsonObject.put("hospitalCode",result.get("hospitalCode"));
                            jsonObject.put("hospitalName",result.get("hospitalName"));
                            jsonObject.put("status",result.get("status"));
                            jsonObject.put("dispensaryType",result.get("dispensaryType"));
                            jsonObject.put("expressageName",result.get("expressageName"));
                            jsonObject.put("expressageMobile",result.get("expressageMobile"));
                        }else{
                            jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                            jsonObject.put("prescriptionInfoList",list);
                            jsonObject.put("idcard",result.get("idcard"));
                            jsonObject.put("orderCode",result.get("orderCode"));
                            jsonObject.put("hospitalCode",result.get("hospitalCode"));
                            jsonObject.put("hospitalName",result.get("hospitalName"));
                            jsonObject.put("status",result.get("status"));
                            jsonObject.put("dispensaryType",result.get("dispensaryType"));
                            jsonObject.put("expressageName",result.get("expressageName"));
                            jsonObject.put("expressageMobile",result.get("expressageMobile"));
                        }
                    }
                    //健管师取药码
                    case 2:{
                        //判断出药机构是否与健管师所属机构一致,不一致弹窗提示:“出药机构与您所在机构不一致,无法出药,请重新确认”。一致则进入下一步。
                        if(doctor.getHospital().equals(result.get("hospitalCode").toString())){
                            //20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败 42分配健管师 45配送中   49配送到服务站  100配送到患者手中/已完成
                            if(status==50){
                                jsonObject.put("flag",-5);//订单正在配药中,暂时无法出药
                            }else if(status==60){
                                jsonObject.put("flag",1);
                                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                                jsonObject.put("prescriptionInfoList",list);
                                jsonObject.put("orderCode",result.get("orderCode"));
                                jsonObject.put("idcard",result.get("idcard"));
                                jsonObject.put("hospitalCode",result.get("hospitalCode"));
                                jsonObject.put("hospitalName",result.get("hospitalName"));
                                jsonObject.put("status",result.get("status"));
                                jsonObject.put("dispensaryType",result.get("dispensaryType"));
                                jsonObject.put("expressageName",result.get("expressageName"));
                                jsonObject.put("expressageMobile",result.get("expressageMobile"));
                            }else{
                                jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                                jsonObject.put("prescriptionInfoList",list);
                                jsonObject.put("orderCode",result.get("orderCode"));
                                jsonObject.put("idcard",result.get("idcard"));
                                jsonObject.put("hospitalCode",result.get("hospitalCode"));
                                jsonObject.put("hospitalName",result.get("hospitalName"));
                                jsonObject.put("status",result.get("status"));
                                jsonObject.put("dispensaryType",result.get("dispensaryType"));
                                jsonObject.put("expressageName",result.get("expressageName"));
                                jsonObject.put("expressageMobile",result.get("expressageMobile"));
                            }
                        }else{
                            jsonObject.put("flag",-4);//出药机构与您所在机构不一致,无法出药,请重新确认
                        }
                    }
                    default:{
                        PrescriptionLog prescriptionLog = new PrescriptionLog();
                        prescriptionLog.setCode(UUID.randomUUID().toString());
                        prescriptionLog.setPrescriptionCode(result.get("prescriptionCode").toString());
                        prescriptionLog.setCreateTime(new Date());
                        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
                        prescriptionLog.setFlag(1);
                        prescriptionLog.setUserCode(userCode);
                        prescriptionLog.setUserType(2);
                        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                        prescriptionLog.setRemark("编码类型错误");
                        prescriptionLogDao.save(prescriptionLog);
                    }
                }
            }else{
                //保存验证二维码的日志
                PrescriptionLog prescriptionLog = new PrescriptionLog();
                prescriptionLog.setCode(UUID.randomUUID().toString());
//            prescriptionLog.setPrescriptionCode(result.get("").toString());
                prescriptionLog.setCreateTime(new Date());
                prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
                prescriptionLog.setFlag(1);
                prescriptionLog.setUserCode(userCode);
                prescriptionLog.setUserType(2);
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                prescriptionLog.setRemark("PC端取药码输入错误!");
            }
            return jsonObject;
    }
    @Transactional
    public void fetchingMedicine(String code,String userCode) throws Exception{
        //更新二维码(isUse)
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(code);
        prescriptionDispensaryCode.setIsUse(1);
        prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
        //更新处方状态
        //判断二维码是居民取药码还是健管师取药码
        Prescription prescription =  prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        if(prescriptionDispensaryCode.getType()==1){//居民取药码
            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        }else if(prescriptionDispensaryCode.getType()==2){
            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        }
        prescriptionDao.save(prescription);
        //处方日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCreateTime(new Date());
        PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode("e707487f063540e1b6d581b16bb8fb12");
        if(prescriptionDispensaryCode.getType()==1){//居民取药码
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
            prescriptionLog.setUserCode(prescription.getPatient());
            prescriptionLog.setUserName(prescription.getPatientName());
            prescriptionLog.setUserType(1);
        }else if(prescriptionDispensaryCode.getType()==2){
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setUserCode(prescriptionExpressage.getExpressageCode());
            prescriptionLog.setUserName(prescriptionExpressage.getExpressageName());
            prescriptionLog.setUserType(2);
            //发送模板消息通知患者药品开始配送
        }
        prescriptionLog.setFlag(1);
        prescriptionLog.setHospital(prescriptionExpressage.getHospitalCode());
        prescriptionLog.setHospitalName(prescriptionExpressage.getHospitalName());
        prescriptionLogDao.save(prescriptionLog);
//        prescriptionLog.setType();
//        prescriptionLogDao
        if(prescriptionDispensaryCode.getType()==2){
            Patient patient = patientDao.findByCode(prescription.getPatient());
            String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                    "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
        }
        prescriptionExpressage.setExpressageTime(new Date());
        Doctor doctor = doctorDao.findByCode(userCode);
        prescriptionExpressage.setHospitalDoctorCode(userCode);
        prescriptionExpressage.setHospitalDoctor(doctor.getName());
        prescriptionExpressageDao.save(prescriptionExpressage);
    }
}

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

@ -1979,7 +1979,7 @@ public class DoctorController extends BaseController {
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/checkCertificate", method = RequestMethod.GET)
    @ApiOperation("校验医师输入的CA证书是否正确")
    @ApiOperation("校验医师输入的身份证是否正确")
    public String checkCertificate(
            @ApiParam(required = true, name = "certificateNum", value = "证书编号") @RequestParam(value = "certificateNum",required = true) String certificateNum){

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

@ -219,7 +219,7 @@ public class PrescriptionInfoController extends BaseController{
                                                  @RequestParam(required = false) @ApiParam(value = "页数", name = "page")Integer page,
                                                  @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size")Integer size){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getHDoctorPrescriptionExpressage(teamCode,type,"915ccc97-5b1d-11e6-8344-fa163e8aee56",nameKey,startDate,endDate,hospital,state,page,size));
            return write(200, "操作成功!", "data",prescriptionInfoService.getHDoctorPrescriptionExpressage(teamCode,type,getRepUID(),nameKey,startDate,endDate,hospital,state,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -256,13 +256,13 @@ public class PrescriptionInfoController extends BaseController{
                                                  @RequestParam(required = false) @ApiParam(value = "机构", name = "hospital")String hospital,
                                                  @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state")String state,
                                                  @RequestParam(required = false) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送", name = "dispensaryType")String dispensaryType,
                                                  @RequestParam(required = false) @ApiParam(value = "传1为未分配健管师", name = "AllocationType")String AllocationType,
                                                  @RequestParam(required = false) @ApiParam(value = "传1为未分配健管师", name = "AllocationType")String allocationType,
                                                  @RequestParam(required = false) @ApiParam(value = "起始页", name = "page")Integer page,
                                                  @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size")Integer size){
        try {
            return write(200, "操作成功!", "data",
                    prescriptionInfoService.
                            getDoctorPrescriptionExpressage(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType,AllocationType, page, size));
                            getDoctorPrescriptionExpressage(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType,allocationType, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -353,8 +353,7 @@ public class PrescriptionInfoController extends BaseController{
    @ApiOperation(value = "获取调整处方模板")
    public String getPrescriptionTemp(){
        try {
//            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp(getUID()));
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp("1"));
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");

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

@ -1,9 +1,12 @@
package com.yihu.wlyy.web.doctor.prescriptionPC;
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;
import org.springframework.web.bind.annotation.RequestParam;
@ -16,13 +19,32 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/PC/prescription")
public class PrescriptionExpressagePCController extends BaseController {
    @Autowired
    private PrescriptionExpressagePCService prescriptionExpressagePCService;
    @ApiOperation(value = "取药/领药")
    @RequestMapping(value = "/getMedicine", method = RequestMethod.POST)
    public String getMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(取药码、配送码)") @RequestParam(value = "code", required = true) String code){
            @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);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
        }
    }
        return "";
    @ApiOperation(value = "确认取药/领药")
    @RequestMapping(value = "/fetchingMedicine", method = RequestMethod.POST)
    public String fetchingMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try {
            prescriptionExpressagePCService.fetchingMedicine(code, "hxmD201703150111");
            return write(200, "更改成功!");
        }catch (Exception e) {
            error(e);
            return error(-1, "更改失败!");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -126,7 +126,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/getPatientQrcode", method = RequestMethod.GET)
    public String getPatientQrcode(@RequestParam(value = "dispensaryCode",required = true) String prescriptionCode) {
    public String getPatientQrcode(@RequestParam(value = "prescriptionCode",required = true) String prescriptionCode) {
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getRepUID(),1);

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -78,7 +78,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        try {
            String accessToken = getAccessToken();
            String patient = getUID();
            String result = payService.charge(type,addressJson,orgCode, prescriptionCode, totalAmount, patient, accessToken,returnUrl);
            Map result = payService.charge(type,addressJson,orgCode, prescriptionCode, totalAmount, patient, accessToken,returnUrl);
            return write(200, "支付成功!","data",result);
        } catch (Exception e) {
            return error(-1, "支付失败!");
@ -115,8 +115,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    public String recipeReturnUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
        try {
            String accessToken = getAccessToken();
            payService.recipeReturnUrl(request, response, accessToken);
            return write(200, "页面回调成功!");
            Map result = payService.recipeReturnUrl(request, response, accessToken);
            return write(200, "页面回调成功!","data",result);
        } catch (Exception e) {
            return error(-1, "页面回调失败!");
        }