mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Various changes
This commit is contained in:
@ -52,6 +52,7 @@ module.exports = function(calendar) {
|
||||
createdOn: new Date(),
|
||||
createdBy: req.user,
|
||||
reason: req.body.reason,
|
||||
maintenanceType: req.body.maintenanceType || "",
|
||||
remarks: req.body.remarks || "",
|
||||
status: req.body.status,
|
||||
scheduling: req.body.scheduling,
|
||||
@ -144,6 +145,7 @@ module.exports = function(calendar) {
|
||||
workorder = result;
|
||||
|
||||
workorder.reason = req.body.reason;
|
||||
maintenanceType: req.body.maintenanceType || "";
|
||||
workorder.remarks = req.body.remarks;
|
||||
workorder.scheduling = req.body.scheduling;
|
||||
workorder.status = req.body.status;
|
||||
|
7
app/model/pms.js
Normal file
7
app/model/pms.js
Normal file
@ -0,0 +1,7 @@
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema,
|
||||
ObjectId = Schema.ObjectId;
|
||||
|
||||
var pmSchema = new Schema({})
|
||||
|
||||
var Pm = module.exports = mongoose.model('Pm', pmSchema);
|
0
logs/crash.log
Executable file
0
logs/crash.log
Executable file
94
mapreduce.js
Normal file
94
mapreduce.js
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
|
||||
|
||||
var mongoose = require('mongoose');
|
||||
mongoose.connect('mongodb://localhost/biomed_prod');
|
||||
|
||||
|
||||
var map_clients = function() {
|
||||
|
||||
var result = {};
|
||||
|
||||
for (var type in this.frequencies) {
|
||||
if (this.frequencies[type][month]) {
|
||||
result[type] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(result).length > 0) {
|
||||
emit(this._id, result);
|
||||
}
|
||||
}
|
||||
|
||||
var reduce_clients = function(key, values) {
|
||||
return values;
|
||||
}
|
||||
|
||||
var map_workorders = function() {
|
||||
if (
|
||||
this.scheduling.start >= start &&
|
||||
this.scheduling.start <= end &&
|
||||
this.reason == "Preventive Maintenance") {
|
||||
|
||||
var type = this.maintenanceType || 'legacy';
|
||||
var result = {};
|
||||
result[type] = 1;
|
||||
|
||||
emit(this.client, result);
|
||||
}
|
||||
}
|
||||
|
||||
var reduce_workorders = function(key, values) {
|
||||
|
||||
var result = { }
|
||||
|
||||
values.forEach(function (entry) {
|
||||
for (i in entry) {
|
||||
if (i in result) {
|
||||
result[i] += entry[i];
|
||||
} else {
|
||||
result[i] = entry[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
var today = new Date();
|
||||
var year = today.getYear() + 1900;
|
||||
var month = today.getMonth();
|
||||
var start = new Date(year, month, 0);
|
||||
var end = new Date(year, month + 1, 0);
|
||||
|
||||
console.log(start);
|
||||
console.log(end);
|
||||
|
||||
var scope = { month: month, start: start, end: end }
|
||||
|
||||
var clients_command = {
|
||||
mapreduce: "clients",
|
||||
map: map_clients.toString(),
|
||||
reduce: reduce_clients.toString(),
|
||||
scope: scope,
|
||||
out: { replace: 'pms' }
|
||||
}
|
||||
|
||||
var workorders_command = {
|
||||
mapreduce: "workorders",
|
||||
map: map_workorders.toString(),
|
||||
reduce: reduce_workorders.toString(),
|
||||
scope: scope,
|
||||
out: { reduce: 'pms' }
|
||||
}
|
||||
|
||||
mongoose.connection.db.executeDbCommand(clients_command, function(err, dbres) {
|
||||
if (err) throw err;
|
||||
|
||||
mongoose.connection.db.executeDbCommand(workorders_command, function(err, dbres) {
|
||||
if (err) throw err;
|
||||
|
||||
process.exit();
|
||||
});
|
||||
});
|
@ -5,7 +5,7 @@ angular.module('biomed', ['biomed.filters', 'biomed.services', 'biomed.directive
|
||||
$rootScope.TECH_GROUPS = {
|
||||
all: 'All',
|
||||
biomed: 'Biomed',
|
||||
ice: 'Ice',
|
||||
ice: 'ICE',
|
||||
sales: 'Sales',
|
||||
other: 'Others'
|
||||
};
|
||||
|
@ -300,16 +300,24 @@ biomed.WorkorderAddCtrl = function($scope, $location, Workorders, Schedule, Clie
|
||||
|
||||
var search = $location.search();
|
||||
|
||||
if (search.clientId) {
|
||||
if (search.workorderType == 'pm') {
|
||||
$scope.model.client = search.clientId;
|
||||
}
|
||||
$scope.model.reason = "Preventive Maintenance";
|
||||
$scope.model.maintenanceType = search.type;
|
||||
|
||||
if (search.reason) {
|
||||
$scope.model.reason = search.reason;
|
||||
}
|
||||
$scope.workorderType = 'pm';
|
||||
} else {
|
||||
if (search.clientId) {
|
||||
$scope.model.client = search.clientId;
|
||||
}
|
||||
|
||||
if (search.remarks) {
|
||||
$scope.model.remarks = search.remarks;
|
||||
if (search.reason) {
|
||||
$scope.model.reason = search.reason;
|
||||
}
|
||||
|
||||
if (search.remarks) {
|
||||
$scope.model.remarks = search.remarks;
|
||||
}
|
||||
}
|
||||
|
||||
updateAllUsers();
|
||||
|
@ -239,7 +239,7 @@
|
||||
<tr ng-hide="workorders.length"><td colspan="4" class="table-message">There is no information to display.</td></tr>
|
||||
<tr ng-repeat="pm in pms">
|
||||
<td>
|
||||
<a ng-href="/workorders/add?clientId={{master._id}}&reason=Preventive%20Maintenance&remarks={{pm}}">Preventive Maintenance ({{pm}})</a><br>
|
||||
<a ng-href="/workorders/add?workorderType=pm&clientId={{master._id}}&type={{pm}}">Preventive Maintenance ({{pm}})</a><br>
|
||||
</td>
|
||||
<td>This Month</td>
|
||||
<td>PM Due</td>
|
||||
@ -285,4 +285,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -43,7 +43,7 @@
|
||||
<tr ng-show="loading"><td colspan="4" class="table-loading"><i class="loader"></i></td></tr>
|
||||
<tr ng-hide="loading || pms.length"><td colspan="4" class="table-message">There is no information to display.</td></tr>
|
||||
<tr ng-hide="loading" ng-repeat="pm in pms">
|
||||
<td><a ng-href="/workorders/add?clientId={{pm.client._id}}&reason=Preventive%20Maintenance&remarks={{pm.reason}}">{{pm.client.name}} ({{pm.client.identifier | uppercase}})</a><br>
|
||||
<td><a ng-href="/workorders/add?workorderType=pm&clientId={{pm.client._id}}&type={{pm.reason}}">{{pm.client.name}} ({{pm.client.identifier | uppercase}})</a><br>
|
||||
<td>{{pm.reason}}</td>
|
||||
<td>{{pm.client.contacts[0].name}}</td>
|
||||
<td>{{pm.lient.contacts[0].phone}}</td>
|
||||
@ -51,4 +51,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label">Reason</label>
|
||||
<div class="controls">
|
||||
<select ng-model="model.reason" name="reason" class="input-xlarge">
|
||||
<select ng-model="model.reason" name="reason" class="input-xlarge" ng-disabled="{{workorderType == 'pm'}}">
|
||||
<option value="Add New Equipment">Add New Equipment</option>
|
||||
<option value="As Directed">As Directed</option>
|
||||
<option value="Autoclave Repair">Autoclave Repair</option>
|
||||
@ -45,6 +45,25 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-show="model.reason == 'Preventive Maintenance'">
|
||||
<label class="control-label">Maintenance Type</label>
|
||||
<div class="controls">
|
||||
<select ng-model="model.maintenanceType" name="maintenanceType" class="input-xlarge" ng-disabled="{{workorderType == 'pm'}}">
|
||||
<option value="anesthesia">anesthesia</option>
|
||||
<option value="annual">annual</option>
|
||||
<option value="ert">ert</option>
|
||||
<option value="imaging">imaging</option>
|
||||
<option value="medgas">medgas</option>
|
||||
<option value="neptune">neptune</option>
|
||||
<option value="quarterly">quarterly</option>
|
||||
<option value="rae">rae</option>
|
||||
<option value="semi">semi</option>
|
||||
<option value="sterilizer">sterilizer</option>
|
||||
<option value="tg">tg</option>
|
||||
<option value="legacy" disabled>legacy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">Remarks</label>
|
||||
<div class="controls">
|
||||
|
@ -40,6 +40,7 @@
|
||||
<div class="section-label">Remarks</div>
|
||||
<div class="section-container">
|
||||
<div ng-hide="remarks.visible" class="form-preview">
|
||||
{{master.reason}}<br>
|
||||
{{master.remarks}}<br>
|
||||
<a ng-click="remarks.edit()" ng-class="{disabled: editing}">Edit</a>
|
||||
</div>
|
||||
@ -63,6 +64,26 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-show="remarks.model.reason == 'Preventive Maintenance'">
|
||||
<label class="control-label">Maintenance Type</label>
|
||||
<div class="controls">
|
||||
<select ng-model="remarks.model.maintenanceType" name="maintenanceType" class="input-xlarge">
|
||||
<option value="anesthesia">anesthesia</option>
|
||||
<option value="annual">annual</option>
|
||||
<option value="ert">ert</option>
|
||||
<option value="imaging">imaging</option>
|
||||
<option value="medgas">medgas</option>
|
||||
<option value="neptune">neptune</option>
|
||||
<option value="quarterly">quarterly</option>
|
||||
<option value="rae">rae</option>
|
||||
<option value="semi">semi</option>
|
||||
<option value="sterilizer">sterilizer</option>
|
||||
<option value="tg">tg</option>
|
||||
<option value="legacy" disabled>legacy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Remarks</label>
|
||||
<div class="controls">
|
||||
|
6
start.sh
Executable file
6
start.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
while true;
|
||||
do
|
||||
NODE_ENV='prod' node/bin/node server.js
|
||||
done
|
9
start2.sh
Executable file
9
start2.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
TIMESTAMP=$(date +"%m.%d.%Y at %H:%M:%S")
|
||||
while true;
|
||||
do
|
||||
NODE_ENV='prod' node/bin/node server.js >> logs/portal.log
|
||||
echo "-------------------------------Shutdown / Crash-------------------------------" >> logs/portal.log
|
||||
echo "Server was reset on $TIMESTAMP" >> logs/crash.log
|
||||
notify_by_pushover -u aJmPD4KigO0vLwim76n3WqWKwbKA3k -a YxspDLz3WinbPmwBThuZXCME9QmkDb -s 'falling' -t "Portal Reset" -m "Biomed portal was reset on $TIMESTAMP . See the log file for more details"
|
||||
done
|
Reference in New Issue
Block a user