Browse Source

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

chenyongxing 8 năm trước cách đây
mục cha
commit
02ed818e7c
17 tập tin đã thay đổi với 381 bổ sung391 xóa
  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. 71 58
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ZyDictJob.java
  5. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application.yml
  6. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  7. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/DmExpressagePriceDao.java
  8. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java
  9. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java
  10. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  11. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  12. 0 288
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PCPrescriptionExpressageService.java
  13. 237 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java
  14. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  15. 4 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  16. 25 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java
  17. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.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)

+ 71 - 58
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ZyDictJob.java

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

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