fix: 폐기보고통계 - 마약류구분별통계

dev
Jonguk. Lim 4 months ago
parent 4ae576369d
commit 096e174f6b

@ -22,8 +22,14 @@ public interface DsuseMgtStatisticsMapper extends AbstractMapper {
/** /**
* *
* @return / and / * @return
*/ */
List<DataObject> selectDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query); List<DataObject> selectDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query);
/**
*
* @return
*/
List<DataObject> selectDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query);
} }

@ -13,4 +13,5 @@ public interface AddsNimsService {
List<DataObject> getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query); List<DataObject> getDsuseMgtNcrdAndPrtmStatistics(DsuseMgtStatisticsQuery query);
List<DataObject> getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query); List<DataObject> getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query);
List<DataObject> getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query);
} }

@ -47,4 +47,9 @@ public class AddsNimsServiceBean extends AbstractServiceBean implements AddsNims
public List<DataObject> getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query) { public List<DataObject> getDsuseMgtDsuseQyByPrdStatistics(DsuseMgtStatisticsQuery query) {
return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByPrdStatistics(query); return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByPrdStatistics(query);
} }
@Override
public List<DataObject> getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) {
return dsuseMgtStatisticsMapper.selectDsuseMgtDsuseQyByBsshStatistics(query);
}
} }

@ -443,7 +443,56 @@ public class AddsNimsController extends ApplicationController {
xlsx.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList())); xlsx.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList()));
ModelAndView mav = new ModelAndView("downloadView"); ModelAndView mav = new ModelAndView("downloadView");
mav.addObject("download", xlsx.getDownloadable().setFilename("폐기보고 통계.xlsx")); mav.addObject("download", xlsx.getDownloadable().setFilename("제품별 폐기 현황.xlsx"));
return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList());
}
@RequestMapping(value = "/getDsuseMgtDsuseQyByBsshStatistics.do", name="취급자별 폐기 현황 통계")
public ModelAndView getDsuseMgtDsuseQyByBsshStatistics(DsuseMgtStatisticsQuery query) {
if(!"xls".equals(query.getDownload())) {
return setCollectionInfo(new ModelAndView("jsonView"),
addsNimsService.getDsuseMgtDsuseQyByBsshStatistics(query), "", "");
}
List<CellDef> cellDefs = fromJson(query.getCellDefs(), CellDef.listType());
XLSWriter xlsx = new XLSWriter().worksheet(0);
Format format = new Format(xlsx);
CellStyle center = format.cellStyle(Style.CENTER);
CellStyle numeric = format.n_nn0();
List<DataObject> list = addsNimsService.getDsuseMgtDsuseQyByBsshStatistics(query);
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("관할관청", format.of("dept_nm").style(center));
valueMap.put("대마", format.of("대마").style(numeric));
valueMap.put("마약", format.of("마약").style(numeric));
valueMap.put("한외마약", format.of("한외마약").style(numeric));
valueMap.put("향정", format.of("향정").style(numeric));
valueMap.put("향정제외", format.of("향정제외").style(numeric));
valueMap.put("기타", format.of("기타").style(numeric));
valueMap.put("계", format.of("마약향정계").style(numeric));
valueMap.put("비마약류", format.of("비마약류").style(numeric));
valueMap.put("일반관리대상", format.of("일반관리대상").style(numeric));
valueMap.put("중점관리대상", format.of("중점관리대상").style(numeric));
valueMap.put("계", format.of("중점일반계").style(numeric));
CellDef.setValues(cellDefs, valueMap);
Style headerStyle2 = new Style().foregroundColor(HSSFColor.HSSFColorPredefined.GREY_50_PERCENT.getIndex())
.configure(styl -> {
Font font = xlsx.workbook().createFont();
font.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
styl.alignment(HorizontalAlignment.CENTER);
});
xlsx.cell(0, 0).value("마약류 구분별 현황").value(center).merge(0, cellDefs.size()-1);
xlsx.cell(2, 1).value("마약/향정 구분").value(headerStyle2).merge(1, 7);
xlsx.cell(2, 8).value("중점/일반 구분").value(headerStyle2).merge(8, 11);
xlsx.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)));
xlsx.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList()));
ModelAndView mav = new ModelAndView("downloadView");
mav.addObject("download", xlsx.getDownloadable().setFilename("취급자별 폐기 현황.xlsx"));
return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList()); return mav.addObject("downloadData", list).addObject("dataNames", cellDefs.stream().map(CellDef::getLabel).toList());
} }
@ -528,6 +577,16 @@ public class AddsNimsController extends ApplicationController {
return mav.addObject("pageName", "dsuseMgtDsuseQyByPrdStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */; return mav.addObject("pageName", "dsuseMgtDsuseQyByPrdStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
} }
@RequestMapping(value = "/dsuseMgtDsuseQyByBsshStatistics.do", name="마약류 취급자별 폐기 현황 메인")
public ModelAndView dsuseMgtDsuseQyByBsshStatistics() {
ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtDsuseQyByBsshStatistics-main");
setCmmCode("ADDS11", mav);
List<DataObject> deptList = sggDeptService.getDepartmentList(new DepartmentQuery());
mav.addObject("DEPTList", deptList);
return mav.addObject("pageName", "dsuseMgtDsuseQyByBsshStatistics") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
}
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
// menu 호출 처리 // menu 호출 처리
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------

