박정하 박정하 2023-06-29
230629 박정하 운영서버 적용을 위한 소스 업데이트
@74f1d08aaa6a5fcfa84e5c310355ea5f21e0f453
Global.js
--- Global.js
+++ Global.js
@@ -5,10 +5,10 @@
 const SERVICE_STATUS = process.env.NODE_ENV;//development, production
 const PORT = 80;
 const API_SERVER_HOST = 'localhost:8080';
-//const JUSO_API_KEY = 'U01TX0FVVEgyMDIzMDQxNzIxNDY1NjExMzY5NTg='//실사용 Key u-dolbom.com
-//const JUSO_CORRD_API_KEY = 'U01TX0FVVEgyMDIzMDQxNzE2MTgyNzExMzY5MzE=';//실사용 Key u-dolbom.com
-const JUSO_API_KEY = 'U01TX0FVVEgyMDIyMTEyMTE3NDE1NzExMzI0MjU=';//Test용
-const JUSO_CORRD_API_KEY = 'U01TX0FVVEgyMDIyMTEyMTE4MDIxOTExMzI0MzU=';//Test용
+const JUSO_API_KEY = 'U01TX0FVVEgyMDIzMDQxNzIxNDY1NjExMzY5NTg='//실사용 Key u-dolbom.com
+const JUSO_CORRD_API_KEY = 'U01TX0FVVEgyMDIzMDQxNzE2MTgyNzExMzY5MzE=';//실사용 Key u-dolbom.com
+//const JUSO_API_KEY = 'U01TX0FVVEgyMDIyMTEyMTE3NDE1NzExMzI0MjU=';//Test용
+//const JUSO_CORRD_API_KEY = 'U01TX0FVVEgyMDIyMTEyMTE4MDIxOTExMzI0MzU=';//Test용
 
 module.exports = {
     PROJECT_NAME,
client/views/pages/equipment/GovernmentEquipmentSelect.jsx
--- client/views/pages/equipment/GovernmentEquipmentSelect.jsx
+++ client/views/pages/equipment/GovernmentEquipmentSelect.jsx
@@ -154,7 +154,6 @@
     });
   }
 
-
   //입고 및 미대여 장비 검색 정보
   const [rentalEquipmentSearch, setRentalEquipmentSearch] = React.useState({
     'government_id': defaultGovernmentId,
@@ -559,21 +558,7 @@
                   <td data-label="시리얼넘버">{item['equipment_serial_number']}</td>
                   <td data-label="입고일자">{item['equipment_stock_date']}</td>
                   <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td>
-                  <td data-label="기관">
-                    {orgListOfHierarchy.map((item1, idx1) => {
-                      return (
-                        item1['agencyList'] != undefined && item1['agencyList'] != null ?
-                          item1['agencyList'].map((item2, idx2) => {
-                            return (
-                              item['agency_id'] == item2['agency_id'] ?
-                                item2['agency_name']
-                                : null
-                            )
-                          })
-                          : null
-                      )
-                    })}
-                  </td>
+                  <td data-label="기관">{item['agency_name'] != null ? item['agency_name'] : '없음'}</td>
                   <td cata-label="장비대여">
                     <button className={"btn-small gray-btn"} onClick={() => modalRentalOpen(item)}>장비 배포</button>
                   </td>
client/views/pages/main/Main_agencyAdmin.jsx
--- client/views/pages/main/Main_agencyAdmin.jsx
+++ client/views/pages/main/Main_agencyAdmin.jsx
@@ -32,11 +32,7 @@
 
   const [cityName, setCityName] = useState(state.loginUser['agency_name']);
 
-  //특정 대상자의 일별, 복약시간별 복약 목록
-  let array = [];
-  const [stackChartData, setStackChartData] = React.useState([]);
-
-  //대상자(시니어) 목록 조회
+  //대상자(시니어) 목록 조회  
   const [seniorNum, setSeniorNum] = React.useState();
   const [senior, setSenior] = React.useState({ userList: [], userListCount: 0 });
   const seniorSelectList = () => {
@@ -50,15 +46,11 @@
         'authority': 'ROLE_SENIOR',
       }),
     }).then((response) => response.json()).then((data) => {
-      data.userList.map((item, idx) => {
-        item['senior_id'] = item['user_id'];
-        setSeniorNum(item);
-        seniorMedicationSelectList(item, item['user_name']);
-      })
-      console.log(">>", array);
-      setStackChartData(array);
       console.log("대상자(시니어) 목록 조회 : ", data);
       setSenior(data);
+      data.userList.map((item, idx) => {
+        console.log(">>", item['user_id'])
+      })
     }).catch((error) => {
       console.log('seniorSelectList() /user/userSelectList.json error : ', error);
     });
