فهرست منبع

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

trick9191 8 سال پیش
والد
کامیت
868b9c7737
38فایلهای تغییر یافته به همراه2579 افزوده شده و 229 حذف شده
  1. 69 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  2. 88 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/dao/PatientDao.java
  3. 425 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/Patient.java
  4. 27 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PatientService.java
  5. 16 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  6. 127 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/util/HttpClientUtil.java
  7. 1 0
      patient-co-customization/patient-co-modern-medicine/src/main/resources/application.yml
  8. 62 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/RepositoryMedicineConfig.java
  9. 12 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  10. 15 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java
  11. 16 7
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java
  12. 44 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java
  13. 10 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignFamily.java
  14. 5 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/filter/SessionOutTimeFilter.java
  15. 69 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/medicine/entity/WlyyMedicineKey.java
  16. 11 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/medicine/repository/WlyyMedicineKeyDao.java
  17. 20 27
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  18. 49 73
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  19. 31 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/medicine/WlyyMedicineKeyService.java
  20. 205 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/query/BasemedicineJpaService.java
  21. 26 0
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  22. 2 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  23. 70 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyCommonDict.java
  24. 88 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptDict.java
  25. 65 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptStaffAllotDict.java
  26. 109 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseClassDict.java
  27. 111 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseDict.java
  28. 54 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java
  29. 224 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvPhysicDict.java
  30. 146 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffDict.java
  31. 88 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffRegTypeAllotDict.java
  32. 88 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvSubjectClassDict.java
  33. 55 11
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  34. 48 51
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java
  35. 79 47
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  36. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  37. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  38. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

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

