Using the AI Treatment Plan Generator and AI Chat Assistant.
HealthCIP integrates AI at two key points to reduce doctors' administrative burden while maintaining clinical accuracy:
Note: AI features are available in the Professional and Enterprise plans. You'll need an OpenAI or Deepseek API key configured by your system administrator.
The AI Treatment Plan Generator uses a two-stage pipeline that's both powerful and cost-efficient:
The AI receives only the patient's diagnosis and symptoms — no master data lists, no large context. It returns a conceptual treatment plan using generic medicine names (e.g., "Paracetamol 500mg tablet"). This prompt is tiny (~100 tokens), keeping API costs near zero.
The generic suggestions from Stage 1 are matched against your actual master data using BM25 text search — the same algorithm used in search engines. This maps generic medicine names to real products in your pharmacy, complete with their actual database IDs. This stage uses zero LLM tokens.
Pro tip: The AI respects your doctor's notes. If you write "Patient has a history of gastric issues — avoid aspirin," the treatment plan will reflect this preference.
After entering "Acute sinusitis with fever and headache" as the diagnosis, the AI might return:
| Medicine | Dosage | Interval | Duration | Timing |
|---|---|---|---|---|
| Amoxicillin 500mg capsule | 500mg | 1-0-1 | 7 Days | AFTER_MEAL |
| Paracetamol 500mg tablet | 500mg | 1-1-1 | 3 Days | AFTER_MEAL |
| Cetirizine 10mg tablet | 10mg | 0-0-1 | 7 Days | BEFORE_MEAL |
Each medicine is already matched to your actual inventory — the doctor just reviews and approves.
The AI service is powered by Spring AI and supports multiple LLM providers:
llm.model)llm.api-url (defaults to Deepseek API)Important clinical disclaimer: AI-generated treatment plans and chat responses are suggestions only. All clinical decisions must be reviewed and approved by a qualified medical professional. HealthCIP and LogicSoft Computers are not responsible for clinical outcomes resulting from AI-generated suggestions.
To enable AI features, your administrator needs to configure the following
in application.properties:
# LLM Provider Configuration llm.api-key=your-api-key-here llm.api-url=https://api.deepseek.com/v1/chat/completions llm.model=deepseek-v4-flash # OpenAI alternative (uses Spring AI auto-configuration) # spring.ai.openai.api-key=your-openai-key # spring.ai.openai.chat.model=gpt-4
The AI also uses Spring AI's ChatClient with
MessageChatMemoryAdvisor for chat memory management.
| File | Purpose |
|---|---|
AiService.java | Interface for AI chat service |
OpenAiServiceImpl.java | OpenAI/Spring AI chat implementation |
AiTreatmentPlanService.java | Two-stage treatment plan generator (LLM + BM25) |
AiInferenceService.java | AI inference for diagnosis support |
AiInvestigationService.java | AI-assisted investigation suggestions |
Bm25Matcher.java | BM25 text search algorithm for master data grounding |