@ -6,15 +6,15 @@
/* 마약/항정 and 중점/일반 별 통계 */ /* 마약/항정 and 중점/일반 별 통계 */
WITH tgt AS ( WITH tgt AS (
SELECT tdm.dept_cd SELECT tdm.dept_cd
, IF(tpi.nrcd_se_nm = '대마', '1', '0') AS '대마' , IF(tpi.nrcd_se_nm = '대마', '1', '0') AS 대마
, IF(tpi.nrcd_se_nm = '마약', '1', '0') AS '마약' , IF(tpi.nrcd_se_nm = '마약', '1', '0') AS 마약
, IF(tpi.nrcd_se_nm = '한외마약', '1', '0') AS '한외마약' , IF(tpi.nrcd_se_nm = '한외마약', '1', '0') AS 한외마약
, IF(tpi.nrcd_se_nm = '향정', '1', '0') AS '향정' , IF(tpi.nrcd_se_nm = '향정', '1', '0') AS 향정
, IF(tpi.nrcd_se_nm = '향정제외', '1', '0') AS '향정제외' , IF(tpi.nrcd_se_nm = '향정제외', '1', '0') AS 향정제외
, IF(tpi.nrcd_se_nm IS NULL, '1', '0') AS '기타' , IF(tpi.nrcd_se_nm IS NULL, '1', '0') AS 기타
, IF(tpi.prtm_se_nm = '비마약류', 1, 0) AS '비마약류' , IF(tpi.prtm_se_nm = '비마약류', 1, 0) AS 비마약류
, IF(tpi.prtm_se_nm = '일반관리대상', 1, 0) AS '일반관리대상' , IF(tpi.prtm_se_nm = '일반관리대상', 1, 0) AS 일반관리대상
, IF(tpi.prtm_se_nm = '중점관리대상', 1, 0) AS '중점관리대상' , IF(tpi.prtm_se_nm = '중점관리대상', 1, 0) AS 중점관리대상
, COUNT(tpi.prduct_cd) OVER(PARTITION BY tdm.dept_cd) AS TOTAL , COUNT(tpi.prduct_cd) OVER(PARTITION BY tdm.dept_cd) AS TOTAL
FROM tb_dsuse_mgt tdm FROM tb_dsuse_mgt tdm
JOIN tb_dsuse_mgt_dtl tdmd ON tdm.dscdmng_id = tdmd.dscdmng_id JOIN tb_dsuse_mgt_dtl tdmd ON tdm.dscdmng_id = tdmd.dscdmng_id
@ -36,33 +36,34 @@
SELECT T.* SELECT T.*
, ROW_NUMBER() over (ORDER BY T.dept_cd) AS ROW_NUM , ROW_NUMBER() over (ORDER BY T.dept_cd) AS ROW_NUM
, IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm , IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm
FROM (SELECT tgt.dept_cd FROM (
, SUM(tgt.대마) AS '대마' SELECT tgt.dept_cd
, SUM(tgt.마약) AS '마약' , SUM(tgt.대마) AS 대마
, SUM(tgt.한외마약) AS '한외마약' , SUM(tgt.마약) AS 마약
, SUM(tgt.향정) AS '향정' , SUM(tgt.한외마약) AS 한외마약
, SUM(tgt.향정제외) AS '향정제외' , SUM(tgt.향정) AS 향정
, SUM(tgt.기타) AS '기타' , SUM(tgt.향정제외) AS 향정제외
, SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS '마약향정계' , SUM(tgt.기타) AS 기타
, SUM(tgt.비마약류) AS '비마약류' , SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS 마약향정계
, SUM(tgt.일반관리대상) AS '일반관리대상' , SUM(tgt.비마약류) AS 비마약류
, SUM(tgt.중점관리대상) AS '중점관리대상' , SUM(tgt.일반관리대상) AS 일반관리대상
, SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS '중점일반계' , SUM(tgt.중점관리대상) AS 중점관리대상
, SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS 중점일반계
FROM tgt FROM tgt
GROUP BY tgt.dept_cd GROUP BY tgt.dept_cd
UNION ALL UNION ALL
SELECT 'TOTAL' AS dept_cd SELECT 'TOTAL' AS dept_cd
, SUM(tgt.대마) AS '대마' , SUM(tgt.대마) AS 대마
, SUM(tgt.마약) AS '마약' , SUM(tgt.마약) AS 마약
, SUM(tgt.한외마약) AS '한외마약' , SUM(tgt.한외마약) AS 한외마약
, SUM(tgt.향정) AS '향정' , SUM(tgt.향정) AS 향정
, SUM(tgt.향정제외) AS '향정제외' , SUM(tgt.향정제외) AS 향정제외
, SUM(tgt.기타) AS '기타' , SUM(tgt.기타) AS 기타
, SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS '마약향정계' , SUM(tgt.대마 + tgt.마약 + tgt.한외마약 + tgt.향정 + tgt.향정제외 + tgt.기타) AS 마약향정계
, SUM(tgt.비마약류) AS '비마약류' , SUM(tgt.비마약류) AS 비마약류
, SUM(tgt.일반관리대상) AS '일반관리대상' , SUM(tgt.일반관리대상) AS 일반관리대상
, SUM(tgt.중점관리대상) AS '중점관리대상' , SUM(tgt.중점관리대상) AS 중점관리대상
, SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS '중점일반계' , SUM(tgt.비마약류 + tgt.일반관리대상 + tgt.중점관리대상) AS 중점일반계
FROM tgt FROM tgt
) T ) T
LEFT JOIN tb_dept td LEFT JOIN tb_dept td
@ -108,24 +109,94 @@
SELECT tgt.dept_cd SELECT tgt.dept_cd
, tgt.prduct_cd AS prduct_cd , tgt.prduct_cd AS prduct_cd
, tgt.prduct_nm AS prduct_nm , tgt.prduct_nm AS prduct_nm
, SUM(tgt.receipt) as receiptCnt , SUM(tgt.receipt) AS receiptCnt
, SUM(tgt.rslt) as rsltCnt , SUM(tgt.rslt) AS rsltCnt
, SUM(tgt.mapping) as mappingCnt , SUM(tgt.mapping) AS mappingCnt
, SUM(tgt.cplt) as cpltCnt , SUM(tgt.cplt) AS cpltCnt
, COUNT(tgt.dscdmng_id) AS dsuseCnt
, SUM(tgt.dsuse_qy) AS dsuseQy
FROM tgt
GROUP BY tgt.dept_cd, tgt.prduct_nm, tgt.prduct_cd
UNION ALL
SELECT 'TOTAL' AS dept_cd
, '' AS prduct_cd
, '' AS prduct_nm
, SUM(tgt.receipt) AS receiptCnt
, SUM(tgt.rslt) AS rsltCnt
, SUM(tgt.mapping) AS mappingCnt
, SUM(tgt.cplt) AS cpltCnt
, count(tgt.dscdmng_id) AS dsuseCnt
, sum(tgt.dsuse_qy) AS dsuseQy
FROM tgt
) T
LEFT JOIN tb_dept td
ON T.dept_cd = td.dept_cd
</select>
<select id="selectDsuseMgtDsuseQyByBsshStatistics" parameterType="map" resultType="dataobject">
/* 마약류취급자 유형별 폐기 현황 */
WITH tgt AS (
SELECT tdm.bssh_cd
, tbi.bssh_nm
, tbi.induty_nm
, tdm.dscdmng_id
, tdm.dept_cd
, tdmd.dsuse_qy
, IF(tbi.induty_nm = '마약류도매업', 1, 0) AS 마약류도매업
, IF(tbi.induty_nm = '마약류소매업', 1, 0) AS 마약류소매업
, IF(tbi.induty_nm = '마약류수출입업', 1, 0) AS 마약류수출입업
, IF(tbi.induty_nm = '마약류원료사용', 1, 0) AS 마약류원료사용
, IF(tbi.induty_nm = '마약류제조업', 1, 0) AS 마약류제조업
, IF(tbi.induty_nm = '마약류취급의료업', 1, 0) AS 마약류취급의료업
, IF(tbi.induty_nm = '마약류취급학술연구', 1, 0) AS 마약류취급학술연구
FROM tb_dsuse_mgt tdm
JOIN tb_dsuse_mgt_dtl tdmd
ON tdm.dscdmng_id = tdmd.dscdmng_id
JOIN tb_bssh_info tbi
ON tdm.bssh_cd = tbi.bssh_cd
WHERE tdm.use_yn = 'Y'
<if test="schSggCd != null">
AND tdm.dept_cd = #{schSggCd} <!-- 관할 관청 -->
</if>
<if test="schDateFrom != null">
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
</if>
<if test="schDateTo != null">
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
</if>
<if test="schSttsCd != null">
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
</if>
)
SELECT T.*
, ROW_NUMBER() over (ORDER BY T.dept_cd) AS ROW_NUM
, IF(td.dept_nm IS NULL, T.dept_cd, dept_nm) AS dept_nm
FROM (
SELECT tgt.dept_cd
, SUM(tgt.마약류도매업) AS 마약류도매업
, SUM(tgt.마약류소매업) AS 마약류소매업
, SUM(tgt.마약류수출입업) AS 마약류수출입업
, SUM(tgt.마약류원료사용) AS 마약류원료사용
, SUM(tgt.마약류제조업) AS 마약류제조업
, SUM(tgt.마약류취급의료업) AS 마약류취급의료업
, SUM(tgt.마약류취급학술연구) AS 마약류취급학술연구
-- , SUM(tgt.마약류도매업 + tgt.마약류소매업 + tgt.마약류수출입업 + tgt.마약류원료사용 + tgt.마약류제조업 + tgt.마약류취급의료업 + tgt.마약류취급학술연구) AS 계
, COUNT(tgt.dscdmng_id) as dsuseCnt , COUNT(tgt.dscdmng_id) as dsuseCnt
, SUM(tgt.dsuse_qy) as dsuseQy , SUM(tgt.dsuse_qy) as dsuseQy
FROM tgt FROM tgt
GROUP BY tgt.prduct_nm, tgt.prduct_cd GROUP BY tgt.dept_cd
UNION ALL UNION ALL
SELECT 'TOTAL' AS dept_cd SELECT 'TOTAL' AS dept_cd
, '' AS prduct_cd , SUM(tgt.마약류도매업) AS 마약류도매업
, '' as prduct_nm , SUM(tgt.마약류소매업) AS 마약류소매업
, SUM(tgt.receipt) as receiptCnt , SUM(tgt.마약류수출입업) AS 마약류수출입업
, SUM(tgt.rslt) as rsltCnt , SUM(tgt.마약류원료사용) AS 마약류원료사용
, SUM(tgt.mapping) as mappingCnt , SUM(tgt.마약류제조업) AS 마약류제조업
, SUM(tgt.cplt) as cpltCnt , SUM(tgt.마약류취급의료업) AS 마약류취급의료업
, count(tgt.dscdmng_id) as dsuseCnt , SUM(tgt.마약류취급학술연구) AS 마약류취급학술연구
, sum(tgt.dsuse_qy) as dsuseQy -- , SUM(tgt.마약류도매업 + tgt.마약류소매업 + tgt.마약류수출입업 + tgt.마약류원료사용 + tgt.마약류제조업 + tgt.마약류취급의료업 + tgt.마약류취급학술연구) AS 계
, COUNT(tgt.dscdmng_id) AS dsuseCnt
, SUM(tgt.dsuse_qy) AS dsuseQy
FROM tgt FROM tgt
) T ) T
LEFT JOIN tb_dept td LEFT JOIN tb_dept td