@@ -171,27 +163,31 @@
     className: 'leaflet-background-radius-icon'//leaflet-div-icon
   });
 
+
   //특정 대상자의 실제 복약 정보
   const [seniorMedicationList, setSeniorMedicationList] = React.useState([]);
   const [showMedicationTimeCode, setShowMedicationTimeCode] = React.useState({});
   //특정 대상자의 실제 복약 정보 목록 조회
-  const seniorMedicationSelectList = (seniorNum, senior_name) => {
+  const seniorMedicationSelectList = (seniorNum) => {
     fetch("/user/seniorMedicationSelectList.json", {
       method: "POST",
       headers: {
         'Content-Type': 'application/json; charset=UTF-8'
       },
-      body: JSON.stringify(seniorNum),
+      body: JSON.stringify(seniorNum['senior_id']),
     }).then((response) => response.json()).then((data) => {
       setSeniorMedicationList(data, seniorNum);
-      seniorMedicationSelectListByDay(data, seniorNum, senior_name);
+      seniorMedicationSelectListByDay(data, seniorNum);
+      console.log("seniorMedicationSelectList: ", seniorMedicationSelectList)
     }).catch((error) => {
       console.log('seniorMedicationSelectList() /user/seniorMedicationSelectList.json error : ', error);
     });
   };
 
+  //특정 대상자의 일별, 복약시간별 복약 목록
+  const [stackChartData, setStackChartData] = React.useState([]);
   //특정 대상자의 일별, 복약시간별 복약 목록 조회
-  const seniorMedicationSelectListByDay = (seniorMedicationList, seniorNum, senior_name) => {
+  const seniorMedicationSelectListByDay = (seniorMedicationList, seniorNum) => {
     fetch("/user/seniorMedicationSelectListByDay.json", {
       method: "POST",
       headers: {
@@ -206,16 +202,16 @@
       setShowMedicationTimeCode(showMedicationTimeCode);
 
       if (CommonUtil.isEmpty(data) == false) {
-        let _stackChartData = {};
-        let sum = 0;      // 실제 복약량
-        let counter = 0;  // 복약해야하는 양
-        let percent = 0; // 복약률
-        for (let i = data.length - 1; i >= data.length - 30; i--) {
+        let _stackChartData = [];
+        for (let i = data.length - 1; i >= data.length - 3; i--) {
+          let sum = 0;      // 실제 복약량
+          let counter = 0;  // 복약해야하는 양
           let chartData = {
             xName: data[i]['medication_default_date']
           };
           for (let j = 0; j < data[i]['medication_time_code_list'].length; j++) {
             if (CommonUtil.isEmpty(showMedicationTimeCode[data[i]['medication_time_code_list'][j]]) == false) {
+              chartData[data[i]['medication_time_code_list'][j]] = data[i]['medication_time_code_count_list'][j];
               counter++;
               if (i > 0) {
                 sum += data[i]['medication_time_code_count_list'][j];
@@ -224,9 +220,9 @@
               continue;
             }
           }
+          _stackChartData.push({ "sum": sum, "total": counter })
         }
-        percent = Math.floor((sum / counter) * 100);
-        array.push({ "senior_name": senior_name, "sum": sum, "total": counter, "percent": percent });
+        seniorNum.seniorMedicationList = _stackChartData;
       }
     }).catch((error) => {
       console.log('seniorMedicationSelectListByDay() /user/seniorMedicationSelectListByDay.json error : ', error);
@@ -312,7 +308,7 @@
           <div className="flex">
             <Title title={`${cityName} 복용률 순위`} explanation={""} />
           </div>
-          <div style={{height:'calc(100% - 60px)'}}>
+          <div style={{ height: 'calc(100% - 60px)' }}>
             <Chart8 data={stackChartData} />
             {/* <Chart8 /> */}
           </div>
client/views/pages/senior_management/SeniorSelectOne.jsx
--- client/views/pages/senior_management/SeniorSelectOne.jsx
+++ client/views/pages/senior_management/SeniorSelectOne.jsx
@@ -26,6 +26,44 @@
   };
 
 
+  //시니어 정보
+  const [senior, setSenior] = React.useState({
+    'user_id': location.state['senior_id'],
+    'user_name': null,
+    'user_password': null,
+    'user_phonenumber': null,
+    'user_birth': null,
+    'user_gender': null,
+    'user_address': null,
+    'user_email': null,
+    'authority': 'ROLE_SENIOR',
+    'agency_id': location.state['agency_id'],
+    'government_id': location.state['government_id'],
+
+    'senior_id': location.state['senior_id'],
+    'care_grade': null,
+    'medication_pill': null,
+    'underlie_disease': null,
+    'senior_note': null,
+
+    'seniorMedicationList': []
+  });
+  //시니어 상세 조회
+  const seniorSelectOne = () => {
+    fetch("/user/seniorSelectOne.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(senior),
+    }).then((response) => response.json()).then((data) => {
+      console.log("seniorSelectOne data : ", data);
+      setSenior(data);
+    }).catch((error) => {
+      console.log('seniorSelectOne() /user/seniorSelectOne.json error : ', error);
+    });
+  };
+
   const [medicationTimeCodeList, setMedicationTimeCodeList] = React.useState([]);
   //복약 시간 코드 목록 조회
   const medicationTimeCodeSelectList = () => {
@@ -42,57 +80,6 @@
       console.log('medicationTimeCodeSelectList() /common/medicationTimeCodeSelectList.json error : ', error);
     });
   }
-
-  // 시스템 코드 - 장비 상태
-  const [equipmentStates, setEquipmentStates] = React.useState({});
-  // 시스템 코드 - 장비 상태 조회
-  const equipmentStatesSelect = () => {
-    console.log('equipmentStatesSelect Function Run');
-
-    //fetch post
-    fetch("/common/systemCode/equipmentStatesSelect.json", {
-      method: "POST",
-      headers: {
-        'Content-Type': 'application/json; charset=UTF-8'
-      },
-      body: JSON.stringify({})
-    }).then((response) => response.json()).then((data) => {
-      console.log('equipmentStatesSelect response : ', data);
-      setEquipmentStates(data);
-    }).catch((error) => {
-      console.log('equipmentStatesSelect error : ', error);
-    });
-  }
-
-  //입고 및 미대여 장비 검색 정보
-  const [deliveryEquipmentSearch, setDeliveryEquipmentSearch] = React.useState({
-    'government_id': location.state['government_id'],
-    'senior_id': 'IS_NULL',
-    'currentPage': 1,
-    'perPage': 10,
-  });
-  //입고 및 미대여 목록
-  const [deliveryEquipment, setDeliveryEquipment] = React.useState({ equipmentList: [], equipmentListCount: 0 });
-  //입고 및 미대여 목록 조회
-  const deliveryEquipmentSelectList = (currentPage) => {
-    deliveryEquipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage;
-    setDeliveryEquipmentSearch({ ...deliveryEquipmentSearch });
-
-    fetch("/equipment/equipmentSelectList.json", {
-      method: "POST",
-      headers: {
-        'Content-Type': 'application/json; charset=UTF-8'
-      },
-      body: JSON.stringify(deliveryEquipmentSearch)
-    }).then((response) => response.json()).then((data) => {
-      console.log('deliveryEquipmentSelectList response : ', data);
-      setDeliveryEquipment(data);
-    }).catch((error) => {
-      console.log('deliveryEquipmentSelectList error : ', error);
-    });
-  }
-
-
 
   //장비 대여 모달 여부
   const [modalRentalIsOpen, setModalRentalIsOpen] = React.useState(false);
@@ -167,6 +154,59 @@
   }
 
 
+  // 시스템 코드 - 장비 상태
+  const [equipmentStates, setEquipmentStates] = React.useState({});
+  // 시스템 코드 - 장비 상태 조회
+  const equipmentStatesSelect = () => {
+    console.log('equipmentStatesSelect Function Run');
+
+    //fetch post
+    fetch("/common/systemCode/equipmentStatesSelect.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify({})
+    }).then((response) => response.json()).then((data) => {
+      console.log('equipmentStatesSelect response : ', data);
+      setEquipmentStates(data);
+    }).catch((error) => {
+      console.log('equipmentStatesSelect error : ', error);
+    });
+  }
+
+  //입고 및 미대여 장비 검색 정보
+  const [deliveryEquipmentSearch, setDeliveryEquipmentSearch] = React.useState({
+    'government_id': location.state['government_id'],
+    'agency_id': location.state['agency_id'],
+    'senior_id': 'IS_NULL',
+    'currentPage': 1,
+    'perPage': 10,
+  });
+  //입고 및 미대여 목록
+  const [deliveryEquipment, setDeliveryEquipment] = React.useState({ equipmentList: [], equipmentListCount: 0 });
+  //입고 및 미대여 목록 조회
+  const deliveryEquipmentSelectList = (currentPage) => {
+    deliveryEquipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage;
+    setDeliveryEquipmentSearch({ ...deliveryEquipmentSearch });
+    
+    console.log(">>", senior['agency_id'])
+    deliveryEquipmentSearch.agency_id = senior['agency_id'];
+
+    fetch("/equipment/equipmentSelectList.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(deliveryEquipmentSearch)
+    }).then((response) => response.json()).then((data) => {
+      console.log('deliveryEquipmentSelectList response : ', data);
+      setDeliveryEquipment(data);
+    }).catch((error) => {
+      console.log('deliveryEquipmentSelectList error : ', error);
+    });
+  }
+
   //장비 대여 종료 모달 여부
   const [modalRentalEndIsOpen, setModalRentalEndIsOpen] = React.useState(false);
   const [rentalData, setRentalData] = React.useState({});
@@ -240,46 +280,6 @@
       console.log('equipmentUpdateSenior() /equipment/equipmentUpdateSenior.json error : ', error);
     });
   }
