소스 검색

Generated shallow-views command

Vijayakrishnan 5 년 전
부모
커밋
2b35616f3e

+ 118 - 0
app/Console/Commands/GenerateVCommand.php

@@ -0,0 +1,118 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class GenerateVCommand extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'generatev
+                            {path: /path/to/views.json}';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        //
+
+        global $argv;
+        $views = json_decode(file_get_contents($argv[2]));
+
+        $routes = ['/* __SCAFFOLD_VIEW_ROUTES__ */'];
+
+        foreach ($views as $view) {
+
+            $template = file_get_contents(base_path('generatecv/form.template.blade.php'));
+
+            $text = str_replace("_TITLE_", $view->title, $template);
+            $text = str_replace("_ACTION_", $view->action, $text);
+
+            // fields
+            /*
+             <div class="form-group">
+                <label class="control-label">cellNumber</label>
+                <input type=cellNumber"text" class="form-control">
+            </div>
+            */
+            $fields = [];
+
+            foreach ($view->fields as $name => $field) {
+                $html = "<div class='form-group'>\n" .
+                    "<label class='control-label'>{$field->name}</label>\n";
+
+                if(!isset($field->type)) {
+                    $field->type = "text";
+                }
+
+                switch($field->type) {
+                    case "switch":
+                        // todo
+                        break;
+                    default:
+                        $html .= "<input type='{$field->type}' name='$name' class='form-control'>\n";
+                        break;
+                }
+
+                $html .= "</div>\n";
+                $fields[] = $html;
+            }
+            $text = str_replace("_FIELDS_", implode("\n", $fields), $text);
+
+            $this->file_force_contents(resource_path("views/{$view->output}.blade.php"), $text);
+            echo "Generated " . resource_path("views/{$view->output}.blade.php") . "\n";
+
+            $routes[] = "/* SCAFVR */Route::get('{$view->output}', function () { return view('{$view->output}'); });";
+
+        }
+
+        // write routes
+        $text = [];
+        $file = fopen(base_path("routes/web.php"), "r");
+        while (!feof($file)) {
+            $line = rtrim(fgets($file));
+            if(strpos($line, "/* SCAFVR */") === FALSE) {
+                $text[] = $line;
+            }
+        }
+        $text = implode("\n", $text);
+        fclose($file);
+        $text = str_replace("/* __SCAFFOLD_VIEW_ROUTES__ */", implode("\n", $routes), $text);
+        file_put_contents(base_path("routes/web.php"), $text);
+        echo "Updated " . base_path("routes/web.php") . "\n";
+
+    }
+
+    private function file_force_contents($dir, $contents){
+        $parts = explode('/', $dir);
+        $file = array_pop($parts);
+        $dir = '';
+        foreach($parts as $part)
+            if(!is_dir($dir .= "/$part")) mkdir($dir);
+        file_put_contents("$dir/$file", $contents);
+    }
+}

+ 110 - 0
app/Console/Commands/GenerateVShortCommand.php

@@ -0,0 +1,110 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class GenerateVShortCommand extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'generatevshort
+                            {path: /path/to/views.json}';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        //
+
+        global $argv;
+        $views = json_decode(file_get_contents($argv[2]));
+
+        $routes = ['/* __SCAFFOLD_VIEW_ROUTES__ */'];
+
+        foreach ($views as $output => $view) {
+
+            $template = file_get_contents(base_path('generatecv/form.template.blade.php'));
+
+            $text = str_replace("_TITLE_", $view[0], $template);
+            $text = str_replace("_ACTION_", $view[1], $text);
+
+            // fields
+            $fields = [];
+
+            foreach ($view[2] as $field) {
+                $parts = explode(":", $field);
+                $type = "text";
+                if(count($parts) === 3) $type = $parts[2];
+                $html = "<div class='form-group'>\n" .
+                    "<label class='control-label'>{$parts[1]}</label>\n";
+                switch($type) {
+                    case "switch":
+                        // todo
+                        break;
+                    default:
+                        $html .= "<input type='{$type}' name='{$parts[1]}' class='form-control'>\n";
+                        break;
+                }
+
+                $html .= "</div>\n";
+                $fields[] = $html;
+            }
+            $text = str_replace("_FIELDS_", implode("\n", $fields), $text);
+
+            $this->file_force_contents(resource_path("views/$output.blade.php"), $text);
+            echo "Generated " . resource_path("views/$output.blade.php") . "\n";
+
+            $routes[] = "/* SCAFVR */Route::get('$output', function () { return view('$output'); });";
+
+        }
+
+        // write routes
+        $text = [];
+        $file = fopen(base_path("routes/web.php"), "r");
+        while (!feof($file)) {
+            $line = rtrim(fgets($file));
+            if(strpos($line, "/* SCAFVR */") === FALSE) {
+                $text[] = $line;
+            }
+        }
+        $text = implode("\n", $text);
+        fclose($file);
+        $text = str_replace("/* __SCAFFOLD_VIEW_ROUTES__ */", implode("\n", $routes), $text);
+        file_put_contents(base_path("routes/web.php"), $text);
+        echo "Updated " . base_path("routes/web.php") . "\n";
+
+    }
+
+    private function file_force_contents($dir, $contents){
+        $parts = explode('/', $dir);
+        $file = array_pop($parts);
+        $dir = '';
+        foreach($parts as $part)
+            if(!is_dir($dir .= "/$part")) mkdir($dir);
+        file_put_contents("$dir/$file", $contents);
+    }
+}