@ -0,0 +1,381 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">폐기 보고 확인</c:set>
<!-- Page Body -->
<div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화">
초기화
</button>
</div>
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="container-search">
<div class="row g-1">
<div class="col-4">
<label class="form-label fw-bold form-search-title text-end" for="schSggCd--${pageName}">관할관청</label>
<select class="form-select" id="schSggCd--${pageName}" name="schSggCd" style="pointer-events: none;">
<option value="">전체</option>
<c:forEach items="${DEPTList}" var="item">
<option value="${item.DEPT_CD}">${item.DEPT_NM}</option>
</c:forEach>
</select>
</div>
<div class="col-4">
<label class="form-label fw-bold form-search-title text-end">폐기일자</label>
<span class="form-search-linebox" id="inputHdrDe">
<input type="text" class="form-control form-date" id="schDateFrom--${pageName}" name="schDateFrom" data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
~
<input type="text" class="form-control form-date" id="schDateTo--${pageName}" name="schDateTo" data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
</span>
<input type="checkbox" id="chkDsuseDe--${pageName}" name="chkDsuseDe" title="폐기일자 적용" style="align-items: baseline"/>&nbsp;<strong>폐기일자 적용</strong>
</div>
<!-- 업체명 -->
<%-- <div class="col-5">--%>
<%-- <label class="form-label fw-bold form-search-title text-end" for="schBsshNm--${pageName}">업체명</label>--%>
<%-- <input type="text" class="form-control w-px-160" id="schBsshNM--${pageName}" name="schBsshNm" data-map="bsshNm" autocomplete="off" readonly/>--%>
<%-- <input type="hidden" id="schBsshCd--${pageName}" name="schBsshCd" data-map="bsshCd" autocomplete="off" />--%>
<%-- <button type="button" class="btn btn-search w-px-120" id="btnBsshSearch--${pageName}" title="업체 검색">--%>
<%-- 업체 검색--%>
<%-- </button>--%>
<%-- </div>--%>
<!-- 처리상태 -->
<%-- <div class="col-6">--%>
<%-- <label class="form-label fw-bold form-search-title text-end" for="schSttsCd--${pageName}">처리상태</label>--%>
<%-- <select class="form-select" id="schSttsCd--${pageName}" name="schSttsCd">--%>
<%-- <option value="">전체</option>--%>
<%-- <c:forEach items="${ADDS11}" var="item">--%>
<%-- <option value="${item.code}">${item.value}</option>--%>
<%-- </c:forEach>--%>
<%-- </select>--%>
<%-- </div>--%>
<div class="col-1">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색">
검색
</button>
</div>
</div>
</div>
</form>
<div class="mt-3">
<div class="float-end">
<button type="button" class="btn btn-excel w-px-120" id="btnExcel--${pageName}" title="엑셀 저장">
엑셀
</button>
</div>
</div>
<!-- 업무 버튼 및 건수 표시 -->
<div class="d-flex flex-row justify-content-between p-3">
<div>
<div class="input-group" id="DataTables_Table_0_length">
</div>
</div>
</div>
<!-- DataTables(그리드) -->
<div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll" style="height: 580px !important;" id="table-responsive--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead">
<tr id="theadTr--${pageName}"
data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th class="cmn" style="width: 60px;">No.</th>
<th class="cmn" style="width: 170px;">관할관청</th>
<th class="cmn" style="width: 100px;">종 폐기건수</th>
<th class="cmn" style="width: 120px;">마약류취급의료업</th>
<th class="cmn" style="width: 100px;">마약류소매업</th>
<th class="cmn" style="width: 100px;">마약류도매업</th>
<th class="cmn" style="width: 100px;">마약류제조업</th>
<th class="cmn" style="width: 100px;">마약류수출입업</th>
<th class="cmn" style="width: 100px;">마약류원료사용</th>
<th class="cmn" style="width: 120px;">마약류취급학술연구</th>
<th class="cmn" style="width: 100px;">폐기수량</th>
</tr>
</thead>
<tbody id="tbody--${pageName}">
</tbody>
<template id="${infoPrefix}Row--${pageName}">
<tr data-key="{dept_cd}" class="{fw-bold-if-total}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dept_nm}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseCnt}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류취급의료업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류소매업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류도매업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류제조업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류수출입업}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류원료사용}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{마약류취급학술연구}</td>
<td class="text-end" onclick="{onclick}" ondblclick="{ondblclick}">{dsuseQy}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd">
<td valign="top" colspan="13" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</div>
</div>
<!-- / DataTables(그리드) -->
<div class="d-flex flex-row p-3 justify-content-between">
<label id="${infoPrefix}Paging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}Paging--${pageName}" class="pagination pagination-primary" style="display: none;">
</ul>
</div>
<script>
<!--/ Page Body -->
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// pageObject
let $P = pageObject["${pageName}"];
// FormFields
$P.formFields = new AddsFormFields("#frmSearch--${pageName}");
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
urls : {
load : wctx.url("/adds/nims/getDsuseMgtDsuseQyByBsshStatistics.do")
}
, prefix: "dsuseMgtDsuseQyByBsshStatistics"
, prefixName: "제품별 폐기 현황"
, keymapper: info => info ? info.dept_cd : ""
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, infoSize: "xl"
});
// $P.control 설정
$P.control.defaultFetchSize = FETCH_XXS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30
//$P.control.query = { pageNum : 1, fetchSize : $P.control.defaultFetchSize };
$P.control.beforeCurrent = null;
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// Dataset 변경 이벤트
$P.control.onDatasetChange = (obj) => {
$P.renderList(obj.${infoPrefix}Total);
};
// 현재 선택 자료 변경 이벤트
$P.control.onCurrentChange = (item) => {
if (!item) {
return;
}
let key = item.data.dept_cd;
$("#tbody--${pageName}").setCurrentRow(key);
};
/**************************************************************************
* DataTables 이벤트
**************************************************************************/
// DataTables에 click, dbclick 이벤트
$P.renderList = (totalSize) => {
let ${infoPrefix}List = $P.control.dataset;
let empty = ${infoPrefix}List.empty;
// 업무별 DataTables(그리드) tr, td
let foundContent = document.getElementById("${infoPrefix}Row--${pageName}").content;
let foundTr = $(foundContent).find("tr")[0].cloneNode(false);
let foundTds = $(foundContent).find("td");
foundTds.each(function() {
foundTr.appendChild(this.cloneNode(true));
});
let replacer = (str, dataItem) => {
str = str.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("dept_cd") + "');")
if(dataItem.getValue("dept_cd") == "TOTAL"){
str = str.replace(/{fw-bold-if-total}/gi, "fw-bold");
} else {
str = str.replace(/{fw-bold-if-total}/gi, "");
}
return str;
}
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").content.outerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
$("#tbody--${pageName}").html(trs.join());
}
$P.control.getBsshInfo = (gdccId) => {
let dialogTitle = "마약류 취급업체 조회";
let params = {openPage : "frmSearch--${pageName}"};
ajax.get({
url : wctx.url("/adds/nims/bssh-popup.do")
, data : params
, success : resp => {
dialog.open({
id : "bsshPopupDialog"
, title : dialogTitle
, content : resp
, size : $P.control.infoSize
, onClose : () => { }
});
}
});
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 사용자검색 callback
$P.callbackFindUser = (userId, userNm) => {
$("#schRgtrCd--${pageName}").val(userId); // 사용자 ID
$("#schRgtrNm--${pageName}").val(userNm); // 사용자 명
}
// 업체 검색 버튼 이벤트
$P.fnSearchBssh = () => {
$P.control.getBsshInfo();
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
// 업무 구분 변경 이벤트
$P.fnReset = () => {
//$P.control.dataset.clear();
// 초기 기본 설정
$P.initForm();
// dataset 초기화
}
// 검색 버튼 클릭 이벤트
$P.fnSearchList = () => {
// 검색조건
$P.control.query = $P.formFields.get(); // 검색 조건
if(!$('#chkDsuseDe--${pageName}').is(":checked")){
$P.control.query.schDateFrom = '';
$P.control.query.schDateTo = '';
}
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부
$P.control.load();
}
// 엑셀 버튼 클릭 이벤트
$P.fnExcel = () => {
if ($P.control.dataset.empty) {
dialog.alert({
content: "검색된 자료가 없습니다."
, onOK: () => { }
});
return;
}
// DataTables(그리드)
let cellDefs = getCellDefs(
$("#theadTr0--${pageName} th, #theadTr--${pageName} th")
.not(".dummy-th").not(":eq(0)").not("[colspan]"),
$($("#${infoPrefix}Row--${pageName}")[0].content).find("td")
.not(".dummy-td").not(":eq(0)").not("[colspan]"));
$P.control.query.cellDefs = cellDefs;
$P.control.download();
}
/**************************************************************************
* 초기 설정
**************************************************************************/
// 이벤트 설정
$P.setEvent = () => {
// 기본 버튼 이벤트
$("#btnReset--${pageName}").on("click", () => $P.fnReset()); // 초기화
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); // 검색
$("#btnExcel--${pageName}").on("click", () => $P.fnExcel()); // 엑셀
// 동적검색에서 엔터(Enter) 키를 누르면 검색한다.
$("#term--${pageName}").keypress(function(e) {
if (e.keyCode == 13) {
$P.fnSearchList();
}
});
// form-date 항목에서 키보드로 입력시 날짜 포맷팅 적용
$("#frmSearch--${pageName}").find(".form-date").each(function() {
$(this).on("input", function() {
let value = this.value.replaceAll("-", "");
if (value.length > 7) {
this.value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6);
} else if (value.length > 5) {
this.value = value.substring(0, 4) + "-" + value.substring(4);
}
});
});
// 업체 검색 버튼 이벤트
$("#btnBsshSearch--${pageName}").on("click", function() {
$P.fnSearchBssh();
});
// DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고)
fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
}
// 초기 화면 설정
$P.initForm = () => {
// 화면 초기화
$("#frmSearch--${pageName}")[0].reset();
// input, select 초기화
let searchForm = $("#frmSearch--${pageName}");
searchForm.find("input[type='checkbox']").prop("checked", false);
searchForm.find("input[type='text']").val("");
searchForm.find("input[type='hidden']").val("");
searchForm.find("select").each(function() { $(this).find("option:eq(0)").prop("selected", true); });
// 기본 데이터 설정
initDatepicker("frmSearch--${pageName}"); // 달력 초기화
$("#schDateFrom--${pageName}").datepicker("setDate", DateUtil.getDateDay(-7).date); // 부과 제외 일자 시작
$("#schDateTo--${pageName}").datepicker("setDate", new Date()); // 부과 제외 일자 종료
$('#schSggCd--${pageName}').val("${currentUser.deptCode}");
$P.fnSearchList();
}
/**************************************************************************
* 최초 실행 함수
**************************************************************************/
// 1. 이벤트 설정
$P.setEvent();
// 2. 초기 설정 및 업무 구분 변경
$P.fnReset();
});
</script>
Loading…
Cancel
Save