diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java index ea0394b..207b129 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java @@ -7,15 +7,17 @@ import com.lyms.platform.common.constants.ErrorCodeConstants; import com.lyms.platform.common.result.BaseListResponse; import com.lyms.platform.common.result.BaseObjectResponse; import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.common.utils.BeanUtils; +import com.lyms.platform.common.utils.ExcelUtil; +import com.lyms.platform.common.utils.ExceptionUtils; import com.lyms.platform.common.utils.SystemConfig; import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; import com.lyms.platform.operate.web.facade.BasicConfigFacade; import com.lyms.platform.operate.web.facade.PatientFacade; -import com.lyms.platform.operate.web.facade.PuerperaManagerFacade; import com.lyms.platform.operate.web.request.*; import com.lyms.platform.operate.web.result.BasicConfigResult; -import com.lyms.platform.operate.web.utils.HiskCountTask; -import com.lyms.platform.pojo.BasicConfig; +import com.lyms.platform.operate.web.result.PatientManagerQueryModel; +import com.lyms.platform.operate.web.result.PatientManagerResult; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -24,12 +26,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; +import java.util.*; /** * 孕产妇管理接口 @@ -264,4 +261,62 @@ public class PuerperaManageController extends BaseController { LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); return patientFacade.queryHighRisk(patientsQueryRequest,null,1,loginState.getId(),"true",Boolean.TRUE); } + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 15时03分 + * @discription 建档管理 + */ + @TokenRequired + @ResponseBody + @RequestMapping(value = "patientManager", method = RequestMethod.POST) + public BaseListResponse patientManager(@RequestBody PatientManagerRequest patientManagerRequest, HttpServletRequest httpServletRequest) { + BaseListResponse baseListResponse; + try { + patientManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId()); + PatientManagerResult patientManagerResult = patientFacade.patientManager(patientManagerRequest); + if (patientManagerResult.getErrorcode() != ErrorCodeConstants.SUCCESS) { + baseListResponse = new BaseListResponse().setErrorcode(patientManagerResult.getErrorcode()).setErrormsg(patientManagerResult.getErrormsg()); + return baseListResponse; + } + baseListResponse = new BaseListResponse().setErrorcode(patientManagerResult.getErrorcode()).setErrormsg(patientManagerResult.getErrormsg()).setData(patientManagerResult.getData()).setPageInfo(patientManagerResult.getPageInfo()); + } catch (Exception e) { + baseListResponse = new BaseListResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); + ExceptionUtils.catchException(e, "patientManager异常"); + } + return baseListResponse; + } + + @TokenRequired + @RequestMapping(value = "patientManagerExcel", method = RequestMethod.POST) + public void patientManagerExcel(HttpServletRequest httpServletRequest, @RequestBody PatientManagerRequest patientManagerRequest, HttpServletResponse httpServletResponse) { + try { + patientManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId()); + // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据 + @SuppressWarnings("unchecked") + List patientManagerQueryModelList = patientFacade.patientManager(patientManagerRequest).getData(); + List> list = new ArrayList<>(); + for (PatientManagerQueryModel patientManagerQueryModel : patientManagerQueryModelList) { + Map map = BeanUtils.objectToObjectMap(patientManagerQueryModel); + list.add(map); + } + Map header = new LinkedHashMap<>(); + header.put("username", "姓名"); + header.put("age", "年龄"); + header.put("phone", "联系电话"); + header.put("cardNo", "证件号码"); + header.put("addressRegister", "户口所在地"); + header.put("husbandName", "丈夫姓名"); + header.put("husbandAddressRegister", "丈夫户口所在地"); + header.put("bookbuildingDate", "建档时间"); + header.put("bookbuildingDoctor", "建档医生"); + header.put("serviceType", "服务类型"); + httpServletResponse.setContentType("application/force-download"); + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("建档管理.xls").getBytes("UTF-8"), "ISO-8859-1")); + ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header); + } catch (Exception e) { + ExceptionUtils.catchException(e, "childbirthManagerExcel异常"); + } + } + } \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java index 769c3a0..2da6da5 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java @@ -748,4 +748,64 @@ public class PatientFacade { return str; } + + public PatientManagerResult patientManager(PatientManagerRequest patientManagerRequest) { + PatientManagerResult patientManagerResult = new PatientManagerResult(); + + PatientsQuery patientsQuery = new PatientsQuery(); + patientsQuery.setYn(YnEnums.YES.getId()); + patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(patientManagerRequest.getOperatorId())); + patientsQuery.setProvinceRegisterId(StringUtils.isEmpty(patientManagerRequest.getProvinceRegisterId()) ? null : patientManagerRequest.getProvinceRegisterId()); + patientsQuery.setCityRegisterId(StringUtils.isEmpty(patientManagerRequest.getCityRegisterId()) ? null : patientManagerRequest.getCityRegisterId()); + patientsQuery.setAreaRegisterId(StringUtils.isEmpty(patientManagerRequest.getAreaRegisterId()) ? null : patientManagerRequest.getAreaRegisterId()); + patientsQuery.setNeed("need"); + if (StringUtils.isNotEmpty(patientManagerRequest.getBookBuildingDate())) { + try { + patientsQuery.setBookbuildingDateStart(DateUtil.getSNDate(patientManagerRequest.getBookBuildingDate())[0]); + patientsQuery.setBookbuildingDateEnd(DateUtil.getSNDate(patientManagerRequest.getBookBuildingDate())[1]); + } catch (Exception e) { + // 什么都不做,这里是数据传入错误了 + } + } + patientsQuery.setName(StringUtils.isEmpty(patientManagerRequest.getUserName()) ? null : patientManagerRequest.getUserName()); + patientsQuery.setCardNo(StringUtils.isEmpty(patientManagerRequest.getCardNo()) ? null : patientManagerRequest.getCardNo()); + patientsQuery.setPhone(StringUtils.isEmpty(patientManagerRequest.getPhone()) ? null : patientManagerRequest.getPhone()); + + List patientsList = patientsService.queryPatient(patientsQuery); + List patientManagerQueryModelList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(patientsList)) { + for (Patients patients : patientsList) { + PatientManagerQueryModel patientManagerQueryModel = new PatientManagerQueryModel(); + BeanUtils.copy(patients, patientManagerQueryModel); + patientManagerQueryModel.setAge(DateUtil.getAge(patients.getBirth())); + switch (patients.getBuildType()) { + case 0: + patientManagerQueryModel.setServiceType("未分娩建档"); + break; + case 1: + patientManagerQueryModel.setServiceType("儿童建档时建档"); + break; + case 2: + patientManagerQueryModel.setServiceType("自动分娩类型"); + break; + case 3: + patientManagerQueryModel.setServiceType("转诊自动建档"); + break; + default: + patientManagerQueryModel.setServiceType(""); + } + patientManagerQueryModel.setBookbuildingDoctor(StringUtils.isEmpty(patients.getBookbuildingDoctor()) ? "" : usersService.getUsers(Integer.valueOf(patients.getBookbuildingDoctor())).getName()); + patientManagerQueryModel.setBookbuildingDate(DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate())); + patientManagerQueryModel.setAddressRegister(CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService)); + patientManagerQueryModel.setHusbandAddressRegister(CommonsHelper.getResidence(patients.getHprovinceRegisterId(), patients.getHcityRegisterId(), patients.getHareaRegisterId(), patients.getHstreetRegisterId(), patients.getHaddressRegister(), basicConfigService)); + patientManagerQueryModelList.add(patientManagerQueryModel); + } + } + + patientManagerResult.setPageInfo(patientsQuery.getPageInfo()); + patientManagerResult.setData(patientManagerQueryModelList); + patientManagerResult.setErrorcode(ErrorCodeConstants.SUCCESS); + patientManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); + return patientManagerResult; + } } \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientManagerRequest.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientManagerRequest.java new file mode 100644 index 0000000..2ada7f8 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientManagerRequest.java @@ -0,0 +1,126 @@ +package com.lyms.platform.operate.web.request; + +/** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时33分 + * @discription + */ +public class PatientManagerRequest extends BasePageQueryRequest { + + private Integer operatorId; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时59分 + * @discription 户口所在地省id + */ + private String provinceRegisterId; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时59分 + * @discription 户口所在地市id + */ + private String cityRegisterId; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时59分 + * @discription 户口所在地区县id + */ + private String areaRegisterId; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时59分 + * @discription 建档日期 + */ + private String bookBuildingDate; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时59分 + * @discription 姓名 + */ + private String userName; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 15时00分 + * @discription 证件号 + */ + private String cardNo; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 15时00分 + * @discription 联系方式 + */ + private String phone; + + // 条码号暂时不管 + + public String getProvinceRegisterId() { + return provinceRegisterId; + } + + public void setProvinceRegisterId(String provinceRegisterId) { + this.provinceRegisterId = provinceRegisterId; + } + + public String getCityRegisterId() { + return cityRegisterId; + } + + public void setCityRegisterId(String cityRegisterId) { + this.cityRegisterId = cityRegisterId; + } + + public String getAreaRegisterId() { + return areaRegisterId; + } + + public void setAreaRegisterId(String areaRegisterId) { + this.areaRegisterId = areaRegisterId; + } + + public String getBookBuildingDate() { + return bookBuildingDate; + } + + public void setBookBuildingDate(String bookBuildingDate) { + this.bookBuildingDate = bookBuildingDate; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Integer getOperatorId() { + return operatorId; + } + + public void setOperatorId(Integer operatorId) { + this.operatorId = operatorId; + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientManagerQueryModel.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientManagerQueryModel.java new file mode 100644 index 0000000..1a92c9e --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientManagerQueryModel.java @@ -0,0 +1,159 @@ +package com.lyms.platform.operate.web.result; + +/** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时35分 + * @discription + */ +public class PatientManagerQueryModel { + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 姓名 + */ + private String username; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 年龄 + */ + private Integer age; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 联系电话 + */ + private String phone; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 证件号码 + */ + private String cardNo; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 户口所在地 + */ + private String addressRegister; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 丈夫姓名 + */ + private String husbandName; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时42分 + * @discription 丈夫户口所在地 + */ + private String husbandAddressRegister; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时43分 + * @discription 建档时间 + */ + private String bookbuildingDate; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时43分 + * @discription 建档医生 + */ + private String bookbuildingDoctor; + + /** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时43分 + * @discription 服务类型 + */ + private String serviceType; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } + + public String getHusbandName() { + return husbandName; + } + + public void setHusbandName(String husbandName) { + this.husbandName = husbandName; + } + + public String getAddressRegister() { + return addressRegister; + } + + public void setAddressRegister(String addressRegister) { + this.addressRegister = addressRegister; + } + + public String getHusbandAddressRegister() { + return husbandAddressRegister; + } + + public void setHusbandAddressRegister(String husbandAddressRegister) { + this.husbandAddressRegister = husbandAddressRegister; + } + + public String getBookbuildingDate() { + return bookbuildingDate; + } + + public void setBookbuildingDate(String bookbuildingDate) { + this.bookbuildingDate = bookbuildingDate; + } + + public String getBookbuildingDoctor() { + return bookbuildingDoctor; + } + + public void setBookbuildingDoctor(String bookbuildingDoctor) { + this.bookbuildingDoctor = bookbuildingDoctor; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientManagerResult.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientManagerResult.java new file mode 100644 index 0000000..2afca60 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientManagerResult.java @@ -0,0 +1,11 @@ +package com.lyms.platform.operate.web.result; + +import com.lyms.platform.common.result.BaseListResponse; + +/** + * @auther HuJiaqi + * @createTime 2016年12月20日 14时34分 + * @discription + */ +public class PatientManagerResult extends BaseListResponse { +}