+ 1 - 0
app/Console/Kernel.php

@@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
         Commands\GenerateMCommand::class,
         Commands\GenerateCCommand::class,
         Commands\GenerateCVCommand::class,
+        Commands\GenerateVCommand::class,
     ];
 
     /**

+ 16 - 0
generatecv/form.template.blade.php

@@ -0,0 +1,16 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+    <div class="card">
+        <div class="card-header">_TITLE_</div>
+        <div class="card-body">
+            <div>
+                <form url="_ACTION_" method="POST">
+                    _FIELDS_
+                    <div class="form-group">
+                        <button class="btn btn-primary">Submit</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection

+ 11 - 0
generatecv/shallow-views-short.json

@@ -0,0 +1,11 @@
+{
+    "client/add-note": [
+        "Create Note",
+        "/api/client/addNote",
+        [
+            "name:Name",
+            "date:Date of Birth:date"
+        ]
+    ]
+}
+

+ 16 - 0
generatecv/shallow-views.json

@@ -0,0 +1,16 @@
+[
+    {
+        "output": "client/add-note",
+        "title": "Create Note",
+        "action": "/api/client/addNote",
+        "fields": {
+            "name": {
+                "name": "Name"
+            },
+            "date": {
+                "name": "Date of Birth",
+                "type": "date"
+            }
+        }
+    }
+]

+ 559 - 0
spec.txt

@@ -0,0 +1,559 @@
+
+	dashboard
+
+			# MCP new E&M visits required
+
+			Requesting my signature:
+
+				# Notes
+				# Action items
+				# E-prescriptions
+				# Bills
+
+			# Previous care months I have to close out
+
+			# Clients total
+
+				# 	Enrolled in care management
+
+				#		& Cancelled for this month
+
+				#		& Not cancelled for this month
+
+							& HCP time in minutes:
+
+				#				None
+				#				1-4
+				#				5-9
+				#				10-14
+				#				15-19
+				#				20-24
+				#				25-29
+				#				30-39
+				#				40-49
+				#				50-59
+				#				60+
+
+							& HCP time in minutes:
+
+				#				None
+				#				1-4
+				#				5-9
+				#				10-14
+				#				15-19
+				#				20-24
+				#				25-29
+				#				30+
+
+				# 	& Enrolled in remote monitoring
+
+				#		& Cancelled for this month
+
+				#		& Not cancelled for this month
+
+							& Total time in minutes:
+
+				#				None
+				#				1-4
+				#				5-9
+				#				10-14
+				#				15-19
+				#				20-24
+				#				25-29
+				#				30-34
+				#				35-39
+				#				40+
+
+	my_payment_schedule
+
+		Code | Description (HCP/Ally) | Amount | Earnings
+
+	my_teams
+
+	Team # | HCP | Ally | Client Count
+
+	my_teams/add_new
+
+		Pro Username: [_______] // TODO * BETTER
+
+		[SUBMIT]
+
+	my_teams/view/{uid}
+
+		INFO:
+
+			Team #:
+			HCP:
+			Ally:
+			Client Count:
+
+		SUB:
+
+			/dashboard
+
+				# Clients Total
+
+				# 	Enrolled in care Management
+
+				#		& Cancelled for this Month
+
+				#		& Not Cancelled for this Month
+
+							& Total Time in Minutes:
+
+				#				None
+				#				1-4
+				#				5-9
+				#				10-14
+				#				15-19
+				#				20-24
+				#				25-29
+				#				30-39
+				#				40-49
+				#				50-59
+				#				60+
+
+							& HCP Time in Minutes:
+
+				#				None
+				#				1-4
+				#				5-9
+				#				10-14
+				#				15-19
+				#				20-24
+				#				25-29
+				#				30+
+
+				# 	& Enrolled in Remote Monitoring
+
+				#		& Cancelled for this Month
+
+				#		& Not Cancelled for this Month
+
+							& Total Time in Minutes:
+
+				#				None
+				#				1-4
+				#				5-9
+				#				10-14
+				#				15-19
+				#				20-24
+				#				25-29
+				#				30-34
+				#				35-39
+				#				40+
+
+			/clients
+											[+ Add New] -> my_clients/add_new?teamUid=...
+
+				Name | DOB | Sex | CM | RM | MCP | Ally
+
+			/audit_log
+
+				Date | Client | Field | Old | New
+
+	my_clients
+
+		Name | DOB | Sex | CM | RM | MCP | Ally
+
+	my_clients/add_new
+
+		...name
+		...gender
+		...date of birth
+		...cell number
+		...email address
+
+		...phone-info
+		...address
+
+		...medicare number!
+			...outcome
+
+		Current height:
+		Current weight:
+
+		...conditions:
+			[_] Type 2 diabetes
+			[_] Type 1 diabetes
+			[_] Prediabetes
+			[_] High blood pressure
+			[_] High cholesterol
+			[_] Previous cardiovascular disease, including "clogged artery" or previous heart attack or stroke
+			[_] Depression
+			[_] Obesity
+
+		Monthly care:
+
+			[_] CCM?
+			[_] RPM?
+
+			...team? or,
+			...ally? mcp?
+
+				...has mcp conducted an E&M visit?
+
+		[Submit]
+
+	my_clients/view/{uid}
+
+		INFO:
+
+			UID:
+			Created at:
+
+			Name: J V N
+
+			Gender:
+			DOB:
+			Cell #:
+			Email address:
+			...
+
+			ACTIONS:
+				sendCellNumberConfirmationMessage
+				confirmCellNumberWithConfirmationToken
+				putNewCellNumber
+				sendEmailAddressConfirmationMessage
+				confirmEmailAddressWithConfirmationToken
+				putNewEmailAddress
+				putTeam
+				removeTeam
+				putMcp
+				removeMcp
+				putAlly
+				removeAlly
+				putName
+				putGender
+				putDateOfBirth
+				putProfilePicture
+				removeProfilePicture
+				updatePhoneInfo
+				updateAddress
+				updateMedicareNumber
+				manuallySetIsPartBPrimaryConfirmedToTrue
+				manuallySetIsPartBPrimaryConfirmedToFalse
+				setHasMcpDoneEmVisitToTrue
+				updateMcpEmVisitInfo
+				setHasMcpDoneEmVisitToFalse
+				putCrmReasons
+				removeCrmReasons
+				setIsClientEnrolledInCmToTrue
+				setIsClientEnrolledInCmToFalse
+				updateWhyNotEnrolledInCm
+				setIsClientEnrolledInRmToTrue
+				setIsClientEnrolledInRmToFalse
+				updateWhyNotEnrolledInRm
+				updateIntakeInfo
+				deactivate
+				updateDeactivationMemo
+				reactivate
+				updateReactivationMemo
+
+		SUB:
+
+			/dashboard
+
+			/med_profile
+
+				Medications: [+ Add New]
+
+				Problems: [+ Add New]
+
+				Allergies: [+ Add New]
+
+				History
+
+					Past Medical [+ Add New]
+					Past Surgical [+ Add New]
+					Family [+ Add New]
+					Social [+ Add New]
+					OB & Pregnancy [+ Add New]
+					Hospitalizations / Procedures [+ Add New]
+					Implantable Devices [+ Add New]
+
+				Checklist: [edit]
+					Tobacco:
+					Alcohol:
+					Depression:
+					Elder Maltreatment:
+
+				Open E-Prescriptions:
+
+				Open Action Items:
+
+			/med_profile_log
+
+				Category | Content | Data Entered?
+
+			/pro_access [+ Add New]
+										[+ Add new]
+				Pro | Reason | Memo | Actions
+
+			/notes
+																		[+Add New]
+				HCP | Ally | Date | Reason(s) | Location | Category | Content | Ally Signed? | HCP Signed? | Billed?
+
+			/notes/add_new
+
+				Category:
+
+				HCP:
+				Ally:
+
+				Effective Date:
+
+				Reason 1:
+				Reason 2:
+				Reason 3:
+
+				Service Location:
+
+				[CREATE]
+
+			/care_months
+
+																				    [+ Add New]
+				MM/YY | HCP | Ally | Reasons | CM: Status, Time, Bill | RM: Status, Time, Bill
+
+			/care_months/add_new
+
+				[month] [year]
+				[SUBMIT]
+
+			/care_month_entries
+
+				MM/YY | Date | CM or RM | Pro | Time | Content | Actions
+
+			/bills
+
+				Effective Date | Location | Note / Care Month (CM or RM) | HCP | Ally | Reason(s) | Code | Modifier | # Units | Signed by Ally? | Signed by HCP? |
+					HCP Expected Amount | HCP Payment |
+					Ally Expected Amount | Ally Payment |
+					Cancelled? | Submitted? | Collected Amount |
+					Is Resubmission Required?
+
+			/related_transactions
+
+				Date | Basis | Pro | Bill | +/- | Amount | Result | Memo
+
+			/action_items
+
+				Date | Ally | Ally Signed? | Prescriber | Prescriber Signed? | To Facility | Content | Status
+
+			/action_items/add_new
+
+				// TODO
+
+			/erx
+
+				Date | Ally | Ally Signed? | Prescriber | Prescriber Signed? | To Facility | Content | Status
+
+			/erx/add_new
+
+				// TODO
+
+			/mcp_updates
+
+				Date | HCP
+
+			/ally_updates
+
+				Date | Pro
+
+			/audit_log
+
+				Date | Client | Field | Old | New
+
+	notes
+
+		Date | Client | HCP | Ally | Reason(s) | Location | Category | Content | Ally Signed? | HCP Signed? | Billed?
+
+	notes/view/{uid}
+
+		INFO:
+
+			Date
+			Location
+			Client
+			HCP: _____ Signed? ______
+			Ally: ____ Signed? ______
+			Reason(s):
+
+			Category:
+
+			Content:
+				...
+
+		SUB:
+
+			/dashboard
+
+				Billed? [+ Generate Bill]
+					Effective Date |
+					Location |
+					Note / Care Month (CM or RM) |
+					HCP |
+					Ally |
+					Reason(s) |
+					Code |
+					Modifier |
+					# Units |
+					Signed by Ally? |
+					Signed by HCP? |
+					HCP Expected Amount |
+					HCP Payment |
+					Ally Expected Amount |
+					Ally Payment |
+					Cancelled? |
+					Submitted? |
+					Collected Amount |
+					Is Resubmission Required?
+
+			/audit_log
+
+				Date | Client | Field | Old | New
+
+	erx
+
+		Date | Client | Ally | Ally Signed? | Prescriber | Prescriber Signed? | To Facility | Content | Status
+
+	erx/view/{uid}
+
+		INFO:
+
+			Date
+			Client
+			Ally: _____ Signed? ______
+			Prescriber: _____ Signed? _____
+			To Facility:
+			Content:
+			Status:
+
+		SUB:
+
+			/dashboard
+
+				Faxes:
+
+					// TODO
+
+			/audit_log
+
+	action_items
+
+		Date | Client | Ally
+
+	action_items/view/:uid
+
+		INFO:
+
+			Date
+			Client
+			Ally: ____ Signed? ____
+			Prescriber: ____ Signed? ____
+			To Facility:
+			Content:
+			Status:
+
+			/dashboard
+
+				Faxes:
+
+					// TODO
+
+			/audit_log
+
+	care_months
+
+	care_months/view/:uid
+
+		...
+
+		/dashboard
+
+		/time_entries
+
+		/audit_log
+
+	care_month_entries
+
+	bills
+
+	bills/view/{uid}
+
+		/dashboard
+
+		/transactions
+
+		/audit_log
+
+	transactions
+
+	med_profile_lines
+
+	med_profile_line_updates
+
+	pro_access
+
+	mcp_updates
+
+	ally_updates
+
+	audit_log
+
+	admin
+
+		/dashboard
+
+		/facilities
+
+		/facilities/add_new
+
+		/facilities/view/{iid}
+
+			/dashboard
+
+			/erx
+
+			/action_items
+
+			/audit_log
+
+		/pros
+
+		/pros/add_new
+
+		/pros/view/{iid}
+
+			/dashboard
+
+			/payment_schedule
+
+			/teams
+
+			/clients
+
+			/pro_access
+
+			/mcp_updates
+
+			/ally_updates
+
+			/erx
+
+			/action_items
+
+			/care_months
+
+			/care_month_entries
+
+			/notes
+
+			/bills
+
+			/pro_transactions
+
+			/sessions
+
+			/audit_log

+ 13 - 0
topmost-prio.txt

@@ -0,0 +1,13 @@
+Topmost priority items:
+
+1. Client
+    Create -> (gen + manual tweak)
+    Listing -> (gen + manual tweak)
+    Single -> (mostly manual)
+        -> Create Note (atomic gen - manual stitch)
+        -> Add CM entry (atomic gen - manual stitch)
+        -> Add RM entry? (atomic gen - manual stitch)
+        -> Create Bill (atomic gen - manual stitch)
+
+2. Dashboard - mostly manual
+