-
-
-  //시니어 정보
-  const [senior, setSenior] = React.useState({
-    'user_id': location.state['senior_id'],
-    'user_name': null,
-    'user_password': null,
-    'user_phonenumber': null,
-    'user_birth': null,
-    'user_gender': null,
-    'user_address': null,
-    'user_email': null,
-    'authority': 'ROLE_SENIOR',
-    'agency_id': location.state['agency_id'],
-    'government_id': location.state['government_id'],
-
-    'senior_id': location.state['senior_id'],
-    'care_grade': null,
-    'medication_pill': null,
-    'underlie_disease': null,
-    'senior_note': null,
-
-    'seniorMedicationList': []
-  });
-  //시니어 상세 조회
-  const seniorSelectOne = () => {
-    fetch("/user/seniorSelectOne.json", {
-      method: "POST",
-      headers: {
-        'Content-Type': 'application/json; charset=UTF-8'
-      },
-      body: JSON.stringify(senior),
-    }).then((response) => response.json()).then((data) => {
-      console.log("seniorSelectOne data : ", data);
-      setSenior(data);
-    }).catch((error) => {
-      console.log('seniorSelectOne() /user/seniorSelectOne.json error : ', error);
-    });
-  };
-
 
 
   //대상자의 보호자 목록
@@ -438,15 +438,26 @@
 
 
   React.useEffect(() => {
-    medicationTimeCodeSelectList();
-    equipmentStatesSelect();
-    deliveryEquipmentSelectList();
-
     seniorSelectOne();
     guardianSelectListBySenior();
     agentSelectListBySenior();
     equipmentRentalList();
-  }, [])
+
+    medicationTimeCodeSelectList();
+    equipmentStatesSelect();
+
+    if (CommonUtil.isEmpty(deliveryEquipmentSearch['agency_id']) == false) {
+      deliveryEquipmentSelectList(1);
+    }
+  }, []);
+
+  React.useEffect(() => {
+    if (CommonUtil.isEmpty(deliveryEquipmentSearch['agency_id']) && CommonUtil.isEmpty(senior['agency_id']) == false) {
+      deliveryEquipmentSearch['agency_id'] = senior['agency_id'];
+      setDeliveryEquipmentSearch({...deliveryEquipmentSearch});
+      deliveryEquipmentSelectList(1);
+    };
+  }, [senior])
 
 
   return (
server/modules/web/Server.js
--- server/modules/web/Server.js
+++ server/modules/web/Server.js
@@ -17,12 +17,12 @@
 
 http.createServer(webServer).listen(PORT);
 https.createServer({
-    /* key: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.com/u-dolbom.com_nopass.key`),
+    key: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.com/u-dolbom.com_nopass.key`),
     cert: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.com/u-dolbom.com.pem`),
-    ca: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.com/Chain_RootCA_Bundle.crt`), */
-    key: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.co.kr/u-dolbom.co.kr_nopass.key`),
+    ca: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.com/Chain_RootCA_Bundle.crt`),
+    /* key: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.co.kr/u-dolbom.co.kr_nopass.key`),
     cert: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.co.kr/u-dolbom.co.kr.pem`),
-    ca: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.co.kr/Chain_RootCA_Bundle.crt`),
+    ca: fs.readFileSync(`${BASE_DIR}/server/modules/web/ssl/u-dolbom.co.kr/Chain_RootCA_Bundle.crt`), */
     /* requestCert: false,
     rejectUnauthorized: false */
 }, webServer).listen(443);
Add a comment
List