| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/selectPatMedOuthospList") |
| | | @ApiOperation("查询患者门诊记录列表") |
| | | public TableDataInfo selectPatMedOuthosplist(@RequestBody PatMedOuthosp patMedOuthosp) { |
| | | PageUtils.startPageByPost(patMedOuthosp.getPageNum(), patMedOuthosp.getPageSize()); |
| | | public Map<String, Object> selectPatMedOuthosplist(@RequestBody PatMedOuthosp patMedOuthosp) { |
| | | patMedOuthosp.setPageNum(PageUtils.getOffset(patMedOuthosp.getPageNum(), patMedOuthosp.getPageSize())); |
| | | SysUser user = getLoginUser().getUser(); |
| | | patMedOuthosp.setOrgid(user.getOrgid()); |
| | | List<PatMedOuthosp> list = patMedOuthospService.selectPatMedOuthospList(patMedOuthosp); |
| | | return getDataTable(list); |
| | | patMedOuthosp.setPageNum(null); |
| | | patMedOuthosp.setPageSize(null); |
| | | List<PatMedOuthosp> patMedOuthosps = patMedOuthospService.selectPatMedOuthospList(patMedOuthosp); |
| | | Integer count = 0; |
| | | if (CollectionUtils.isNotEmpty(patMedOuthosps)) count = patMedOuthosps.size(); |
| | | return getDataTable3(count, list); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 患者门诊记录 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = "selectPatMedOuthospList", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#patMedOuthosp.toString().getBytes())", unless = "#result == null or #result.isEmpty()") |
| | | public List<PatMedOuthosp> selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) { |
| | | List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp); |
| | | for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) { |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid()); |
| | | if (patArchive.getBirthdate() != null) { |
| | | Map<String, String> map = calculateAge(patArchive.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); |
| | | patArchive.setAge(ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | patArchive.setAgeUnit(map.get("ageUnit")); |
| | | patArchive.setAge2(ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | patArchive.setAgeUnit2(map.get("ageUnit2")); |
| | | patMedOuthosp1.setAge(patArchive.getAge() + patArchive.getAgeUnit() + patArchive.getAge2() + patArchive.getAgeUnit2()); |
| | | patMedOuthosp1.setTelcode(patArchive.getTelcode()); |
| | | patMedOuthosp1.setIdcardno(patArchive.getIdcardno()); |
| | | if (patMedOuthosp.getPageNum() != null) { |
| | | for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) { |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid()); |
| | | if (patArchive.getBirthdate() != null) { |
| | | Map<String, String> map = calculateAge(patArchive.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); |
| | | patArchive.setAge(ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | patArchive.setAgeUnit(map.get("ageUnit")); |
| | | patArchive.setAge2(ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | patArchive.setAgeUnit2(map.get("ageUnit2")); |
| | | patMedOuthosp1.setAge(patArchive.getAge() + patArchive.getAgeUnit() + patArchive.getAge2() + patArchive.getAgeUnit2()); |
| | | patMedOuthosp1.setTelcode(patArchive.getTelcode()); |
| | | patMedOuthosp1.setIdcardno(patArchive.getIdcardno()); |
| | | } |
| | | ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO(); |
| | | serviceSubtaskVO.setPatid(patMedOuthosp1.getPatid()); |
| | | List<Long> sendstates = new ArrayList<>(); |
| | | sendstates.add(1L); |
| | | sendstates.add(2L); |
| | | sendstates.add(3L); |
| | | serviceSubtaskVO.setSendstates(sendstates); |
| | | serviceSubtaskVO.setServiceType("3"); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO); |
| | | if (!CollectionUtils.isEmpty(serviceSubtaskList)) patMedOuthosp1.setServerState("1"); |
| | | } |
| | | ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO(); |
| | | serviceSubtaskVO.setPatid(patMedOuthosp1.getPatid()); |
| | | List<Long> sendstates = new ArrayList<>(); |
| | | sendstates.add(1L); |
| | | sendstates.add(2L); |
| | | sendstates.add(3L); |
| | | serviceSubtaskVO.setSendstates(sendstates); |
| | | serviceSubtaskVO.setServiceType("3"); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO); |
| | | if (!CollectionUtils.isEmpty(serviceSubtaskList)) patMedOuthosp1.setServerState("1"); |
| | | } |
| | | return patMedOuthosps; |
| | | } |
| | |
| | | resultMap="PatMedOuthospResult"> |
| | | select |
| | | pmo.id, |
| | | pmo.campusid, |
| | | pmo.remark, |
| | | pmo.fudate, |
| | | pmo.server_state, |
| | | pmo.outhospno, |
| | | pmo.diagcheck_flag, |
| | | pmo.patno, |
| | | pmo.serialnum, |
| | | pmo.patid, |
| | | pmo.hospitalname, |
| | | pmo.hospitalcode, |
| | | pmo.icd10code, |
| | | pmo.diagname, |
| | | pmo.deptcode, |
| | |
| | | pmo.drcode, |
| | | pmo.drname, |
| | | pmo.admitdate, |
| | | pmo.orgid, |
| | | pmo.del_flag, |
| | | pmo.guid, |
| | | pmo.update_by, |
| | | pmo.update_time, |
| | | pmo.create_by, |
| | | pmo.create_time, |
| | | pmo.isupload, |
| | | pmo.upload_time, |
| | | pmo.schemestatus, |
| | | pmo.deptid, |
| | | pmo.schemetime, |
| | | pmo.hpi, |
| | | pmo.fuflag, |
| | | pmo.patname, |
| | | pmo.update_time, |
| | | pmo.mainsuit |
| | | from pat_med_outhosp pmo |
| | | where 1=1 |
| | | and pmo.del_flag=0 |
| | | <where>pmo.del_flag='0' |
| | | <if test="orgid != null ">and pmo.orgid = #{orgid}</if> |
| | | <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if> |
| | | <if test="serverState != null ">and pmo.server_state = #{serverState}</if> |
| | |
| | | <if test="outhospno != null and outhospno != ''">and pmo.outhospno = #{outhospno}</if> |
| | | <if test="diagcheckFlag != null and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if> |
| | | <if test="diagname != null and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if> |
| | | </where> |
| | | order by pmo.update_time desc |
| | | <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if> |
| | | </select> |
| | | |
| | | <select id="selectPatMedOuthospById" parameterType="Long" resultMap="PatMedOuthospResult"> |
| | |
| | | FROM |
| | | pat_med_outhosp |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | <if test="orgid != null"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | and date_format(admitdate,'%y%m%d') >= date_format(#{startDate},'%y%m%d') |
| | | and date_format(admitdate,'%y%m%d') <= date_format(#{endDate},'%y%m%d') |
| | | <if test="deptcodeList != null and deptcodeList.size()>0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | and del_flag = 0 |
| | | <if test="orgid != null"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | and date_format(admitdate,'%y%m%d') >= date_format(#{startDate},'%y%m%d') |
| | | and date_format(admitdate,'%y%m%d') <= date_format(#{endDate},'%y%m%d') |
| | | <if test="deptcodeList != null and deptcodeList.size()>0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | union all |
| | | select |
| | | 0 AS rc, |
| | |
| | | FROM |
| | | service_subtask |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | and service_type=3 |
| | | <if test="orgid != null"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' ) |
| | | </if> |
| | | <if test="endDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) <= date_format(#{endDate},'%y%m%d') |
| | | </if> |
| | | <if test="deptcodeList != null and deptcodeList.size()>0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | and del_flag = 0 |
| | | and service_type=3 |
| | | <if test="orgid != null"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' ) |
| | | </if> |
| | | <if test="endDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) <= date_format(#{endDate},'%y%m%d') |
| | | </if> |
| | | <if test="deptcodeList != null and deptcodeList.size()>0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) AS combined_data |
| | | </select> |
| | | |
| | |
| | | SELECT deptname, COUNT(1) AS rc |
| | | FROM pat_med_outhosp |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="inhospstate != null"> |
| | | and inhospstate= #{inhospstate} |
| | | </if> |
| | | <if test="serverState != null"> |
| | | and server_state= #{inhospstate} |
| | | </if> |
| | | <if test="deptcodeList != null and deptcodeList.size()>0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | and del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="inhospstate != null"> |
| | | and inhospstate= #{inhospstate} |
| | | </if> |
| | | <if test="serverState != null"> |
| | | and server_state= #{inhospstate} |
| | | </if> |
| | | <if test="deptcodeList != null and deptcodeList.size()>0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- PatMedOuthospMapper.xml --> |