|
@@ -254,29 +254,29 @@ func (c *PatientApiController) CreatePatient() {
|
254
|
254
|
//获取老表的最后一条数据
|
255
|
255
|
patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
|
256
|
256
|
patientsNew := models.XtPatientsNew{
|
257
|
|
- UserOrgId: adminUserInfo.CurrentOrgId,
|
258
|
|
- UserId: 0,
|
259
|
|
- Avatar: patients.Avatar,
|
260
|
|
- PatientType: patients.PatientType,
|
261
|
|
- DialysisNo: patients.DialysisNo,
|
262
|
|
- AdmissionNumber: patients.AdmissionNumber,
|
263
|
|
- Source: patients.Source,
|
264
|
|
- Lapseto: patients.Lapseto,
|
265
|
|
- PartitionId: patients.PartitionId,
|
266
|
|
- BedId: patients.BedId,
|
267
|
|
- Name: patients.Name,
|
268
|
|
- Alias: patients.Alias,
|
269
|
|
- Gender: patients.Gender,
|
270
|
|
- MaritalStatus: patients.MaritalStatus,
|
271
|
|
- IdCardNo: patients.IdCardNo,
|
272
|
|
- Birthday: patients.Birthday,
|
273
|
|
- ReimbursementWayId: patients.ReimbursementWayId,
|
274
|
|
- HealthCareType: patients.HealthCareType,
|
275
|
|
- HealthCareNo: patients.HealthCareNo,
|
276
|
|
- HealthCareDueDate: patients.HealthCareDueDate,
|
277
|
|
- Height: patients.Height,
|
278
|
|
- BloodType: patients.BloodType,
|
279
|
|
- Rh: patients.Rh,
|
|
257
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
|
258
|
+ UserId: 0,
|
|
259
|
+ Avatar: patients.Avatar,
|
|
260
|
+ PatientType: patients.PatientType,
|
|
261
|
+ DialysisNo: patients.DialysisNo,
|
|
262
|
+ AdmissionNumber: patients.AdmissionNumber,
|
|
263
|
+ Source: patients.Source,
|
|
264
|
+ Lapseto: patients.Lapseto,
|
|
265
|
+ PartitionId: patients.PartitionId,
|
|
266
|
+ BedId: patients.BedId,
|
|
267
|
+ Name: patients.Name,
|
|
268
|
+ Alias: patients.Alias,
|
|
269
|
+ Gender: patients.Gender,
|
|
270
|
+ MaritalStatus: patients.MaritalStatus,
|
|
271
|
+ IdCardNo: patients.IdCardNo,
|
|
272
|
+ Birthday: patients.Birthday,
|
|
273
|
+ ReimbursementWayId: patients.ReimbursementWayId,
|
|
274
|
+ HealthCareType: patients.HealthCareType,
|
|
275
|
+ HealthCareNo: patients.HealthCareNo,
|
|
276
|
+ HealthCareDueDate: patients.HealthCareDueDate,
|
|
277
|
+ Height: patients.Height,
|
|
278
|
+ BloodType: patients.BloodType,
|
|
279
|
+ Rh: patients.Rh,
|
280
|
280
|
HealthCareDueAlertDate: patients.HealthCareDueAlertDate,
|
281
|
281
|
EducationLevel: patients.EducationLevel,
|
282
|
282
|
Profession: patients.Profession,
|
|
@@ -322,28 +322,28 @@ func (c *PatientApiController) CreatePatient() {
|
322
|
322
|
Nation: patients.Nation,
|
323
|
323
|
NativePlace: patients.NativePlace,
|
324
|
324
|
Age: patients.Age,
|
325
|
|
- InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
|
326
|
|
- IsInfectious: patients.IsInfectious,
|
327
|
|
- RemindCycle: patients.RemindCycle,
|
328
|
|
- ResponseResult: patients.ResponseResult,
|
329
|
|
- IsOpenRemind: patients.IsOpenRemind,
|
330
|
|
- FirstTreatmentDate: patients.FirstTreatmentDate,
|
331
|
|
- DialysisAge: patients.DialysisAge,
|
332
|
|
- ExpenseKind: patients.ExpenseKind,
|
333
|
|
- TellPhone: patients.TellPhone,
|
334
|
|
- ContactName: patients.ContactName,
|
335
|
|
- BloodPatients: 1,
|
336
|
|
- SlowPatients: 0,
|
337
|
|
- MemberPatients: 0,
|
338
|
|
- EcommerPatients: "",
|
339
|
|
- BloodId: patients.ID,
|
340
|
|
- SlowId: 0,
|
341
|
|
- MemberId: 0,
|
342
|
|
- MemberFistdate: 0,
|
343
|
|
- MemberPatienttype: 0,
|
344
|
|
- MemberTreatement: 0,
|
345
|
|
- EquitmentId: "",
|
346
|
|
- UserSysBeforeCount: patient.UserSysBeforeCount,
|
|
325
|
+ InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
|
|
326
|
+ IsInfectious: patients.IsInfectious,
|
|
327
|
+ RemindCycle: patients.RemindCycle,
|
|
328
|
+ ResponseResult: patients.ResponseResult,
|
|
329
|
+ IsOpenRemind: patients.IsOpenRemind,
|
|
330
|
+ FirstTreatmentDate: patients.FirstTreatmentDate,
|
|
331
|
+ DialysisAge: patients.DialysisAge,
|
|
332
|
+ ExpenseKind: patients.ExpenseKind,
|
|
333
|
+ TellPhone: patients.TellPhone,
|
|
334
|
+ ContactName: patients.ContactName,
|
|
335
|
+ BloodPatients: 1,
|
|
336
|
+ SlowPatients: 0,
|
|
337
|
+ MemberPatients: 0,
|
|
338
|
+ EcommerPatients: "",
|
|
339
|
+ BloodId: patients.ID,
|
|
340
|
+ SlowId: 0,
|
|
341
|
+ MemberId: 0,
|
|
342
|
+ MemberFistdate: 0,
|
|
343
|
+ MemberPatienttype: 0,
|
|
344
|
+ MemberTreatement: 0,
|
|
345
|
+ EquitmentId: "",
|
|
346
|
+ UserSysBeforeCount: patient.UserSysBeforeCount,
|
347
|
347
|
}
|
348
|
348
|
|
349
|
349
|
err = service.CreatePatientsNew(&patientsNew)
|
|
@@ -481,28 +481,28 @@ func (c *PatientApiController) EditPatient() {
|
481
|
481
|
return
|
482
|
482
|
}
|
483
|
483
|
patientsNew := models.XtPatientsNew{
|
484
|
|
- UserOrgId: patient.UserOrgId,
|
485
|
|
- UserId: patient.UserId,
|
486
|
|
- Avatar: patient.Avatar,
|
487
|
|
- PatientType: patient.PatientType,
|
488
|
|
- DialysisNo: patient.DialysisNo,
|
489
|
|
- AdmissionNumber: patient.AdmissionNumber,
|
490
|
|
- Source: patient.Source,
|
491
|
|
- PartitionId: patient.PartitionId,
|
492
|
|
- BedId: patient.BedId,
|
493
|
|
- Name: patient.Name,
|
494
|
|
- Alias: patient.Alias,
|
495
|
|
- Gender: patient.Gender,
|
496
|
|
- MaritalStatus: patient.MaritalStatus,
|
497
|
|
- IdCardNo: patient.IdCardNo,
|
498
|
|
- Birthday: patient.Birthday,
|
499
|
|
- ReimbursementWayId: patient.ReimbursementWayId,
|
500
|
|
- HealthCareType: patient.HealthCareType,
|
501
|
|
- HealthCareNo: patient.HealthCareNo,
|
502
|
|
- HealthCareDueDate: patient.HealthCareDueDate,
|
503
|
|
- Height: patient.Height,
|
504
|
|
- BloodType: patient.BloodType,
|
505
|
|
- Rh: patient.Rh,
|
|
484
|
+ UserOrgId: patient.UserOrgId,
|
|
485
|
+ UserId: patient.UserId,
|
|
486
|
+ Avatar: patient.Avatar,
|
|
487
|
+ PatientType: patient.PatientType,
|
|
488
|
+ DialysisNo: patient.DialysisNo,
|
|
489
|
+ AdmissionNumber: patient.AdmissionNumber,
|
|
490
|
+ Source: patient.Source,
|
|
491
|
+ PartitionId: patient.PartitionId,
|
|
492
|
+ BedId: patient.BedId,
|
|
493
|
+ Name: patient.Name,
|
|
494
|
+ Alias: patient.Alias,
|
|
495
|
+ Gender: patient.Gender,
|
|
496
|
+ MaritalStatus: patient.MaritalStatus,
|
|
497
|
+ IdCardNo: patient.IdCardNo,
|
|
498
|
+ Birthday: patient.Birthday,
|
|
499
|
+ ReimbursementWayId: patient.ReimbursementWayId,
|
|
500
|
+ HealthCareType: patient.HealthCareType,
|
|
501
|
+ HealthCareNo: patient.HealthCareNo,
|
|
502
|
+ HealthCareDueDate: patient.HealthCareDueDate,
|
|
503
|
+ Height: patient.Height,
|
|
504
|
+ BloodType: patient.BloodType,
|
|
505
|
+ Rh: patient.Rh,
|
506
|
506
|
HealthCareDueAlertDate: patient.HealthCareDueAlertDate,
|
507
|
507
|
EducationLevel: patient.EducationLevel,
|
508
|
508
|
Profession: patient.Profession,
|
|
@@ -544,19 +544,19 @@ func (c *PatientApiController) EditPatient() {
|
544
|
544
|
Nation: patient.Nation,
|
545
|
545
|
NativePlace: patient.NativePlace,
|
546
|
546
|
Age: patient.Age,
|
547
|
|
- InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
|
548
|
|
- IsInfectious: patient.IsInfectious,
|
549
|
|
- RemindCycle: patient.RemindCycle,
|
550
|
|
- ResponseResult: patient.ResponseResult,
|
551
|
|
- IsOpenRemind: patient.IsOpenRemind,
|
552
|
|
- FirstTreatmentDate: patient.FirstTreatmentDate,
|
553
|
|
- DialysisAge: patient.DialysisAge,
|
554
|
|
- ExpenseKind: patient.ExpenseKind,
|
555
|
|
- TellPhone: patient.TellPhone,
|
556
|
|
- ContactName: patient.ContactName,
|
557
|
|
- UpdatedTime: time.Now().Unix(),
|
558
|
|
- BloodPatients: 1,
|
559
|
|
- Lapseto: patient.Lapseto,
|
|
547
|
+ InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
|
|
548
|
+ IsInfectious: patient.IsInfectious,
|
|
549
|
+ RemindCycle: patient.RemindCycle,
|
|
550
|
+ ResponseResult: patient.ResponseResult,
|
|
551
|
+ IsOpenRemind: patient.IsOpenRemind,
|
|
552
|
+ FirstTreatmentDate: patient.FirstTreatmentDate,
|
|
553
|
+ DialysisAge: patient.DialysisAge,
|
|
554
|
+ ExpenseKind: patient.ExpenseKind,
|
|
555
|
+ TellPhone: patient.TellPhone,
|
|
556
|
+ ContactName: patient.ContactName,
|
|
557
|
+ UpdatedTime: time.Now().Unix(),
|
|
558
|
+ BloodPatients: 1,
|
|
559
|
+ Lapseto: patient.Lapseto,
|
560
|
560
|
}
|
561
|
561
|
// //更新病人ID获取新表病人ID
|
562
|
562
|
err = service.UpdatepatientTwo(&patientsNew, id)
|
|
@@ -1594,7 +1594,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1594
|
1594
|
_, errcode := service.GetDrugWareseOut(theTime.Unix(), adminUserInfo.CurrentOrgId)
|
1595
|
1595
|
if errcode == gorm.ErrRecordNotFound {
|
1596
|
1596
|
timeArr := strings.Split(timeStr, "-")
|
1597
|
|
- total, _ := service.FindAllWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
1597
|
+ total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
1598
|
1598
|
|
1599
|
1599
|
total = total + 1
|
1600
|
1600
|
warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
|
@@ -1618,7 +1618,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1618
|
1618
|
}
|
1619
|
1619
|
|
1620
|
1620
|
timeArr := strings.Split(timeStr, "-")
|
1621
|
|
- total, _ := service.FindAllWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
1621
|
+ total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
1622
|
1622
|
|
1623
|
1623
|
total = total + 1
|
1624
|
1624
|
warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
|
@@ -1645,7 +1645,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1645
|
1645
|
prescribingNumber := strconv.FormatFloat(math.Abs(adviceName.PrescribingNumber), 'f', 0, 64)
|
1646
|
1646
|
outStoreNumber, _ := strconv.ParseInt(prescribingNumber, 10, 64)
|
1647
|
1647
|
timeArrs := strings.Split(timeStr, "-")
|
1648
|
|
- totals, _ := service.FindAllWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
1648
|
+ totals, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
1649
|
1649
|
|
1650
|
1650
|
totals = totals + 1
|
1651
|
1651
|
warehousing_out_orders := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArrs[0] + timeArrs[1] + timeArrs[2] + "000"
|
|
@@ -1664,15 +1664,15 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1664
|
1664
|
OrgId: adminUserInfo.CurrentOrgId,
|
1665
|
1665
|
IsCancel: 2,
|
1666
|
1666
|
WarehouseOutOrderNumber: warehousing_out_order,
|
1667
|
|
- Type: 1,
|
1668
|
|
- Manufacturer: orderOut.Manufacturer,
|
1669
|
|
- IsSys: 1,
|
1670
|
|
- SysRecordTime: theTime.Unix(),
|
|
1667
|
+ Type: 1,
|
|
1668
|
+ Manufacturer: orderOut.Manufacturer,
|
|
1669
|
+ IsSys: 1,
|
|
1670
|
+ SysRecordTime: theTime.Unix(),
|
1671
|
1671
|
}
|
1672
|
1672
|
service.CreateWareHouseOutInfo(&info)
|
1673
|
1673
|
|
1674
|
1674
|
timeArrss := strings.Split(timeStr, "-")
|
1675
|
|
- totalss, _ := service.FindAllWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
1675
|
+ totalss, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
1676
|
1676
|
|
1677
|
1677
|
totalss = totalss + 1
|
1678
|
1678
|
warehousing_out_orderss := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArrss[0] + timeArrss[1] + timeArrss[2] + "000"
|
|
@@ -1705,7 +1705,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1705
|
1705
|
|
1706
|
1706
|
timeStr := time.Now().Format("2006-01-02")
|
1707
|
1707
|
timeArr := strings.Split(timeStr, "-")
|
1708
|
|
- total, _ := service.FindAllWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
1708
|
+ total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
1709
|
1709
|
|
1710
|
1710
|
total = total + 1
|
1711
|
1711
|
warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
|
@@ -1713,37 +1713,27 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
1713
|
1713
|
number = number + total
|
1714
|
1714
|
warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
|
1715
|
1715
|
|
1716
|
|
- medicalName, errcode := service.GetSelfMedicalByDrugName(adviceName.AdviceName, adviceName.AdviceDesc, adviceName.PatientId)
|
1717
|
|
- if errcode == gorm.ErrRecordNotFound {
|
1718
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
1719
|
|
- "msg": "ok",
|
1720
|
|
- "advice": advice,
|
1721
|
|
- })
|
1722
|
|
- return
|
1723
|
|
- } else if errcode == nil {
|
1724
|
|
- outStock := models.XtSelfOutStock{
|
1725
|
|
- DrugName: adviceName.AdviceName,
|
1726
|
|
- DrugSpec: adviceName.AdviceDesc,
|
1727
|
|
- OutstoreNumber: outStoreNumber,
|
1728
|
|
- AdminUserId: adminUserInfo.AdminUser.Id,
|
1729
|
|
- CreatedTime: time.Now().Unix(),
|
1730
|
|
- Status: 1,
|
1731
|
|
- PatientId: adviceName.PatientId,
|
1732
|
|
- StockOutNumber: warehousing_out_order,
|
1733
|
|
- ExitMode: 2,
|
1734
|
|
- StorckTime: adviceName.AdviceDate,
|
1735
|
|
- MedicId: medicalName.ID,
|
1736
|
|
- DrugNameId: medicalName.DrugNameId,
|
1737
|
|
- UserOrgId: adminUserInfo.CurrentOrgId,
|
1738
|
|
- }
|
1739
|
|
- //创建出库单,自动出库
|
1740
|
|
- service.CreateOutStock(&outStock)
|
1741
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
1742
|
|
- "msg": "ok",
|
1743
|
|
- "advice": advice,
|
1744
|
|
- })
|
1745
|
|
- return
|
|
1716
|
+ outStock := models.XtSelfOutStock{
|
|
1717
|
+ DrugName: adviceName.AdviceName,
|
|
1718
|
+ DrugSpec: adviceName.AdviceDesc,
|
|
1719
|
+ OutstoreNumber: outStoreNumber,
|
|
1720
|
+ AdminUserId: adminUserInfo.AdminUser.Id,
|
|
1721
|
+ CreatedTime: time.Now().Unix(),
|
|
1722
|
+ Status: 1,
|
|
1723
|
+ PatientId: adviceName.PatientId,
|
|
1724
|
+ StockOutNumber: warehousing_out_order,
|
|
1725
|
+ ExitMode: 2,
|
|
1726
|
+ StorckTime: adviceName.AdviceDate,
|
|
1727
|
+ MedicId: adviceName.DrugId,
|
|
1728
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
1746
|
1729
|
}
|
|
1730
|
+ //创建出库单,自动出库
|
|
1731
|
+ service.CreateOutStock(&outStock)
|
|
1732
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1733
|
+ "msg": "ok",
|
|
1734
|
+ "advice": advice,
|
|
1735
|
+ })
|
|
1736
|
+ return
|
1747
|
1737
|
}
|
1748
|
1738
|
|
1749
|
1739
|
}
|