@ -1,7 +1,13 @@
package com.yihu.mm.controller.medicine;
import com.yihu.mm.controller.BaseController;
import com.yihu.mm.entity.Patient;
import com.yihu.mm.service.PatientService;
import com.yihu.mm.service.PhysicalExaminationService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@ -11,9 +17,70 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(value = "/medicine/physicalExamination")
public class PhysicalExaminationController extends BaseController {
    @RequestMapping(value = "/findTest",produces="application/json;charset=UTF-8")
    @Value("${examCode}")
    private String examCode;
    @Autowired
    private PatientService patientService;
    @Autowired
    private PhysicalExaminationService physicalExaminationService;
    @ApiOperation(value = "获取试卷列表")
    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findExames(@ApiParam(name = "tp_type", value = "'问卷类型',(备选值:1,2,4)1:初筛问卷,2:助理问卷,4:现场问卷", required = true)@RequestParam(required = false, name = "tp_type") String tp_type) {
        physicalExaminationService.findExames(tp_type,examCode);
        return null;
    }
    @ApiOperation(value = "新增预约单/获取咨询编号等信息")
    @RequestMapping(value = "/insertslip",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode){
        Patient patient = patientService.findByCode(patientCode);
        return physicalExaminationService.insertslip(patient);
    }
    @ApiOperation(value = "获取试题")
    @RequestMapping(value = "/findExames",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 = "pb_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "pb_id") String ct_id){
        return null;
    }
    @ApiOperation(value = "提交试卷答案")
    @RequestMapping(value = "/handleExam",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String handleExam(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
                               @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){
        return null;
    }
    @ApiOperation(value = "四诊资料采集")
    @RequestMapping(value = "/dillphoneimgdata",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String login(@ApiParam(name = "type", value = "账号", required = true)@RequestParam(required = false, name = "type") String type) throws Exception {
    public String dillphoneimgdata(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
                             @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
                             @ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
        return null;
    }
    @ApiOperation(value = "查找报告单")
    @RequestMapping(value = "/findconconhealth",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findconconhealth(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
        return null;
    }
}

+ 88 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/dao/PatientDao.java

@ -0,0 +1,88 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.dao;
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;
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);
}

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

@ -0,0 +1,425 @@
package com.yihu.mm.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 患者信息
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_patient")
public class Patient extends IdEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8358924836164389434L;
	// 业务主键
	private String code;
	// 身份证号
	private String idcard;
	// 登录密码
	private String password;
	private String salt;
	// 姓名
	private String name;
	// 生日
	private Date birthday;
	// 性別,1男,2女
	private Integer sex;
	// 手機號
	private String mobile;
	// (基卫)手機號
	private String mobileRemarks;
	// 聯繫電話
	private String phone;
	// 社保卡號
	private String ssc;
	// 頭像HTTP地址
	private String photo;
	// 省代碼
	private String province;
	// 城市代碼
	private String city;
	// 區縣代碼
	private String town;
	// 街道代码
	private String street;
	// 省名
	private String provinceName;
	// 市名
	private String cityName;
	// 區縣名
	private String townName;
	// 街道名称
	private String streetName;
	// 地址
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	// 病情:0绿标,1黄标,2红标
	private Integer diseaseCondition;
	// 病历记录总数
	private Integer recordAmount;
	// 總積分
	private Integer points;
	// 更新時間
	private Date czrq;
	// 微信编号
	private String openid;
	//微信时间
	private Date openidTime;
	// 用户状态:1正常,0禁用,-1恶意注册,2审核中
	private Integer status;
	// 居委会字段id
	private String sickVillage;
	// 居委会字段名称
	private String sickVillageName;
//	是否绑定电子社保卡
	private Integer sicardStatus;
//	绑定电子社保卡时间
	private Date sicardTime;
	//是否分配过微信标签  1分配过 0或者空没有
	private Integer isWxtag;
	public Integer getSicardStatus() {
		return sicardStatus;
	}
	public void setSicardStatus(Integer sicardStatus) {
		this.sicardStatus = sicardStatus;
	}
	public Date getSicardTime() {
		return sicardTime;
	}
	public void setSicardTime(Date sicardTime) {
		this.sicardTime = sicardTime;
	}
	private List<SignPatientLabelInfo> labelInfos=new ArrayList<>();//患者的疾病标签list
	public Patient() {
	}
	public Patient(Long id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getIdcard() {
		return idcard;
	}
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getSsc() {
		return ssc;
	}
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	@Column(name = "photo", insertable = false)
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	@Column(name = "province_name")
	public String getProvinceName() {
		return provinceName;
	}
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	@Column(name = "city_name")
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	@Column(name = "town_name")
	public String getTownName() {
		return townName;
	}
	public void setTownName(String townName) {
		this.townName = townName;
	}
	@Column(name = "street_name")
	public String getStreetName() {
		return streetName;
	}
	public void setStreetName(String streetName) {
		this.streetName = streetName;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Integer getDisease() {
		return disease;
	}
	public void setDisease(Integer disease) {
		this.disease = disease;
	}
	@Column(name = "disease_condition")
	public Integer getDiseaseCondition() {
		return diseaseCondition;
	}
	public void setDiseaseCondition(Integer diseaseCondition) {
		this.diseaseCondition = diseaseCondition;
	}
	@Column(name = "record_amount")
	public Integer getRecordAmount() {
		return recordAmount;
	}
	public void setRecordAmount(Integer recordAmount) {
		this.recordAmount = recordAmount;
	}
	public Integer getPoints() {
		return points;
	}
	public void setPoints(Integer points) {
		this.points = points;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	public String getOpenid() {
		return openid;
	}
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Transient
	public List<SignPatientLabelInfo> getLabelInfos() {
		return labelInfos;
	}
	public void setLabelInfos(List<SignPatientLabelInfo> labelInfos) {
		this.labelInfos = labelInfos;
	}
	public String getMobileRemarks() {
		return mobileRemarks;
	}
	public void setMobileRemarks(String mobileRemarks) {
		this.mobileRemarks = mobileRemarks;
	}
	public Date getOpenidTime() {
		return openidTime;
	}
	public void setOpenidTime(Date openidTime) {
		this.openidTime = openidTime;
	}
	public String getSickVillage() {
		return sickVillage;
	}
	public void setSickVillage(String sickVillage) {
		this.sickVillage = sickVillage;
	}
	public String getSickVillageName() {
		return sickVillageName;
	}
	public void setSickVillageName(String sickVillageName) {
		this.sickVillageName = sickVillageName;
	}
	public Integer getIsWxtag() {
		return isWxtag;
	}
	public void setIsWxtag(Integer isWxtag) {
		this.isWxtag = isWxtag;
	}
	//---------------------------常量----------------------------
	public enum isWchatTage{
		yes(1),no(0);
		isWchatTage(Integer value) {
			this.value = value;
		}
		private Integer value;
		public Integer getValue() {
			return value;
		}
		public void setValue(Integer value) {
			this.value = value;
		}
	}
}

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

@ -0,0 +1,27 @@
/*******************************************************************************
 * 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.dao.PatientDao;
import com.yihu.mm.entity.Patient;
import org.springframework.stereotype.Service;
/**
 * 患者基本信息类.
 *
 * @author George
 */
@Service
public class PatientService {
    private PatientDao patientDao;
    public Patient findByCode(String code) {
        return patientDao.findByCode(code);
    }
}

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

@ -1,4 +1,20 @@
package com.yihu.mm.service;
import com.yihu.mm.entity.Patient;
import org.springframework.stereotype.Service;
@Service
public class PhysicalExaminationService {
    public void findExames(String type, String examCode) {
    }
    public String insertslip(Patient patient) {
        return null;
    }
}

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

@ -0,0 +1,127 @@
package com.yihu.mm.util;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
public class HttpClientUtil {
	/**
	 * 发送post请求
	 * @param url 请求地址
	 * @param params 请求参数
	 * @param chatSet 编码格式
	 * @return
	 */
	public static String post(String url, List<NameValuePair> params, String chatSet) {
		// 创建默认的httpClient实例.
		CloseableHttpClient httpclient = HttpClients.createDefault();
		// 创建httppost
		HttpPost httppost = new HttpPost(url);
		UrlEncodedFormEntity uefEntity;
		try {
			uefEntity = new UrlEncodedFormEntity(params, chatSet);
			httppost.setEntity(uefEntity);
			CloseableHttpResponse response = httpclient.execute(httppost);
			try {
				HttpEntity entity = response.getEntity();
				if (entity != null) {
					return EntityUtils.toString(entity, chatSet);
				}
			} finally {
				response.close();
			}
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e1) {
			e1.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			// 关闭连接,释放资源
			try {
				httpclient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return null;
	}
	/**
	 * 发送get请求
	 * @param url 请求地址
	 * @param chatSet 编码格式
	 * @return
	 */
	public static String get(String url, String chatSet) {
		CloseableHttpClient httpclient = HttpClients.createDefault();
		try {
			// 创建httpget.
			HttpGet httpget = new HttpGet(url);
			// 执行get请求.
			CloseableHttpResponse response = httpclient.execute(httpget);
			try {
				// 获取响应实体
				HttpEntity entity = response.getEntity();
				if (entity != null) {
					return EntityUtils.toString(entity, chatSet);
				}
			} finally {
				response.close();
			}
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (ParseException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			// 关闭连接,释放资源
			try {
				httpclient.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return null;
	}
	public static String postBody(String url,JSONObject params){
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
		headers.setContentType(type);
		headers.add("Accept", MediaType.APPLICATION_JSON.toString());
		org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
		String ret = restTemplate.postForObject(url, formEntity, String.class);
		return ret;
	}
	public static void putBody(String url,JSONObject params){
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
		headers.setContentType(type);
		headers.add("Accept", MediaType.APPLICATION_JSON.toString());
		org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
		restTemplate.put(url, formEntity, String.class);
	}
}

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

@ -1,6 +1,7 @@
server:
  port: 8080
examCode:         #越人试卷题目code
security:
  basic:

+ 62 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/RepositoryMedicineConfig.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManager;
import javax.sql.DataSource;
import java.util.Map;
/**
 * Created by Administrator on 2017/08/14.
 * medicine数据库jpa支持配置
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef="entityManagerFactoryMedicine",
        transactionManagerRef="transactionManagerMedicine",
        basePackages= { "com.yihu.wlyy.medicine.repository" })
public class RepositoryMedicineConfig {
    @Autowired
    private JpaProperties jpaProperties;
    @Autowired
    @Qualifier("deviceDataSource")
    private DataSource deviceDataSource;
    @Bean(name = "entityManagerMedicine")
    public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
        return entityManagerFactory(builder).getObject().createEntityManager();
    }
    @Bean(name = "entityManagerFactoryMedicine")
    public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) {
        return builder
                .dataSource(deviceDataSource)
                .properties(getVendorProperties(deviceDataSource))
                .packages("com.yihu.wlyy.medicine.entity")
                .persistenceUnit("threeTimePersistenceUnit")
                .build();
    }
    private Map<String, String> getVendorProperties(DataSource dataSource) {
        return jpaProperties.getHibernateProperties(dataSource);
    }
    @Bean(name = "transactionManagerMedicine")
    PlatformTransactionManager transactionManager(EntityManagerFactoryBuilder builder) {
        return new JpaTransactionManager(entityManagerFactory(builder).getObject());
    }
}

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

@ -62,10 +62,22 @@ public class CustomerController extends BaseController {
            req.getSession().setAttribute("code",curUser.getCode());
            req.getSession().setAttribute("name",curUser.getName());
            req.getSession().setAttribute("isLogin", "true");
            req.getSession().setMaxInactiveInterval(-1);//设置session用不过期
            return write(1,"登入成功","user",curUser);
        }
    }
    @RequestMapping(value = "/logout",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String logout(HttpServletRequest req) throws Exception {
        req.getSession().removeAttribute("userInfo");
        req.getSession().removeAttribute("mobile");
        req.getSession().removeAttribute("code");
        req.getSession().removeAttribute("name");
        req.getSession().removeAttribute("isLogin");
        return write(1,"退出成功");
    }
    /**
     *通过社保卡号或者身份证查找服务对象
     * @return

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

@ -1,10 +1,11 @@
package com.yihu.wlyy.controller.manager.yueren;
import com.google.gson.Gson;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.manager.medicine.WlyyMedicineKeyService;
import com.yihu.wlyy.util.HttpClientUtil;
import io.swagger.annotations.Api;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -25,6 +26,8 @@ public class YueRenController extends BaseController {
    @Value("${yueren.api}")
    private String api;
    @Autowired
    private WlyyMedicineKeyService wlyyMedicineKeyService;
    //--预约模块 begin
    /**
     * 获取每个接口需要传递的key值
@ -34,6 +37,13 @@ public class YueRenController extends BaseController {
    @ResponseBody
    public String getPhoneKey() {
        String postStr = remoteCall("/yueren/phonekey", new JSONObject());
        JSONObject jsonObject = new JSONObject(postStr);
        String status = jsonObject.get("status").toString();
        if ("200".equals(status)) {
            JSONObject recordset = jsonObject.getJSONObject("recordset");
            String key = recordset.getString("key");
            this.saveKey(key);
        }
        return postStr;
    }
@ -276,4 +286,8 @@ public class YueRenController extends BaseController {
            return "{\"status\":500,\"exception\":\"连接出错\"}";
        }
    }
    public void saveKey(String key) {
        wlyyMedicineKeyService.saveKey(key);
    }
}

+ 16 - 7
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java

@ -1,17 +1,16 @@
package com.yihu.wlyy.entity;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * 医生信息
@ -363,6 +362,16 @@ public class Doctor extends IdEntity {
    @Transient
    public String getLevelName() {
		// 类型:1专科医生,2全科医生,3健康管理师
		if(1==level){
			levelName = "专科医生";
		}else if(2==level){
			levelName = "全科医生";
		}else if(level==3){
			levelName = "健康管理所";
		}else{
			levelName = "";
		}
        return levelName;
    }

+ 44 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java

@ -1,15 +1,13 @@
package com.yihu.wlyy.entity;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
 * 患者信息
@ -66,8 +64,10 @@ public class Patient extends IdEntity implements Serializable {
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	private String diseaseName;
	// 病情:0绿标,1黄标,2红标
	private Integer diseaseCondition;
	private String diseaseConditionName;
	// 病历记录总数
	private Integer recordAmount;
	// 總積分
@ -324,4 +324,42 @@ public class Patient extends IdEntity implements Serializable {
    public void setMobileRemarks(String mobileRemarks) {
        this.mobileRemarks = mobileRemarks;
    }
    @Transient
	public String getDiseaseName() {//0健康,1高血压,2糖尿病,3高血压+糖尿病
		if(0==disease) {
			this.diseaseName = "健康";
		}else if(1==disease) {
			this.diseaseName = "高血压";
		}else if(2==disease) {
			this.diseaseName = "糖尿病";
		}else if(3==disease) {
			this.diseaseName = "高血压+糖尿病";
		}else{
			this.diseaseName = "";
		}
		return diseaseName;
	}
	public void setDiseaseName(String diseaseName) {
		this.diseaseName = diseaseName;
	}
	@Transient
	public String getDiseaseConditionName() {
		if(0==diseaseCondition) {
			this.diseaseConditionName = "绿标";
		}else if(1==diseaseCondition) {
			this.diseaseConditionName = "黄标";
		}else if(2==diseaseCondition) {
			this.diseaseConditionName = "红标";
		}else{
			this.diseaseConditionName = "";
		}
		return diseaseConditionName;
	}
	public void setDiseaseConditionName(String diseaseConditionName) {
		this.diseaseConditionName = diseaseConditionName;
	}
}

+ 10 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/SignFamily.java

@ -39,6 +39,7 @@ public class SignFamily extends IdEntity {
    private Date begin;         // 签约开始日期
    private Date end;           // 签约结束日期
    private Integer status;     // 签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约
    private String statusName;
    private String images;      // 签约图片附件URL,多图以逗号分隔
    private String reason;      // 解约原因
    private Date czrq;          // 操作时间
@ -502,4 +503,13 @@ public class SignFamily extends IdEntity {
    public void setReleaseSpeak(String releaseSpeak) {
        this.releaseSpeak = releaseSpeak;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
}

+ 5 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/filter/SessionOutTimeFilter.java

@ -32,6 +32,11 @@ public class SessionOutTimeFilter extends OncePerRequestFilter {
        Object isLogin = httpServletRequest.getSession().getAttribute("isLogin");
        if (isLogin == null || (String) isLogin != "true") {
//            request.setAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME,"请重新登入");
            if(path.indexOf("customer")>-1){
                httpServletResponse.getOutputStream().write("{\"code\":-200}".getBytes());//-200   客服未登录
                return ;
            }
            httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/login");
            return;
        }

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

@ -0,0 +1,69 @@
package com.yihu.wlyy.medicine.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Administrator on 2017/8/14.
 */
@Entity
@Table(name = "wlyy_medicine_key", schema = "", catalog = "medicine")
public class WlyyMedicineKey implements Serializable {
    private Long id;
    private String accessKey;
    private Long addTimestamp;
    private Long expiresIn;
    private Date creataTime;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @Column(name = "access_key", nullable = false)
    public String getAccessKey() {
        return accessKey;
    }
    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }
    @Column(name = "add_timestamp", nullable = false)
    public Long getAddTimestamp() {
        return addTimestamp;
    }
    public void setAddTimestamp(Long addTimestamp) {
        this.addTimestamp = addTimestamp;
    }
    @Column(name = "expires_in", nullable = false)
    public Long getExpiresIn() {
        return expiresIn;
    }
    public void setExpiresIn(Long expiresIn) {
        this.expiresIn = expiresIn;
    }
    @Column(name = "creata_time", nullable = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreataTime() {
        return creataTime;
    }
    public void setCreataTime(Date creataTime) {
        this.creataTime = creataTime;
    }
}

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

@ -0,0 +1,11 @@
package com.yihu.wlyy.medicine.repository;
import com.yihu.wlyy.medicine.entity.WlyyMedicineKey;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/8/14.
 */
public interface WlyyMedicineKeyDao extends PagingAndSortingRepository<WlyyMedicineKey, Long>, JpaSpecificationExecutor<WlyyMedicineKey> {
}

+ 20 - 27
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -5,14 +5,15 @@ import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.SignFamily;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.hos.HosDoctorService;
import com.yihu.wlyy.service.manager.sign.SignFamilyService;
import com.yihu.wlyy.service.manager.sign.FamilyContractService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class CustomerService{
@ -20,45 +21,37 @@ public class CustomerService{
	@Autowired
	private FamilyMemberService familyMemberService;
	@Autowired
	private SignFamilyService signFamilyService;
	private FamilyContractService contractService;
	@Autowired
	private HosDoctorService hosDoctorService;
	public Map<String,Object> findServerInfo(Patient patient) throws Exception {
		Map<String, Object> resp = new HashMap<>();
		//查找家庭成员关系
		JSONArray familyMembers = familyMemberService.getAllFamilyMembers(patient.getCode());
		resp.put("family",familyMembers.toString());
		List<Map<String, Object>> familyMembers = familyMemberService.getAllFamilyMembers(patient.getCode());
		resp.put("family",familyMembers);
		//查询签约信息
		SignFamily signInfo = contractService.findSignByPatient(patient.getCode());
		if(signInfo!=null){
			signInfo.setStatusName("已签约");
		}
		//查询家庭成员的每个签约信息    以及签约医生
		List signFamilys = new ArrayList<SignFamily>();
		List doctors = new ArrayList<Doctor>();
		Iterator<Object> familyMember = familyMembers.iterator();
		while (familyMember.hasNext()) {
			JSONObject jsonObjectbject = (JSONObject) familyMember.next();
			String code = jsonObjectbject.getString("code");//居民code
			SignFamily signFamily = signFamilyService.findByPatientCode(code);
			if(signFamily!=null){
				signFamilys.add(signFamily);
			}
		for(Map<String, Object> familyMember:familyMembers) {
			//查找签约的医生信息
			if(jsonObjectbject.has("doctor")){
				String doctor = jsonObjectbject.getString("doctor");//医生code
				if(StringUtils.isNotBlank(doctor)){
					Doctor doctorInfo = hosDoctorService.getDoctorByCode(doctor);
					if(null!=doctorInfo){
						doctors.add(doctorInfo);
					}
			String doctor = (String) familyMember.get("doctor");//医生code
			if(StringUtils.isNotBlank(doctor)){
				Doctor doctorInfo = hosDoctorService.getDoctorByCode(doctor);
				if(null!=doctorInfo){
					doctors.add(doctorInfo);
				}
			}
		}
		resp.put("signFamilys",signFamilys);
		resp.put("signInfo",signInfo);
		resp.put("doctors",doctors);
		//查找签约医生
		return resp;
	}
}

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

@ -9,12 +9,12 @@ import com.yihu.wlyy.service.manager.sign.FamilyContractService;
import com.yihu.wlyy.util.CommonUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -54,15 +54,14 @@ public class FamilyMemberService extends BaseService {
    }
    /**
     * 获取所有家庭成员,包括自己
     * @param patient
     * @return
     */
    public JSONArray getAllFamilyMembers(String patient){
        JSONArray resultArray = new JSONArray();
        resultArray.put(getPatient(patient));
    public List<Map<String,Object>> getAllFamilyMembers(String patient){
        List<Map<String,Object>> list = new ArrayList<>();
        list.add(getPatient(patient));
        String sql = "select * " +
                " from " +
@ -78,105 +77,82 @@ public class FamilyMemberService extends BaseService {
        if (result != null && result.size() > 0) {
            JSONArray tem = new JSONArray();//存储其他
            for (Map<String, Object> map : result) {
                JSONObject obj = new JSONObject();
                Map<String,Object> map1 = new HashMap();
                SignFamily sign = contractService.findSignByPatient(map.get("code").toString());
                boolean ssSign = false;
                boolean jtSign = false;
                map.put("statusName","未签约");
                if(sign!=null){
                    if (sign.getType() == 1 ) {
                        ssSign = true;
                    } else if (sign.getType() == 2 ) {
                        jtSign = true;
                    }
                    obj.put("doctor",sign.getDoctor());
                    obj.put("doctorName",sign.getDoctorName());
                    map1.put("statusName","已签约");
                    map1.put("doctor",sign.getDoctor());
                    map1.put("doctorName",sign.getDoctorName());
                }
                Integer family_relation = Integer.valueOf(map.get("family_relation").toString());
                obj.put("code", map.get("code"));
                obj.put("name", map.get("name"));
                obj.put("sex", map.get("sex"));
                obj.put("isAuthorize", map.get("is_authorize"));//0:未授权,1:已授权
                obj.put("birthday", map.get("birthday"));
                obj.put("idcard", StringUtils.isEmpty(String.valueOf(map.get("idcard"))) ? "" : map.get("idcard").toString());
                obj.put("photo", map.get("photo"));
                obj.put("mobile", map.get("mobile"));
                obj.put("address", StringUtils.isEmpty(String.valueOf(map.get("address"))) ? "" : map.get("address"));
                obj.put("familyRelation", family_relation);
                obj.put("familyRelationName", relations.get(map.get("family_relation")));
                if (ssSign && jtSign) {
                    obj.put("signType", 3);
                } else if (!ssSign && jtSign) {
                    obj.put("signType", 2);
                } else if (ssSign && !jtSign) {
                    obj.put("signType", 1);
                } else {
                    obj.put("signType", 0);
                }
                map1.put("code", map.get("code"));
                map1.put("name", map.get("name"));
                map1.put("sex", map.get("sex"));
                map1.put("isAuthorize", map.get("is_authorize"));//0:未授权,1:已授权
                map1.put("birthday", map.get("birthday"));
                map1.put("idcard", StringUtils.isEmpty(String.valueOf(map.get("idcard"))) ? "" : map.get("idcard").toString());
                map1.put("photo", map.get("photo"));
                map1.put("mobile", map.get("mobile"));
                map1.put("address", StringUtils.isEmpty(String.valueOf(map.get("address"))) ? "" : map.get("address"));
                map1.put("familyRelation", family_relation);
                map1.put("familyRelationName", relations.get(map.get("family_relation")));
                if(family_relation==0){
                    tem.put(obj);
                    tem.put(map1);
                }else {
                    resultArray.put(obj);
                    list.add(map1);
                }
            }
            if(tem.length()>0){
                for(int i =0;i<tem.length();i++){
                    resultArray.put(tem.get(i));
                if(family_relation==0){
                    tem.put(map1);
                }else {
                    list.add(map1);
                }
            }
        }
        return resultArray;
        return list;
    }
    public JSONObject getPatient(String patient){
    public Map getPatient(String patient){
        Patient p = patientDao.findByCode(patient);
        //查询签约信息
        JSONObject obj = new JSONObject();
        Map map = new HashMap<String,Object>();
        SignFamily sign = contractService.findSignByPatient(p.getCode());
        boolean ssSign = false;
        boolean jtSign = false;
        String doctor = null;
        String doctorName = null;
        map.put("statusName","未签约");
        if (sign != null) {
            if (sign.getType() == 1 ) {
                ssSign = true;
            } else if (sign.getType() == 2 ) {
                jtSign = true;
            }
            doctor = sign.getDoctor();
            doctorName = sign.getDoctorName();
            map.put("statusName","已签约");
        }
        obj.put("doctor",doctor);
        obj.put("doctorName",doctorName);
        obj.put("code", p.getCode());
        obj.put("name", p.getName());
        obj.put("sex", p.getSex());
        obj.put("birthday", p.getBirthday());
        obj.put("isAuthorize", 1);
        map.put("doctor",doctor);
        map.put("doctorName",doctorName);
        map.put("code", p.getCode());
        map.put("name", p.getName());
        map.put("sex", p.getSex());
        map.put("birthday", p.getBirthday());
        map.put("isAuthorize", 1);
        String idCard = StringUtils.isEmpty(p.getIdcard()) ? "" : p.getIdcard();
        obj.put("idcard", CommonUtil.getIdcardEncode(idCard));
        obj.put("idcardAll", idCard);
        obj.put("ssc", p.getSsc());
        obj.put("photo", StringUtils.isEmpty(p.getPhoto()) ? "" : p.getPhoto());
        obj.put("mobile", StringUtils.isEmpty(p.getMobile()) ? "" : p.getMobile());
        obj.put("address", StringUtils.isEmpty(p.getAddress()) ? "" : p.getAddress());
        obj.put("familyRelation", -1);
        obj.put("familyRelationName", "自己");
        obj.put("isAuthorize", 1);//0:未授权,1:已授权
        if (ssSign && jtSign) {
            obj.put("signType", 3);
        } else if (!ssSign && jtSign) {
            obj.put("signType", 2);
        } else if (ssSign && !jtSign) {
            obj.put("signType", 1);
        } else {
            obj.put("signType", 0);
        }
        return obj;
        map.put("idcard", CommonUtil.getIdcardEncode(idCard));
        map.put("idcardAll", idCard);
        map.put("ssc", p.getSsc());
        map.put("photo", StringUtils.isEmpty(p.getPhoto()) ? "" : p.getPhoto());
        map.put("mobile", StringUtils.isEmpty(p.getMobile()) ? "" : p.getMobile());
        map.put("address", StringUtils.isEmpty(p.getAddress()) ? "" : p.getAddress());
        map.put("familyRelation", -1);
        map.put("familyRelationName", "自己");
        map.put("isAuthorize", 1);//0:未授权,1:已授权
        return map;
    }
}

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

@ -0,0 +1,31 @@
package com.yihu.wlyy.service.manager.medicine;
import com.yihu.wlyy.medicine.entity.WlyyMedicineKey;
import com.yihu.wlyy.medicine.repository.WlyyMedicineKeyDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import com.yihu.wlyy.util.query.BasemedicineJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springside.modules.utils.Clock;
import javax.annotation.Resource;
/**
 * Created by Administrator on 2017/8/14.
 */
@Service
public class WlyyMedicineKeyService extends BasemedicineJpaService<WlyyMedicineKey, WlyyMedicineKeyDao> {
    @Autowired
    private WlyyMedicineKeyDao wlyyMedicineKeyDao;
    private Clock clock = Clock.DEFAULT;
    public void saveKey(String key) {
        WlyyMedicineKey medicineKey = new WlyyMedicineKey();
        medicineKey.setAccessKey(key);
        medicineKey.setAddTimestamp(System.currentTimeMillis());
        medicineKey.setExpiresIn(Long.valueOf(14400));
        medicineKey.setCreataTime(clock.getCurrentDate());
        wlyyMedicineKeyDao.save(medicineKey);
    }
}

+ 205 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/query/BasemedicineJpaService.java

@ -0,0 +1,205 @@
package com.yihu.wlyy.util.query;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.metamodel.EntityType;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
 * Created by yww on 2017/08/14.
 * medicine数据库通用查询
 */
@Transactional(propagation = Propagation.SUPPORTS)
public class BasemedicineJpaService<T,R> {
    Class<R> repoClass;
    @PersistenceContext(
            name = "entityManagerMedicine",
            unitName = "threeTimePersistenceUnit"
    )
    protected EntityManager entityManager;
    public BasemedicineJpaService(){
        Type genType = getClass().getGenericSuperclass();
        if ((genType instanceof ParameterizedType)) {
            Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
            if (params.length==2) {
                repoClass = (Class) params[1];
            }
        }
    }
    public T save(T entity) {
        return (T) getRepository().save(entity);
    }
    public T retrieve(Serializable id) {
        return (T) getRepository().findOne(id);
    }
    public void delete(Serializable id) {
        getRepository().delete(id);
    }
    public void delete(T entity) {
        getRepository().delete(entity);
    }
    public void delete(Iterable ids) {
        Iterable list = getRepository().findAll(ids);
        getRepository().delete(list);
    }
    public Class<T> getEntityClass() {
        Type genType = this.getClass().getGenericSuperclass();
        Type[] parameters = ((ParameterizedType) genType).getActualTypeArguments();
        return (Class) parameters[0];
    }
    public List search(String fields, String filters, String sorts, Integer page, Integer size) throws ParseException {
        URLQueryParser queryParser = createQueryParser(fields, filters, sorts);
        CriteriaQuery query = queryParser.makeCriteriaQuery();
        if (page == null || page <= 0) page = 1;
        if (size == null || size <= 0 || size > 10000) size = 15;
        return entityManager
                .createQuery(query)
                .setFirstResult((page - 1) * size)
                .setMaxResults(size)
                .getResultList();
    }
    public List search(String filters) throws ParseException {
        URLQueryParser queryParser = createQueryParser("", filters, "");
        CriteriaQuery query = queryParser.makeCriteriaQuery();
        return entityManager
                .createQuery(query)
                .getResultList();
    }
    public long getCount(String filters) throws ParseException {
        URLQueryParser queryParser = createQueryParser(filters);
        CriteriaQuery query = queryParser.makeCriteriaCountQuery();
        return (long) entityManager.createQuery(query).getSingleResult();
    }
    protected <T> URLQueryParser createQueryParser(String fields, String filters, String orders) {
        URLQueryParser queryParser = new URLQueryParser<T>(fields, filters, orders)
                .setEntityManager(entityManager)
                .setEntityClass(getEntityClass());
        return queryParser;
    }
    protected <T> URLQueryParser createQueryParser(String filters) {
        URLQueryParser queryParser = new URLQueryParser<T>(filters)
                .setEntityManager(entityManager)
                .setEntityClass(getEntityClass());
        return queryParser;
    }
    protected Sort parseSorts(String sorter){
        if (StringUtils.isNotEmpty(sorter)) {
            String[] orderArray = sorter.split(",");
            List<Sort.Order> orderList = new ArrayList<Sort.Order>(orderArray.length);
            Arrays.stream(orderArray).forEach(
                    elem -> orderList.add(
                            elem.startsWith("+") ? new Sort.Order(Sort.Direction.ASC, elem.substring(1)):
                                    new Sort.Order(Sort.Direction.DESC, elem.substring(1))));
            return new Sort(orderList);
        }
        return null;
    }
    protected Session currentSession() {
        return entityManager.unwrap(Session.class);
    }
    public PagingAndSortingRepository getRepository() {
        return (PagingAndSortingRepository) SpringContext.getService(repoClass);
    }
    public JpaRepository getJpaRepository(){
        return (JpaRepository) SpringContext.getService(repoClass);
    }
    public List<T> findByField(String field, Object value){
        return findByFields(
                new String[]{field},
                new Object[]{value}
        );
    }
    public List<T> findByFields(String[] fields, Object[] values){
        CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
        CriteriaQuery query = criteriaBuilder.createQuery(getEntityClass());
        Root<T> root = query.from(getEntityClass());
        List<Predicate> ls = new ArrayList<Predicate>();
        for(int i=0; i< fields.length; i++){
            if(values[i].getClass().isArray())
                ls.add(criteriaBuilder.in(root.get(fields[i]).in((Object[])values[i])));
            else
                ls.add(criteriaBuilder.equal(root.get(fields[i]), values[i]));
        }
        query.where(ls.toArray(new Predicate[ls.size()]));
        return entityManager
                .createQuery(query)
                .getResultList() ;
    }
    public String getClzName(){
        return getEntityClass().getName();
    }
    public String getEntityIdFiled(){
        EntityType entityType = entityManager.getMetamodel().entity(getEntityClass());
        javax.persistence.metamodel.Type type = entityType.getIdType();
        String s = entityType.getId(type.getJavaType()).getName();
        return s;
    }
    public int delete(Object[] ids){
        String hql = " DELETE FROM "+getEntityClass().getName()+" WHERE "+getEntityIdFiled()+" in(:ids)";
        Query query = currentSession().createQuery(hql);
        query.setParameterList("ids", ids);
        return query.executeUpdate();
    }
    public void batchInsert(List list) {
        for (int i = 0; i < list.size(); i++) {
            entityManager.persist(list.get(i));
            if (i % 30 == 0) {
                entityManager.flush();
                entityManager.clear();
            }
        }
    }
}

+ 26 - 0
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -29,6 +29,18 @@ spring:
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    medicine:
      driver-class-name: com.mysql.jdbc.Driver
      max-active: 10
      max-idle: 10
      min-idle: 6
      idle-timeout: 3000
      testOnBorrow: true
      validationQuery: SELECT 1
      num-tests-per-eviction-run: 10 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  jpa:
    database-platform: org.hibernate.dialect.MySQL5Dialect
    hibernate.dialect: org.hibernate.dialect.MySQL5Dialect
@ -46,6 +58,10 @@ spring:
      url: jdbc:mysql://172.19.103.85:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    medicine:
      url: jdbc:mysql://172.19.103.77:3306/medicine?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  sms: # SMS短信配置
    yihu_sms_url: https://smsapi.ums86.com:9600/sms/Api/Send.do
    yihu_sms_code: 229336
@ -70,11 +86,17 @@ spring:
      url: jdbc:mysql://172.19.103.77:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    medicine:
      url: jdbc:mysql://172.19.103.77:3306/medicine?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  sms: # SMS短信配置
    yihu_sms_url: https://smsapi.ums86.com:9600/sms/Api/Send.do
    yihu_sms_code: 229336
    yihu_sms_name: jkzldxjr
    yihu_sms_password: jkzldxjrpwd123
service-gateway:
  update-team-url: http://172.19.103.87:8011/wlyy_service/third/doctor/LoadTeamInfo
im-service:
@ -94,6 +116,10 @@ spring:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    medicine:
      url: jdbc:mysql://172.19.103.77:3306/medicine?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  sms: # SMS短信配置
    yihu_sms_url: https://smsapi.ums86.com:9600/sms/Api/Send.do
    yihu_sms_code: 229336

+ 2 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -121,6 +121,7 @@ public class PrescriptionController extends BaseController{
									@RequestParam(value = "doctor",required = true) String doctor)
	{
		try {
			doctor = "hxmD201703150222";
			String re = prescriptionService.getRecipeTemplate(doctor);
			return Result.success("处方模板获取接口!",re);
@ -142,7 +143,7 @@ public class PrescriptionController extends BaseController{
								@RequestParam(value = "applyTimeEnd",required = false) String applyTimeEnd)
	{
		try {
//			cardNo = "D40612663";
			cardNo = "D40612663";
			String re = prescriptionService.getLastRecipe(cardNo,recipeNo,applyTimeFrom,applyTimeEnd);
			return Result.success("调阅历史处方接口!",re);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 55 - 11
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -33,7 +34,6 @@ import java.util.Map;
 * Created by yeshijie on 2017/8/3.
 */
@Service
@Transactional
public class PrescriptionService extends ZysoftBaseService{
    private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
@ -62,6 +62,8 @@ public class PrescriptionService extends ZysoftBaseService{
    private PrescriptionPayDao prescriptionPayDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${redisChannel.prescription}")
    private String channelTopic;
@ -93,6 +95,7 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 接收线下处方调整完成消息
     */
    @Transactional
    public Result prescriptionAdjustCompleted(String jsonObject){
        String error = null;
        String status = "1";
@ -183,6 +186,7 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 接收预结算完成消息
     */
    @Transactional
    public Result prePayCompletion(String jsonObject){
        String error = null;
        String status = "1";
@ -348,22 +352,61 @@ public class PrescriptionService extends ZysoftBaseService{
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        //获取基位医生code
        String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(code,hospital);
        String sql = "SELECT dept_code from zy_iv_dept_staff_allot_dict WHERE staff_code = ? and org_code=? ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,jwdoctor,hospital);
        String staffCode = null;
        String deptCode = null;
        com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
        //获取医生不同科室的处方模板
        for(Map<String,Object> map:list){
            Map<String,String> header = new HashMap<>();
            header.put("ORGCODE",hospital);
            header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("staffCode",staffCode);
        params.put("deptCode",deptCode);
            Map<String,String> params = new HashMap<>();
            params.put("staffCode",jwdoctor);
            params.put("deptCode",map.get("dept_code").toString());
        String response = postSecond("getRecipeTemplate","处方模板获取接口",params,null,header,false,2);
            String res = postSecond("getRecipeTemplate","处方模板获取接口",params,null,header,false,2);
        return response;
            com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(res);
            ja.add(json);
        }
        //整合成一个json对象
        if(ja.size()==0){
            return null;
        }
        if(ja.size()==1){
            return ja.get(0).toString();
        }
        com.alibaba.fastjson.JSONObject jsonObject = null;
        for(int i =0;i<ja.size();i++){
            com.alibaba.fastjson.JSONObject json = ja.getJSONObject(i);
            if("1".equals(json.getString("CODE"))){
                if(jsonObject==null){
                    jsonObject = json;
                }else {
                    com.alibaba.fastjson.JSONArray returnData = json.getJSONArray("returnData");
                    if(returnData.size()>0){
                        com.alibaba.fastjson.JSONArray jsonArray = jsonObject.getJSONArray("returnData").getJSONArray(0);
                        for(int j=0;j<returnData.getJSONArray(0).size();j++){
                            com.alibaba.fastjson.JSONObject temp = returnData.getJSONArray(0).getJSONObject(j);
                            jsonArray.add(temp);
                        }
                    }
                }
            }
        }
        if(jsonObject==null){
            return ja.get(0).toString();
        }
        return jsonObject.toString();
    }
    /**
     * 调阅历史处方接口
     * @param cardNo 社保卡号
@ -412,6 +455,7 @@ public class PrescriptionService extends ZysoftBaseService{
     * @return
     * @throws Exception
     */
    @Transactional
    public String saveRecipe(String prescriptionCode)  throws Exception
    {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 48 - 51
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java


+ 79 - 47
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.consult;
import com.yihu.wlyy.adapter.PresModeAdapter;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamDoctor;
@ -35,6 +36,7 @@ import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionLogService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.service.third.jw.ZyDictService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
@ -133,6 +135,10 @@ public class ConsultTeamService extends ConsultService {
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    @Autowired
    private PresModeAdapter presModeAdapter;
    @Autowired
    private ZyDictService zyDictService;
    Map<Integer, String> relations = new HashMap<>();
@ -1024,11 +1030,10 @@ public class ConsultTeamService extends ConsultService {
     * @param reason
     * @return
     */
    public String savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason) throws Exception{
        String re = "";
    public void savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason) throws Exception{
        //获取智业处方详细
//        String response = jwPrescriptionService.getRecipe(jwCode,p.getSsc());
//        JSONObject jsonObject =
        String response = jwPrescriptionService.getRecipe(jwCode,p.getSsc());
        com.alibaba.fastjson.JSONObject jsonObject = presModeAdapter.modelToSinglePrescription(response);
        //续方主表
        prescription.setCode(getCode());
@ -1049,51 +1054,68 @@ public class ConsultTeamService extends ConsultService {
        prescription.setType(PrescriptionLog.PrescriptionLogType.create.getValue());
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.revieweding.getValue());
        prescription.setConsult(ct.getConsult());
        //保存智业的医生信息
        Map<String,Object> map = zyDictService.findJwDoctorByDoctor(doctor.getCode());
        if(map!=null){
            prescription.setJwDoctorCode(map.get("jw_doctor").toString());
            prescription.setJwHospital(map.get("jw_doctor_hospital").toString());
        }
        prescriptionDao.save(prescription);
        //保存续方药品(处方)信息
        PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
        prescriptionInfo.setPrescriptionCode(prescription.getCode());
        prescriptionInfo.setCode(getCode());
        prescriptionInfo.setDel(1);
        prescriptionInfo.setDirection("口服");//药品用法
        prescriptionInfo.setDrugCode("药品code");//药品code
        prescriptionInfo.setDrugName("药品名称");//药品名称
        prescriptionInfo.setDrugRate("每次1.25mg    q.d.");//吃药频率
        prescriptionInfo.setDrugFormat("2.5mg*80片/盒");//药品规格
        prescriptionInfo.setNum(10);//药品数目
        prescriptionInfo.setPrice(10);//药品单价
        prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
        prescriptionInfo.setJwSubCode("");//智业子处方号
        prescriptionInfo.setDrugNumUnit("");//数量单位编码
        prescriptionInfo.setDrugNumUnitName("");//数量单位名称
        prescriptionInfo.setCost(1);//金额
        prescriptionInfo.setCharge(0);//自付
        prescriptionInfo.setBindFlag("0");//成组标志, 0.非成组,1.成组
        prescriptionInfo.setDayCount(2);//用药天数
        prescriptionInfo.setDrugUsage("");//用药方法编码
        prescriptionInfo.setUsageName("");//用药方法名称
        prescriptionInfo.setPhysicDose("");//用药剂量
        prescriptionInfo.setPhysicDoseUnit("");//剂量单位编码
        prescriptionInfo.setPhysicDoseUnitName("");//剂量单位名称
        prescriptionInfo.setPhysicAmount("");//用药总量
        prescriptionInfo.setPhysicAmountUnit("");//总量单位编码
        prescriptionInfo.setPhysicAmountUnitName("");//总量单位名称
        prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
        prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
        prescriptionInfo.setPhysicSkinTest("");//注射地点名称
        prescriptionInfo.setPhysicSkinTestName("");//皮试类型名称
        prescriptionInfo.setRemark("");//备注
        prescriptionInfoDao.save(prescriptionInfo);
        com.alibaba.fastjson.JSONArray infos = jsonObject.getJSONArray("prescriptionInfo");
        for(int i=0;i<infos.size();i++){
            com.alibaba.fastjson.JSONObject info = infos.getJSONObject(i);
            PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
            prescriptionInfo.setPrescriptionCode(prescription.getCode());
            prescriptionInfo.setCode(getCode());
            prescriptionInfo.setDel(1);
            prescriptionInfo.setDirection(info.getString("USAGE_NAME"));//药品用法
            prescriptionInfo.setDrugCode(info.getString("drugCode"));//药品code
            prescriptionInfo.setDrugName(info.getString("drugName"));//药品名称
            prescriptionInfo.setDrugRate(info.getString("drugRate"));//吃药频率
            prescriptionInfo.setDrugFormat(info.getString("drugFormat"));//药品规格
            prescriptionInfo.setNum(doubleToInt(info.getDouble("num")));//药品数目
            prescriptionInfo.setPrice(doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
            prescriptionInfo.setJwSubCode("");//智业子处方号
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setCost(doubleToInt(info.getDouble("cost")));//金额
            prescriptionInfo.setCharge(doubleToInt(info.getDouble("charge")));//自付
            prescriptionInfo.setBindFlag(info.getString("bindFlag"));//成组标志, 0.非成组,1.成组
            prescriptionInfo.setDayCount(info.getInteger("dayCount"));//用药天数
            prescriptionInfo.setDrugUsage(info.getString("drugUsage"));//用药方法编码
            prescriptionInfo.setUsageName(info.getString("usageName"));//用药方法名称
            prescriptionInfo.setPhysicDose(info.getString("physicDose"));//用药剂量
            prescriptionInfo.setPhysicDoseUnit(info.getString("physicDoseUnit"));//剂量单位编码
            prescriptionInfo.setPhysicDoseUnitName(info.getString("physicDoseUnitName"));//剂量单位名称
            prescriptionInfo.setPhysicAmount(info.getString("physicAmount"));//用药总量
            prescriptionInfo.setPhysicAmountUnit(info.getString("physicAmount"));//总量单位编码
            prescriptionInfo.setPhysicAmountUnitName(info.getString("physicAmountUnitName"));//总量单位名称
            prescriptionInfo.setPhysicInjectPlace(info.getString("physicInjectPlace"));//注射地点编码
            prescriptionInfo.setPhysicInjectPlaceName(info.getString("physicInjectPlaceName"));//注射地点名称
            prescriptionInfo.setPhysicSkinTest(info.getString("physicSkinTest"));//注射地点名称
            prescriptionInfo.setPhysicSkinTestName(info.getString("physicSkinTestName"));//皮试类型名称
            prescriptionInfo.setRemark(info.getString("Remark"));//备注
            prescriptionInfoDao.save(prescriptionInfo);
        }
        //保存续方疾病类型
        PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();
        diagnosis.setCode("1");
        diagnosis.setPrescriptionCode(prescription.getCode());
        diagnosis.setCreateTime(new Date());
        diagnosis.setName("高血压");
        diagnosis.setUpdateTime(new Date());
        prescriptionDiagnosisDao.save(diagnosis);
        com.alibaba.fastjson.JSONArray jaDiagnosis = jsonObject.getJSONArray("prescriptionDt");
        for (Iterator iterator = jaDiagnosis.iterator(); iterator.hasNext();) {
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) iterator.next();
            PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();
            diagnosis.setCode(json.getString("code"));
            diagnosis.setPrescriptionCode(prescription.getCode());
            diagnosis.setCreateTime(new Date());
            diagnosis.setName(json.getString("name"));
            diagnosis.setHealthProblemName(json.getString("healthProblemName"));
            diagnosis.setHealthProblem(json.getString("healthProblem"));
            diagnosis.setUpdateTime(new Date());
            prescriptionDiagnosisDao.save(diagnosis);
        }
        //保存审核信息
        PrescriptionReviewed reviewed = new PrescriptionReviewed();
@ -1107,11 +1129,21 @@ public class ConsultTeamService extends ConsultService {
        reviewed.setHospitalName(prescription.getHospitalName());
        prescriptionReviewedDao.save(reviewed);
        re +=diagnosis.getName();
        //添加保存日志
        prescriptionLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.create.getValue(),1,1);
        return re;
    }
    /**
     * double*100转int
     * @param d
     * @return
     */
    private Integer doubleToInt(Double d){
        if(d==null){
            return 0;
        }
        return new Double(d*100).intValue();
    }
    /**

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

@ -27,7 +27,6 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -1062,7 +1061,7 @@ public class PrescriptionInfoService extends BaseService {
     */
    public com.alibaba.fastjson.JSONArray getPrescriptionTemp(String doctor)throws Exception{
        String rp = jwPrescriptionService.getRecipeTemplate(doctor);
        com.alibaba.fastjson.JSONArray rs =  presModeAdapter.modeToPrescription(rp);
        com.alibaba.fastjson.JSONArray rs =  presModeAdapter.modeTopresInfo(rp);
        return rs;
    }

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -65,6 +65,27 @@ public class ZyDictService {
        return doctorMappingDao.getDoctorByJw(jwHospital,jwDoctor);
    }
    /**
     * 根据医生code获取
     * @param doctor
     * @return
     */
    public Map<String, Object> findJwDoctorByDoctor(String doctor){
        String sql = "SELECT dm.doctor_code," +
                " dm.jw_doctor," +
                " dm.jw_doctor_name," +
                " dm.jw_doctor_hospital," +
                " dm.jw_doctor_hospital_name" +
                " from wlyy_doctor_mapping dm " +
                " WHERE dm.doctor_code = ? " +
                " ORDER BY dm.id desc";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql,doctor);
        if(list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    /**
     * 获取药品字典
     * @param doctor

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

@ -345,7 +345,8 @@ public class PrescriptionInfoController extends BaseController{
    @ApiOperation(value = "获取调整处方模板")
    public String getPrescriptionTemp(){
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp(getUID()));
//            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp(getUID()));
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp("1"));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");